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.
Files changed (211) hide show
  1. package/dist/cli.js +4462 -748
  2. package/package.json +5 -1
  3. package/templates/.gitkeep +0 -0
  4. package/templates/README.md +20 -0
  5. package/templates/agents/cbp-cc-executor.md +213 -0
  6. package/templates/agents/cbp-database-agent.md +229 -0
  7. package/templates/agents/cbp-improve-claude.md +245 -0
  8. package/templates/agents/cbp-improve-round.md +284 -0
  9. package/templates/agents/cbp-mechanical-edits.md +111 -0
  10. package/templates/agents/cbp-research.md +282 -0
  11. package/templates/agents/cbp-round-executor.md +604 -0
  12. package/templates/agents/cbp-security-agent.md +134 -0
  13. package/templates/agents/cbp-task-check.md +213 -0
  14. package/templates/agents/cbp-task-planner.md +582 -0
  15. package/templates/agents/cbp-test-e2e-agent.md +363 -0
  16. package/templates/agents/cbp-testing-qa-agent.md +400 -0
  17. package/templates/context/mcp-docs.md +139 -0
  18. package/templates/hooks/README.md +236 -0
  19. package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
  20. package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
  21. package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
  22. package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
  23. package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
  24. package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
  25. package/templates/hooks/cbp-notify.sh +68 -0
  26. package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
  27. package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
  28. package/templates/hooks/cbp-statusline.sh +347 -0
  29. package/templates/hooks/cbp-subagent-statusline.sh +182 -0
  30. package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
  31. package/templates/hooks/cbp-test-hooks.sh +320 -0
  32. package/templates/hooks/hooks.json +85 -0
  33. package/templates/hooks/validate-context-usage.sh +59 -0
  34. package/templates/hooks/validate-git-commit.sh +78 -0
  35. package/templates/hooks/validate-git-stash-deny.sh +32 -0
  36. package/templates/hooks/validate-structure-lengths.sh +57 -0
  37. package/templates/hooks/validate-structure-lib.sh +104 -0
  38. package/templates/hooks/validate-structure-patterns.sh +54 -0
  39. package/templates/hooks/validate-structure-scope.sh +33 -0
  40. package/templates/hooks/validate-structure-smoke.sh +95 -0
  41. package/templates/hooks/validate-structure-templates.sh +34 -0
  42. package/templates/hooks/validate-structure.sh +69 -0
  43. package/templates/rules/.gitkeep +0 -0
  44. package/templates/rules/README.md +47 -0
  45. package/templates/rules/context-file-loading.md +52 -0
  46. package/templates/rules/scope-vocabulary.md +64 -0
  47. package/templates/rules/todo-backend.md +109 -0
  48. package/templates/settings.project.base.json +55 -0
  49. package/templates/settings.user.base.json +25 -0
  50. package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
  51. package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
  52. package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
  53. package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
  54. package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
  55. package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
  56. package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
  57. package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
  58. package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
  59. package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
  60. package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
  61. package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
  62. package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
  63. package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
  64. package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
  65. package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
  66. package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
  67. package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
  68. package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
  69. package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
  70. package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
  71. package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
  72. package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
  73. package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
  74. package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
  75. package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
  76. package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
  77. package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
  78. package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
  79. package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
  80. package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
  81. package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
  82. package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
  83. package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
  84. package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
  85. package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
  86. package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
  87. package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
  88. package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
  89. package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
  90. package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
  91. package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
  92. package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
  93. package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
  94. package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
  95. package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
  96. package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
  97. package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
  98. package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
  99. package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
  100. package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
  101. package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
  102. package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
  103. package/templates/skills/cbp-checkpoint-create/SKILL.md +116 -0
  104. package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
  105. package/templates/skills/cbp-checkpoint-plan/SKILL.md +137 -0
  106. package/templates/skills/cbp-checkpoint-plan/reference/alternative-comparison-template.md +54 -0
  107. package/templates/skills/cbp-checkpoint-plan/reference/dep-decision-rubric.md +50 -0
  108. package/templates/skills/cbp-checkpoint-plan/reference/e2e-discovery-probe.md +57 -0
  109. package/templates/skills/cbp-checkpoint-plan/reference/gap-analysis-playbook.md +47 -0
  110. package/templates/skills/cbp-checkpoint-start/SKILL.md +84 -0
  111. package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
  112. package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
  113. package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
  114. package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
  115. package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
  116. package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
  117. package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
  118. package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
  119. package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
  120. package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
  121. package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
  122. package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
  123. package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
  124. package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
  125. package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
  126. package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
  127. package/templates/skills/cbp-git-commit/SKILL.md +278 -0
  128. package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
  129. package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
  130. package/templates/skills/cbp-merge-main/SKILL.md +228 -0
  131. package/templates/skills/cbp-round-check/SKILL.md +104 -0
  132. package/templates/skills/cbp-round-end/SKILL.md +183 -0
  133. package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
  134. package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
  135. package/templates/skills/cbp-round-execute/SKILL.md +211 -0
  136. package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
  137. package/templates/skills/cbp-round-input/SKILL.md +165 -0
  138. package/templates/skills/cbp-round-start/SKILL.md +222 -0
  139. package/templates/skills/cbp-round-update/SKILL.md +163 -0
  140. package/templates/skills/cbp-session-end/SKILL.md +187 -0
  141. package/templates/skills/cbp-session-start/SKILL.md +155 -0
  142. package/templates/skills/cbp-ship/SKILL.md +332 -0
  143. package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
  144. package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
  145. package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
  146. package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
  147. package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
  148. package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
  149. package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
  150. package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
  151. package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
  152. package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
  153. package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
  154. package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
  155. package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
  156. package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
  157. package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
  158. package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
  159. package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
  160. package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
  161. package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
  162. package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
  163. package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
  164. package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
  165. package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
  166. package/templates/skills/cbp-ship/reference/versioning.md +116 -0
  167. package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
  168. package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
  169. package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
  170. package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
  171. package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
  172. package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
  173. package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
  174. package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
  175. package/templates/skills/cbp-ship/templates/eas.json +66 -0
  176. package/templates/skills/cbp-ship/templates/railway.toml +15 -0
  177. package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
  178. package/templates/skills/cbp-ship/templates/vercel.json +19 -0
  179. package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
  180. package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
  181. package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
  182. package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
  183. package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
  184. package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
  185. package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
  186. package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
  187. package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
  188. package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
  189. package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
  190. package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
  191. package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
  192. package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
  193. package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
  194. package/templates/skills/cbp-ship-main/SKILL.md +65 -0
  195. package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
  196. package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
  197. package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
  198. package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
  199. package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
  200. package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
  201. package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
  202. package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
  203. package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
  204. package/templates/skills/cbp-task-check/SKILL.md +166 -0
  205. package/templates/skills/cbp-task-complete/SKILL.md +206 -0
  206. package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
  207. package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
  208. package/templates/skills/cbp-task-create/SKILL.md +167 -0
  209. package/templates/skills/cbp-task-start/SKILL.md +239 -0
  210. package/templates/skills/cbp-task-testing/SKILL.md +277 -0
  211. package/templates/skills/cbp-todo/SKILL.md +111 -0
@@ -0,0 +1,239 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-supabase-setup
4
+ description: Enable Supabase GitHub branching integration — GitHub app authorization, required-status-check enforcement on main + integration branch, persistent branch creation, and idempotency marker in .codebyplan.json.
5
+ argument-hint: "[--force]"
6
+ allowed-tools: Read, Edit, Bash(supabase *), Bash(jq *), Bash(mv *), Bash(date *), Bash(test *), Bash(which *)
7
+ effort: xhigh
8
+ ---
9
+
10
+ # Supabase Branching Setup
11
+
12
+ Enable Supabase's GitHub branching integration so every pull request gets an isolated preview
13
+ environment and the integration branch (`branch_config.integration`) gets a persistent
14
+ Supabase project for shared staging.
15
+
16
+ Invoke at any time. Already-completed steps are skipped via idempotency checks.
17
+ Pass `--force` to re-run all steps regardless of marker state.
18
+
19
+ ## Arguments
20
+
21
+ Inspect `$ARGUMENTS` for `--force`. If present, set `force_mode = true` and bypass every
22
+ per-item idempotency check in Steps 2–5 (the marker is still re-written at Step 7).
23
+ Absent: proceed with normal idempotency — already-done items report `already-done` and skip.
24
+
25
+ ## Step 1 — Verify Supabase is initialised locally
26
+
27
+ ```bash
28
+ test -f supabase/config.toml && echo "ok" || echo "missing"
29
+ test -d supabase/migrations && echo "ok" || echo "missing"
30
+ ```
31
+
32
+ If either is missing: bail with this message and stop.
33
+
34
+ ```
35
+ supabase/ not found in this repo. Run `supabase init` and `supabase link --project-ref <ref>`
36
+ first, then re-invoke /cbp-supabase-setup.
37
+ ```
38
+
39
+ ## Step 2 — Read project_id and idempotency state
40
+
41
+ Read `supabase/config.toml` to extract the linked `project_id` (under `[api]` or the top-level
42
+ `project_id` field, depending on CLI version).
43
+
44
+ Read `.codebyplan.json`:
45
+
46
+ ```bash
47
+ jq '.branch_config.integration // empty' .codebyplan.json
48
+ jq '.shipment.surfaces.supabase.branching_configured // empty' .codebyplan.json
49
+ ```
50
+
51
+ Track per-item done state:
52
+ - `github_app_installed` — true if `branching_configured.github_app_installed` is already true
53
+ - `required_check_enforced` — true if `branching_configured.required_check_enforced` is already true
54
+ - `persistent_branch_created` — true if `[remotes.<integration>]` block already exists in
55
+ `supabase/config.toml`
56
+
57
+ With `--force`, treat all as false and re-run.
58
+
59
+ ## Step 3 — Dashboard: enable GitHub integration (manual checklist)
60
+
61
+ If `github_app_installed` is already true, print `already done — skipping` and continue to Step 4.
62
+
63
+ Otherwise, display the checklist and AskUserQuestion for confirmation when done:
64
+
65
+ ```
66
+ Dashboard checklist (do each step in the Supabase dashboard, then confirm):
67
+
68
+ 1. Project Settings → Integrations → GitHub → Authorize GitHub
69
+ 2. Select this repository from the dropdown
70
+ 3. Set Supabase directory to: ./supabase
71
+ 4. Enable: Automatic branching
72
+ 5. Enable: Supabase changes only
73
+ 6. Enable: Deploy to production
74
+ 7. Click Save / Enable integration
75
+
76
+ Full step-by-step: reference/branching-setup.md § 1
77
+ ```
78
+
79
+ AskUserQuestion: "Confirm when the GitHub integration is saved in the Supabase dashboard."
80
+
81
+ Set `github_app_installed = true` in the idempotency tracker (persisted at Step 7).
82
+
83
+ ## Step 4 — GitHub repo: required status check (manual checklist)
84
+
85
+ Read `branch_config.integration` from `.codebyplan.json`. Determine branches to protect:
86
+
87
+ - Always: `main`
88
+ - Also: `branch_config.integration` (when set and !== 'main')
89
+
90
+ If `required_check_enforced` is already true, print `already done — skipping` and continue.
91
+
92
+ Otherwise, display the checklist for EACH branch and AskUserQuestion:
93
+
94
+ ```
95
+ GitHub required-status-check setup (repeat for each branch listed):
96
+
97
+ Branches to protect: main, <integration>
98
+
99
+ For each branch:
100
+ 1. GitHub → Repository → Settings → Branches → Add branch protection rule
101
+ 2. Branch name: <branch-name>
102
+ 3. Enable: Require status checks to pass before merging
103
+ 4. Search for and select: "Supabase Preview"
104
+ 5. Enable: Require branches to be up to date before merging
105
+ 6. Save changes
106
+
107
+ Full step-by-step: reference/branching-setup.md § 2
108
+ ```
109
+
110
+ AskUserQuestion: "Confirm when the required-status-check rules are saved on GitHub."
111
+
112
+ Set `required_check_enforced = true` in the idempotency tracker.
113
+
114
+ ## Step 5 — Persistent branch creation (CLI or manual)
115
+
116
+ Skip this entire step if `branch_config.integration` is empty OR equals `main`.
117
+
118
+ Skip if `persistent_branch_created` is already true.
119
+
120
+ ### 5a — Detect CLI
121
+
122
+ ```bash
123
+ which supabase 2>/dev/null && supabase --version || echo "CLI_ABSENT"
124
+ ```
125
+
126
+ If `CLI_ABSENT`, skip to manual path (Step 5c).
127
+
128
+ ### 5b — AskUserQuestion before creating the branch
129
+
130
+ ```
131
+ A persistent Supabase branch will be created for: <integration>
132
+ This creates a dedicated Supabase project environment for that branch.
133
+
134
+ Proceed?
135
+ ```
136
+
137
+ On confirm, run the commands below. **If the user declines, fall through to Step 5c
138
+ (manual fallback) — do NOT skip Step 5 entirely.** The user may prefer the dashboard
139
+ even when the CLI is available (e.g., they want to set custom branch options).
140
+
141
+ ```bash
142
+ supabase --experimental branches create --persistent <integration>
143
+ supabase --experimental branches list
144
+ ```
145
+
146
+ Capture the `project_id` from the list output. See [reference/cli-fallback.md](reference/cli-fallback.md)
147
+ for full parsing guidance.
148
+
149
+ ### 5c — Manual fallback (CLI absent or user prefers)
150
+
151
+ Display manual dashboard steps. AskUserQuestion for the `project_id` once the user has
152
+ created the branch and copied the ref from the dashboard.
153
+
154
+ Full fallback walkthrough: [reference/cli-fallback.md](reference/cli-fallback.md)
155
+
156
+ ### 5d — Append `[remotes.<integration>]` block to `supabase/config.toml`
157
+
158
+ ```toml
159
+ [remotes.<integration>]
160
+ project_id = "<returned-project-id>"
161
+ ```
162
+
163
+ Use Edit to append to `supabase/config.toml`. Do NOT overwrite existing content.
164
+
165
+ ## Step 6 — Optional: enable seed config
166
+
167
+ **Skip this entire step if Step 5 was skipped** (`branch_config.integration` empty or
168
+ `= 'main'`, OR `persistent_branch_created` was already true at Step 2 AND the existing
169
+ `[remotes.<integration>]` block already declares its own `db.seed` policy). The seed
170
+ sub-block is only meaningful when this run authored the `[remotes.<integration>]` parent
171
+ above — otherwise opting in here writes a `[remotes.<integration>.db.seed]` block with
172
+ no parent section and produces invalid TOML.
173
+
174
+ Otherwise, AskUserQuestion:
175
+
176
+ ```
177
+ Enable [remotes.<integration>.db.seed] in supabase/config.toml?
178
+
179
+ When enabled, supabase db reset on the branch will run your seed SQL.
180
+ Default: OFF — only enable if the team needs consistent seed data on integration resets.
181
+
182
+ A) Yes — add seed config (enabled = true, sql_paths = ["./seed.sql"])
183
+ B) No — leave seed disabled (default)
184
+ ```
185
+
186
+ If A, append to `supabase/config.toml` under the `[remotes.<integration>]` block:
187
+
188
+ ```toml
189
+ [remotes.<integration>.db.seed]
190
+ enabled = true
191
+ sql_paths = ["./seed.sql"]
192
+ ```
193
+
194
+ Reference: [reference/branching-setup.md § 4](reference/branching-setup.md)
195
+
196
+ ## Step 7 — Write idempotency marker to `.codebyplan.json`
197
+
198
+ Generate the ISO timestamp in the shell first (jq can't produce wall-clock time natively),
199
+ then merge the marker under `shipment.surfaces.supabase.branching_configured`:
200
+
201
+ ```bash
202
+ NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
203
+ jq --arg now "$NOW" '.shipment.surfaces.supabase.branching_configured = {
204
+ enabled_at: $now,
205
+ github_app_installed: true,
206
+ required_check_enforced: true
207
+ }' .codebyplan.json > .codebyplan.json.tmp && mv .codebyplan.json.tmp .codebyplan.json
208
+ ```
209
+
210
+ The three sub-fields:
211
+
212
+ | Field | Value |
213
+ |---|---|
214
+ | `enabled_at` | ISO 8601 timestamp of this run |
215
+ | `github_app_installed` | true — GitHub integration was authorized |
216
+ | `required_check_enforced` | true — required-status-check confirmed on both branches |
217
+
218
+ ## Step 8 — Final status report
219
+
220
+ Emit a per-item done vs already-done table:
221
+
222
+ ```
223
+ ## Supabase Branching Setup — Complete
224
+
225
+ | Step | Status |
226
+ |---|---|
227
+ | GitHub integration (dashboard) | done / already-done |
228
+ | Required status check (GitHub) | done / already-done |
229
+ | Persistent branch (<integration>) | done / already-done / skipped (main) |
230
+ | Seed config | enabled / disabled |
231
+ | Idempotency marker written | done |
232
+
233
+ Ready for /cbp-ship. Every PR will now get an isolated Supabase preview environment.
234
+ ```
235
+
236
+ ## Additional resources
237
+
238
+ - Dashboard walkthrough + GitHub checklist: [reference/branching-setup.md](reference/branching-setup.md)
239
+ - CLI detection + branch parsing + manual fallback: [reference/cli-fallback.md](reference/cli-fallback.md)
@@ -0,0 +1,121 @@
1
+ # Supabase Branching Setup — Full Walkthrough
2
+
3
+ Covers the GitHub integration dashboard steps, GitHub required-status-check configuration,
4
+ and the persistent-branch creation that `/cbp-supabase-setup` automates.
5
+
6
+ ## 1. Dashboard: Enable GitHub Integration
7
+
8
+ Navigate: **Project Settings → Integrations → GitHub**.
9
+
10
+ Steps (one at a time — complete each before the next):
11
+
12
+ 1. Click **Authorize GitHub** and complete the OAuth flow.
13
+ 2. After redirect, select the repository from the dropdown.
14
+ 3. Set **Supabase directory** to `./supabase` (relative path from repo root).
15
+ 4. Enable **Automatic branching** — toggles preview environments per pull request.
16
+ 5. Enable **Supabase changes only** — previews only redeploy when `supabase/` files change,
17
+ not on every commit.
18
+ 6. Enable **Deploy to production** — migrations run against production project on merge to
19
+ the production branch (usually `main`).
20
+ 7. Click **Save** (or **Enable integration**).
21
+
22
+ Verify: the integration tile now shows the connected repository name.
23
+
24
+ ## 2. GitHub Repo: Required Status Check
25
+
26
+ Protect both `main` AND the integration branch (e.g., `development`) so PRs cannot be merged
27
+ until the Supabase Preview environment passes.
28
+
29
+ For each branch (`main`, then the integration branch from `.codebyplan.json`
30
+ `branch_config.integration`):
31
+
32
+ 1. **GitHub → Repository → Settings → Branches → Add branch protection rule**.
33
+ 2. Enter the branch name exactly.
34
+ 3. Enable **Require status checks to pass before merging**.
35
+ 4. In the status check search box, type **Supabase Preview** and select it.
36
+ 5. Enable **Require branches to be up to date before merging** (recommended).
37
+ 6. Click **Save changes**.
38
+
39
+ > If `branch_config.integration === 'main'` or is unset, only add the rule once for `main`.
40
+
41
+ ## 3. Persistent Branch (integration branch only)
42
+
43
+ A persistent branch creates a long-lived Supabase environment for the integration branch,
44
+ separate from ephemeral PR previews. Only needed when `branch_config.integration` is set and
45
+ differs from `main`.
46
+
47
+ ### Via CLI (preferred when available)
48
+
49
+ ```bash
50
+ supabase --experimental branches create --persistent development
51
+ # Replace 'development' with your actual integration branch name
52
+
53
+ supabase --experimental branches list
54
+ # Locate the row for 'development'; copy the project_id (8-char ref)
55
+ ```
56
+
57
+ ### Append to `supabase/config.toml`
58
+
59
+ Use the `project_id` returned from `branches list`:
60
+
61
+ ```toml
62
+ [remotes.development]
63
+ project_id = "<returned-8-char-ref>"
64
+
65
+ # Optional: enable seed on branch reset
66
+ # [remotes.development.db.seed]
67
+ # enabled = true
68
+ # sql_paths = ["./seed.sql"]
69
+ ```
70
+
71
+ Replace `development` with the actual integration branch name if different.
72
+
73
+ ### Manual fallback (when CLI unavailable)
74
+
75
+ Navigate: **Supabase Dashboard → Project → Branches** (left sidebar).
76
+ Click **Create branch** → enter branch name → select **Persistent** → confirm.
77
+ Copy the project ref from the branch row and paste into `config.toml` as above.
78
+
79
+ See [cli-fallback.md](cli-fallback.md) for full CLI detection and parsing steps.
80
+
81
+ ## 4. Optional: Seed Config
82
+
83
+ When a seed file exists and should run on branch database reset:
84
+
85
+ ```toml
86
+ [remotes.development.db.seed]
87
+ enabled = true
88
+ sql_paths = ["./seed.sql"]
89
+ ```
90
+
91
+ Default is **OFF**. Enable only when the team needs consistent seed data on integration
92
+ branch resets. Seed runs happen on `supabase db reset` against the branch — not on every
93
+ migration push.
94
+
95
+ ## 5. Idempotency Marker
96
+
97
+ After setup completes, `/cbp-supabase-setup` writes to `.codebyplan.json`:
98
+
99
+ ```json
100
+ {
101
+ "shipment": {
102
+ "surfaces": {
103
+ "supabase": {
104
+ "branching_configured": {
105
+ "enabled_at": "2026-05-20T10:00:00Z",
106
+ "github_app_installed": true,
107
+ "required_check_enforced": true
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ Fields:
116
+ - `enabled_at` — ISO timestamp when setup completed
117
+ - `github_app_installed` — true when the GitHub integration was authorized and saved
118
+ - `required_check_enforced` — true when the user confirms the required-status-check rule
119
+ is in place on both branches
120
+
121
+ On re-run, the skill reads this marker and skips any step already marked complete.
@@ -0,0 +1,109 @@
1
+ # CLI Detection and Fallback — Supabase Branching
2
+
3
+ Used by `/cbp-supabase-setup` Step 5 when creating a persistent branch for the integration
4
+ environment. Covers CLI detection, branch creation, project_id parsing, and the manual
5
+ dashboard fallback when the CLI is unavailable.
6
+
7
+ ## 1. Detect CLI Availability
8
+
9
+ ```bash
10
+ which supabase 2>/dev/null && supabase --version
11
+ ```
12
+
13
+ - **Exit 0 + version line** → CLI available, proceed with CLI path below.
14
+ - **Exit non-zero / no output** → CLI absent; show install hint and use Manual path.
15
+
16
+ Install hint (if absent):
17
+ ```
18
+ Supabase CLI not found. Install options:
19
+ brew install supabase/tap/supabase (macOS / Homebrew)
20
+ npm install -g supabase (npm global)
21
+ scoop install supabase (Windows Scoop)
22
+ https://supabase.com/docs/guides/local-development/cli/getting-started
23
+ ```
24
+
25
+ ## 2. CLI Path — Create Persistent Branch
26
+
27
+ ```bash
28
+ # Replace <integration> with branch_config.integration value (e.g., 'development')
29
+ supabase --experimental branches create --persistent <integration>
30
+ ```
31
+
32
+ Expected output (example):
33
+ ```
34
+ Created branch: development
35
+ Branch ID: abc12345
36
+ Project ref: xyzwabcd
37
+ ```
38
+
39
+ Then list to confirm and retrieve the project ref:
40
+
41
+ ```bash
42
+ supabase --experimental branches list
43
+ ```
44
+
45
+ Expected output (table form):
46
+ ```
47
+ ID NAME STATUS CREATED AT
48
+ abc12345 development active 2026-05-20T10:00:00Z
49
+ project_ref xyzwabcd
50
+ ```
51
+
52
+ ### Parsing the project_id
53
+
54
+ The `project_ref` / `project_id` value is the 8+ char identifier for the branch environment.
55
+ Locate it in the `branches list` output:
56
+
57
+ - **Table output**: look for the column labeled `project_ref` or the ref shown adjacent to the
58
+ branch name.
59
+ - **JSON output** (if `--output json` is supported): `jq '.[].project_ref'`
60
+
61
+ ```bash
62
+ # Attempt JSON parse; fall back to table scan
63
+ supabase --experimental branches list --output json 2>/dev/null \
64
+ | jq -r '.[] | select(.name=="<integration>") | .project_ref' \
65
+ || echo "Parse table output manually — see column 'project_ref' or 'ID'"
66
+ ```
67
+
68
+ Use the returned value as the `project_id` in `supabase/config.toml`.
69
+
70
+ ## 3. Append to `supabase/config.toml`
71
+
72
+ After obtaining the `project_id`:
73
+
74
+ ```toml
75
+ [remotes.<integration>]
76
+ project_id = "<project_id_from_branches_list>"
77
+ ```
78
+
79
+ Example for integration branch `development`:
80
+
81
+ ```toml
82
+ [remotes.development]
83
+ project_id = "xyzwabcd"
84
+ ```
85
+
86
+ ## 4. Manual Dashboard Fallback (no CLI)
87
+
88
+ When the Supabase CLI is unavailable or `--experimental` branches are not yet enabled in
89
+ the installed version:
90
+
91
+ 1. Open the Supabase Dashboard: **https://supabase.com/dashboard**
92
+ 2. Select the target project.
93
+ 3. In the left sidebar, click **Branches** (under the database section).
94
+ 4. Click **Create branch**.
95
+ 5. Enter the branch name exactly as it appears in `branch_config.integration`
96
+ (e.g., `development`).
97
+ 6. Select **Persistent** (not ephemeral/PR-scoped).
98
+ 7. Click **Create** and wait for provisioning.
99
+ 8. From the branch row in the list, copy the **Project ref** (8-char string).
100
+ 9. Paste into `supabase/config.toml` under `[remotes.<name>]` as shown in Section 3.
101
+
102
+ ## 5. Verify Branch is Live
103
+
104
+ ```bash
105
+ supabase --experimental branches list
106
+ # Expect the integration branch in the list with status 'active'
107
+
108
+ # OR via dashboard: Branches section shows the branch with a green status indicator
109
+ ```
@@ -0,0 +1,166 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-task-check
4
+ description: AI production review for the current task
5
+ argument-hint: [chk-task | task]
6
+ triggers: [cbp-task-testing, cbp-round-input]
7
+ effort: high
8
+ ---
9
+
10
+ # Task Check Command
11
+
12
+ AI-driven production readiness review. Spawns the `cbp-task-check` agent for thorough verification including user satisfaction discussion. This command is a thin orchestrator — the agent does the heavy lifting.
13
+
14
+ ## Inline-Fallback for Spawn Failure
15
+
16
+ If the `cbp-task-check` agent spawn fails for any reason (`API Error: Extra usage required`, monthly Agent usage cap, provider 5xx, rate limit, context overflow), the orchestrator MUST follow the canonical inline-fallback procedure documented in `skills/cbp-round-end/SKILL.md` "Inline-fallback for any spawn failure".
17
+
18
+ Procedure summary (pointer back to canonical):
19
+
20
+ 1. Detect the failure class from the error string; record `round.context.task_check_findings.spawn_failure = { class, error_message, decided_at }`.
21
+ 2. Walk the agent's documented Phase 1-10 checklist inline using `Read` / `Grep` / `Bash` / MCP `get_*` tools — the agent's AGENT.md is the inline script.
22
+ 3. Populate the agent's output contract (`verdict`, `route_recommendation`, `requirements_status`, `qa_status`, `code_review_findings`, `user_satisfaction`, `scope_divergence_detected`, etc.) with `mode: 'inline_fallback'` so analytics distinguishes.
23
+ 4. Apply the pre-emptive-skip rule: when the same failure class fired in the previous skill of this session, skip the spawn attempt entirely and go straight to inline.
24
+ 5. Continue the skill — do NOT abort. Inline-fallback is intended to keep the pipeline moving under sustained outages.
25
+
26
+ Inline-fallback is NOT a quality downgrade trapdoor — every Phase from the AGENT.md MUST be walked, in order, with the same Read/Grep depth the agent would have used. Skipping phases under the banner of fallback is a separate failure mode that `cbp-improve-claude` flags as `inline_fallback_shortcutting`.
27
+
28
+ ## When Used
29
+
30
+ - After all rounds complete and all files approved (auto-triggered by `/cbp-round-update`)
31
+ - Before `/cbp-task-testing`
32
+ - `/cbp-task-check` is NEVER skippable
33
+
34
+ ## Instructions
35
+
36
+ ### Step 1: Parse `$ARGUMENTS`
37
+
38
+ Parse the argument using the canonical chk-task-round notation (see `.claude/rules/notation-consistency.md`):
39
+
40
+ | Shape | Regex | Resolves to |
41
+ |-------|-------|-------------|
42
+ | `{chk}-{task}` (e.g. `108-1`) | `^[0-9]+-[0-9]+$` | Checkpoint-bound: CHK-{chk} TASK-{task} |
43
+ | `{task}` (e.g. `45`) | `^[0-9]+$` | Standalone: standalone TASK-{task} **only** |
44
+ | _(empty)_ | — | Use MCP `get_current_task` to find the active in-progress task |
45
+
46
+ Anything else is malformed — surface this error and stop:
47
+
48
+ ```
49
+ task-check: invalid argument `{value}`. Expected:
50
+ 108-1 → CHK-108 TASK-1 (checkpoint-bound)
51
+ 45 → standalone TASK-45
52
+ (empty) → active in-progress task
53
+
54
+ For a specific round, use `/cbp-round-update 108-1-2`.
55
+ ```
56
+
57
+ Error cases: `108-1-2` (that is round-update's shape), `abc`, `108-`, `-1`, `108--1`, anything with whitespace or non-numeric characters.
58
+
59
+ #### Worked examples
60
+
61
+ - `task-check 108-1` → CHK-108 TASK-1
62
+ - `task-check 45` → standalone TASK-45
63
+ - `task-check` (no arg) → active in-progress task via `get_current_task`
64
+ - `task-check 108-1-2` → error: "use `/cbp-round-update 108-1-2`"
65
+ - `task-check abc` → error: malformed
66
+
67
+ ### Step 1.5: Get Current Task
68
+
69
+ Given the parse from Step 1:
70
+
71
+ | Parse | Resolution path |
72
+ |-------|-----------------|
73
+ | `{chk}-{task}` | MCP `get_checkpoints(repo_id)` → filter `number === {chk}`. MCP `get_tasks(checkpoint_id)` → filter `number === {task}`. |
74
+ | `{task}` | MCP `get_tasks(repo_id, standalone: true)` → filter `number === {task}`. |
75
+ | _(empty)_ | MCP `get_current_task(repo_id)` — finds the active in-progress task. |
76
+
77
+ If no in-progress task, show error and stop.
78
+
79
+ ### Step 2: Quick Gate — Verify All Rounds Complete
80
+
81
+ Use MCP `get_rounds` for the task. Verify all rounds are `completed`.
82
+
83
+ If any rounds still in_progress:
84
+
85
+ ```
86
+ ## Cannot Run Task Check
87
+
88
+ TASK-[N] has an active round (Round [N]). Complete it first:
89
+ - Run `/cbp-round-update` to finish the round
90
+ ```
91
+
92
+ Stop here.
93
+
94
+ ### Step 3: Load All Context
95
+
96
+ 1. Get checkpoint details (id, title, goal, context)
97
+ 2. Get task details (id, title, requirements, context, files_changed, qa)
98
+ 3. Get all rounds via MCP `get_rounds` (number, requirements, context, qa, files_changed)
99
+
100
+ ### Step 4: Spawn Task Check Agent
101
+
102
+ Spawn `cbp-task-check` agent with full context:
103
+
104
+ ```yaml
105
+ input:
106
+ task_number: [N]
107
+ round_number: [total rounds]
108
+ checkpoint: { id, title, goal, context }
109
+ task: { id, title, requirements, context, files_changed, qa }
110
+ rounds: [{ number, requirements, context, qa, files_changed }]
111
+ ```
112
+
113
+ Wait for agent to complete. Agent handles all 10 phases including user satisfaction discussion.
114
+
115
+ ### Step 5: Save Agent Output
116
+
117
+ Save agent output to task context via MCP `update_task`:
118
+
119
+ - `task.context.check_verdict` = agent output (verdict, requirements_check, etc.)
120
+
121
+ ### Step 6: Route Based on Verdict
122
+
123
+ **READY + satisfied:**
124
+
125
+ **Next**: Run `/clear`, then `/cbp-task-testing {chk-task}` to run comprehensive task-level testing.
126
+
127
+ **NOT READY — fixable issues:**
128
+
129
+ ```
130
+ Issues found that need addressing:
131
+ - [issue 1]
132
+ - [issue 2]
133
+ ```
134
+
135
+ Suggest: `/cbp-round-input` with specific issues. **STOP HERE** — wait for user.
136
+
137
+ **NOT READY — needs new task:**
138
+
139
+ ```
140
+ Scope issues identified that require a new task:
141
+ - [scope issue]
142
+ ```
143
+
144
+ Suggest: `/cbp-task-create`. **STOP HERE** — wait for user.
145
+
146
+ **NOT READY — approvals missing:**
147
+
148
+ ```
149
+ Code review passed but [N] files need user approval.
150
+ ```
151
+
152
+ Suggest: Approve files, then re-run `/cbp-task-check`. **STOP HERE** — wait for user.
153
+
154
+ ## Key Rules
155
+
156
+ - **`/cbp-task-check` is NEVER skippable** — mandatory before `/cbp-task-testing`
157
+ - **This is AI review + user satisfaction** — not automated testing
158
+ - **Read all changed files** — agent does the heavy lifting
159
+ - **No file changes** — review only, never edit
160
+
161
+ ## Integration
162
+
163
+ - **Reads**: MCP `get_current_task`, `get_rounds`, all changed files (via agent)
164
+ - **Writes**: MCP `update_task` (context.check_verdict)
165
+ - **Triggers**: emits directive `Next: /clear, then /cbp-task-testing {chk-task}` on READY + satisfied (cross-context — testing is heavyweight, fresh context helps)
166
+ - **Triggered by**: `/cbp-round-update` (auto, when all files approved)