codebyplan 1.5.0 → 1.8.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 (206) hide show
  1. package/README.md +48 -5
  2. package/dist/cli.js +4578 -2709
  3. package/package.json +5 -1
  4. package/templates/.gitkeep +0 -0
  5. package/templates/README.md +20 -0
  6. package/templates/agents/cbp-cc-executor.md +213 -0
  7. package/templates/agents/cbp-database-agent.md +229 -0
  8. package/templates/agents/cbp-improve-claude.md +245 -0
  9. package/templates/agents/cbp-improve-round.md +284 -0
  10. package/templates/agents/cbp-mechanical-edits.md +111 -0
  11. package/templates/agents/cbp-research.md +282 -0
  12. package/templates/agents/cbp-round-executor.md +604 -0
  13. package/templates/agents/cbp-security-agent.md +134 -0
  14. package/templates/agents/cbp-task-check.md +213 -0
  15. package/templates/agents/cbp-task-planner.md +582 -0
  16. package/templates/agents/cbp-test-e2e-agent.md +363 -0
  17. package/templates/agents/cbp-testing-qa-agent.md +400 -0
  18. package/templates/context/mcp-docs.md +139 -0
  19. package/templates/hooks/README.md +236 -0
  20. package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
  21. package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
  22. package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
  23. package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
  24. package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
  25. package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
  26. package/templates/hooks/cbp-notify.sh +68 -0
  27. package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
  28. package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
  29. package/templates/hooks/cbp-statusline.sh +347 -0
  30. package/templates/hooks/cbp-subagent-statusline.sh +182 -0
  31. package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
  32. package/templates/hooks/cbp-test-hooks.sh +320 -0
  33. package/templates/hooks/hooks.json +85 -0
  34. package/templates/hooks/validate-context-usage.sh +59 -0
  35. package/templates/hooks/validate-git-commit.sh +78 -0
  36. package/templates/hooks/validate-git-stash-deny.sh +32 -0
  37. package/templates/hooks/validate-structure-lengths.sh +57 -0
  38. package/templates/hooks/validate-structure-lib.sh +104 -0
  39. package/templates/hooks/validate-structure-patterns.sh +54 -0
  40. package/templates/hooks/validate-structure-scope.sh +33 -0
  41. package/templates/hooks/validate-structure-smoke.sh +95 -0
  42. package/templates/hooks/validate-structure-templates.sh +34 -0
  43. package/templates/hooks/validate-structure.sh +69 -0
  44. package/templates/rules/.gitkeep +0 -0
  45. package/templates/rules/README.md +47 -0
  46. package/templates/rules/context-file-loading.md +52 -0
  47. package/templates/rules/scope-vocabulary.md +64 -0
  48. package/templates/rules/todo-backend.md +109 -0
  49. package/templates/settings.project.base.json +55 -0
  50. package/templates/settings.user.base.json +25 -0
  51. package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
  52. package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
  53. package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
  54. package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
  55. package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
  56. package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
  57. package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
  58. package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
  59. package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
  60. package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
  61. package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
  62. package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
  63. package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
  64. package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
  65. package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
  66. package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
  67. package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
  68. package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
  69. package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
  70. package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
  71. package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
  72. package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
  73. package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
  74. package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
  75. package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
  76. package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
  77. package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
  78. package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
  79. package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
  80. package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
  81. package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
  82. package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
  83. package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
  84. package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
  85. package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
  86. package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
  87. package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
  88. package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
  89. package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
  90. package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
  91. package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
  92. package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
  93. package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
  94. package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
  95. package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
  96. package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
  97. package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
  98. package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
  99. package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
  100. package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
  101. package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
  102. package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
  103. package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
  104. package/templates/skills/cbp-checkpoint-create/SKILL.md +287 -0
  105. package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
  106. package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
  107. package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
  108. package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
  109. package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
  110. package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
  111. package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
  112. package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
  113. package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
  114. package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
  115. package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
  116. package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
  117. package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
  118. package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
  119. package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
  120. package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
  121. package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
  122. package/templates/skills/cbp-git-commit/SKILL.md +278 -0
  123. package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
  124. package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
  125. package/templates/skills/cbp-merge-main/SKILL.md +228 -0
  126. package/templates/skills/cbp-round-check/SKILL.md +104 -0
  127. package/templates/skills/cbp-round-end/SKILL.md +183 -0
  128. package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
  129. package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
  130. package/templates/skills/cbp-round-execute/SKILL.md +211 -0
  131. package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
  132. package/templates/skills/cbp-round-input/SKILL.md +165 -0
  133. package/templates/skills/cbp-round-start/SKILL.md +222 -0
  134. package/templates/skills/cbp-round-update/SKILL.md +163 -0
  135. package/templates/skills/cbp-session-end/SKILL.md +187 -0
  136. package/templates/skills/cbp-session-start/SKILL.md +155 -0
  137. package/templates/skills/cbp-ship/SKILL.md +332 -0
  138. package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
  139. package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
  140. package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
  141. package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
  142. package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
  143. package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
  144. package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
  145. package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
  146. package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
  147. package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
  148. package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
  149. package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
  150. package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
  151. package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
  152. package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
  153. package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
  154. package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
  155. package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
  156. package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
  157. package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
  158. package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
  159. package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
  160. package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
  161. package/templates/skills/cbp-ship/reference/versioning.md +116 -0
  162. package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
  163. package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
  164. package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
  165. package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
  166. package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
  167. package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
  168. package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
  169. package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
  170. package/templates/skills/cbp-ship/templates/eas.json +66 -0
  171. package/templates/skills/cbp-ship/templates/railway.toml +15 -0
  172. package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
  173. package/templates/skills/cbp-ship/templates/vercel.json +19 -0
  174. package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
  175. package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
  176. package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
  177. package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
  178. package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
  179. package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
  180. package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
  181. package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
  182. package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
  183. package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
  184. package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
  185. package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
  186. package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
  187. package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
  188. package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
  189. package/templates/skills/cbp-ship-main/SKILL.md +65 -0
  190. package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
  191. package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
  192. package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
  193. package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
  194. package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
  195. package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
  196. package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
  197. package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
  198. package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
  199. package/templates/skills/cbp-task-check/SKILL.md +166 -0
  200. package/templates/skills/cbp-task-complete/SKILL.md +206 -0
  201. package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
  202. package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
  203. package/templates/skills/cbp-task-create/SKILL.md +167 -0
  204. package/templates/skills/cbp-task-start/SKILL.md +239 -0
  205. package/templates/skills/cbp-task-testing/SKILL.md +277 -0
  206. package/templates/skills/cbp-todo/SKILL.md +97 -0
@@ -0,0 +1,199 @@
1
+ # Configure: railway-backend
2
+
3
+ Walkthrough for first-time Railway backend setup.
4
+
5
+ Railway is the standard backend platform for the CBP family. This walkthrough covers the typical pattern: NestJS / Node service with optional Postgres / Redis Railway add-ons.
6
+
7
+ ## Prerequisites
8
+
9
+ - Railway account (free trial; pay-as-you-go after $5 credit) — https://railway.app
10
+ - Backend service code with a `Dockerfile` OR `package.json` with a `start` script
11
+ - Health endpoint in your service code (e.g., `/health` returning 200) — recommended
12
+
13
+ ## Probe
14
+
15
+ ```bash
16
+ which railway || { echo "Install: brew install railway OR npm i -g @railway/cli"; exit 1; }
17
+ railway --version
18
+ railway whoami || { echo "Run: railway login"; exit 1; }
19
+ ```
20
+
21
+ ## Setup walkthrough
22
+
23
+ ### Step 1/8: Create or pick a Railway project
24
+
25
+ ```bash
26
+ cd "$BACKEND_PATH"
27
+ railway init
28
+ ```
29
+
30
+ Choose:
31
+ - **New project** — name it after the repo
32
+ - **Existing project** — pick from list
33
+
34
+ This creates `.railway/config.json` linking the local dir to the Railway project.
35
+
36
+ ### Step 2/8: Add a service (if new project)
37
+
38
+ ```bash
39
+ railway add
40
+ ```
41
+
42
+ Pick:
43
+ - **Service** — empty service for your code (the typical case)
44
+ - **Database** — Postgres / Redis / MySQL add-on (only if you don't use Supabase)
45
+
46
+ For CBP repos using Supabase, you typically only need a service (no Railway DB add-on).
47
+
48
+ ### Step 3/8: Link the GH repo (auto-deploy mode)
49
+
50
+ ```bash
51
+ railway service connect
52
+ # Pick GitHub → authorize → choose repo → choose branch
53
+ ```
54
+
55
+ Set the deploy branch to your PRODUCTION branch (per `.codebyplan/git.json` `branch_config.production`):
56
+
57
+ ```
58
+ Settings → Source → Branch: main
59
+ Settings → Source → Path: apps/backend (if monorepo)
60
+ ```
61
+
62
+ If you don't want auto-deploy (e.g., to ship deliberately via `railway up`), skip this step.
63
+
64
+ ### Step 4/8: Configure build mode
65
+
66
+ Railway supports two build modes — pick based on your service:
67
+
68
+ #### Dockerfile (recommended for NestJS)
69
+
70
+ If `apps/backend/Dockerfile` exists, Railway uses it automatically. Verify:
71
+
72
+ ```
73
+ Settings → Source → Builder: Dockerfile
74
+ Settings → Source → Dockerfile Path: apps/backend/Dockerfile
75
+ ```
76
+
77
+ #### Nixpacks (auto-detect)
78
+
79
+ If no Dockerfile, Railway auto-detects via Nixpacks. For Node:
80
+
81
+ ```
82
+ Settings → Source → Builder: Nixpacks
83
+ ```
84
+
85
+ Set the start command if non-standard:
86
+
87
+ ```
88
+ Settings → Deploy → Start Command: pnpm start
89
+ ```
90
+
91
+ ### Step 5/8: Set environment variables
92
+
93
+ ```bash
94
+ # Read from .env.example for the keys
95
+ KEYS=$(grep -E '^[A-Z_]+=' "$BACKEND_PATH/.env.example" | cut -d= -f1)
96
+ for KEY in $KEYS; do
97
+ echo "Set $KEY:"
98
+ echo " railway variables --set $KEY=<value> --service <service-name>"
99
+ done
100
+ ```
101
+
102
+ Set each via CLI or Railway dashboard. Railway auto-injects `PORT` — your service must bind to `process.env.PORT`.
103
+
104
+ For Supabase integration, set:
105
+
106
+ ```bash
107
+ railway variables --set SUPABASE_URL=https://...
108
+ railway variables --set SUPABASE_SERVICE_ROLE_KEY=...
109
+ railway variables --set DATABASE_URL=postgresql://... # use Supabase pooler URL for Railway
110
+ ```
111
+
112
+ ### Step 6/8: Add a health endpoint (if missing)
113
+
114
+ If your service doesn't have a `/health` endpoint, add one:
115
+
116
+ ```typescript
117
+ // NestJS example
118
+ @Get('/health')
119
+ health() { return { status: 'ok', uptime: process.uptime() }; }
120
+ ```
121
+
122
+ Configure Railway to use it:
123
+
124
+ ```
125
+ Settings → Deploy → Healthcheck Path: /health
126
+ Settings → Deploy → Healthcheck Timeout: 30s
127
+ ```
128
+
129
+ Without a health endpoint, Railway considers any 2xx on `/` as healthy — fragile.
130
+
131
+ ### Step 7/8: Custom domain (optional)
132
+
133
+ If you have a domain:
134
+
135
+ ```bash
136
+ railway domain
137
+ # Pick: Custom domain → enter domain
138
+ # Update DNS: CNAME <your-domain> → <railway-domain>
139
+ ```
140
+
141
+ ### Step 8/8: Persist + verify
142
+
143
+ ```json
144
+ {
145
+ "surfaces": {
146
+ "railway-backend": {
147
+ "configured_at": "<now>",
148
+ "platform": "railway",
149
+ "app_path": "apps/backend",
150
+ "project_id": "<from .railway/config.json>",
151
+ "service_id": "<from railway service --json>",
152
+ "environment_id": "<usually 'production'>",
153
+ "auto_deploy": true,
154
+ "production_branch": "main",
155
+ "url": "https://your-app.railway.app"
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ Verify:
162
+
163
+ ```bash
164
+ PROJECT_ID=$(jq -r '.surfaces."railway-backend".project_id' .codebyplan/shipment.json)
165
+ railway status --json | jq
166
+ # Expect: project + service info matching saved IDs
167
+ ```
168
+
169
+ Test deploy:
170
+
171
+ ```bash
172
+ railway up --detach
173
+ # Wait, then verify URL responds
174
+ URL=$(jq -r '.surfaces."railway-backend".url' .codebyplan/shipment.json)
175
+ curl -sI "$URL/health" | head -1
176
+ ```
177
+
178
+ ## Done
179
+
180
+ Surface is ready. `/cbp-ship` will deploy the backend at checkpoint end.
181
+
182
+ ## Common setup issues
183
+
184
+ | Symptom | Fix |
185
+ |---|---|
186
+ | Build fails "no such file or directory: apps/backend/Dockerfile" | Set `Dockerfile Path` correctly in Railway settings; or move Dockerfile |
187
+ | Service starts but health check fails | Healthcheck path wrong, or service is binding to hardcoded port instead of `$PORT` |
188
+ | GH webhook doesn't fire on push | Disconnect+reconnect Source in Railway dashboard |
189
+ | `railway variables` says "no service" | Pass `--service <name>`, or `cd` into the linked dir |
190
+ | Deploy succeeds, app crashes immediately | Most common: missing env var; check `railway logs` |
191
+
192
+ ## Switching from another platform
193
+
194
+ If migrating from Vercel functions / Render / Fly:
195
+
196
+ 1. Configure Railway as above
197
+ 2. Update DNS to point at Railway domain
198
+ 3. Add the old platform's URL to a redirect path during transition
199
+ 4. Once Railway is verified healthy, decommission the old platform
@@ -0,0 +1,200 @@
1
+ # Configure: supabase
2
+
3
+ Walkthrough for first-time Supabase migration push setup.
4
+
5
+ ## Prerequisites
6
+
7
+ - Supabase account (free tier OK for starter projects) — https://supabase.com
8
+ - Supabase project already created in the dashboard
9
+ - For monorepo: decide migration directory (`supabase/migrations/` at repo root, or per-app)
10
+
11
+ ## Probe
12
+
13
+ ```bash
14
+ which supabase || { echo "Install: brew install supabase/tap/supabase"; exit 1; }
15
+ supabase --version
16
+ supabase projects list 2>&1 | head -3 || { echo "Run: supabase login"; exit 1; }
17
+ ```
18
+
19
+ ## Setup walkthrough
20
+
21
+ ### Step 1/7: Initialize Supabase locally (if not already)
22
+
23
+ ```bash
24
+ test -d supabase || supabase init
25
+ ```
26
+
27
+ Creates `supabase/config.toml`, `supabase/migrations/`, `supabase/functions/`.
28
+
29
+ ### Step 2/7: Link to remote project
30
+
31
+ ```bash
32
+ supabase login
33
+ # Open browser, authorize CLI
34
+
35
+ supabase projects list
36
+ # Pick your project ref (8-char string)
37
+
38
+ supabase link --project-ref <your-project-ref>
39
+ ```
40
+
41
+ This sets up `supabase/config.toml` with the project ref.
42
+
43
+ ### Step 3/7: Pull existing schema as baseline (if remote has data)
44
+
45
+ If the remote Supabase project already has tables/data (created via dashboard), generate a baseline migration so local and remote agree:
46
+
47
+ ```bash
48
+ supabase db dump --data-only=false --schema public,auth -f supabase/migrations/00000000000000_baseline.sql
49
+ ```
50
+
51
+ Stage + commit this. Future migrations build on top of the baseline.
52
+
53
+ If remote is empty (fresh project), skip this step — your migrations are the schema.
54
+
55
+ ### Step 4/7: Configure exposed schemas
56
+
57
+ In `supabase/config.toml`:
58
+
59
+ ```toml
60
+ [api]
61
+ enabled = true
62
+ port = 54321
63
+ schemas = ["public", "graphql_public"] # add custom schemas here
64
+ extra_search_path = ["public", "extensions"]
65
+ max_rows = 1000
66
+
67
+ [db]
68
+ port = 54322
69
+ shadow_port = 54320
70
+ major_version = 15
71
+
72
+ [storage]
73
+ enabled = true
74
+ file_size_limit = "50MiB"
75
+ ```
76
+
77
+ ### Step 5/7: Configure types path (if using TypeScript)
78
+
79
+ If your codebase imports types from `@supabase/supabase-js`, generate the types file:
80
+
81
+ ```bash
82
+ supabase gen types typescript --project-id <ref> > packages/supabase/types.ts
83
+ # OR for monorepo with web app:
84
+ supabase gen types typescript --project-id <ref> > apps/web/types/database.types.ts
85
+ ```
86
+
87
+ Decide where types live and persist that path.
88
+
89
+ ### Step 6/7: Optional — auto-regenerate types on migration push
90
+
91
+ `/cbp-ship` can auto-regen types after migration push if the path is configured. Set up:
92
+
93
+ ```json
94
+ {
95
+ "surfaces": {
96
+ "supabase": {
97
+ "configured_at": "<now>",
98
+ "project_ref": "<ref>",
99
+ "types_path": "packages/supabase/types.ts",
100
+ "auto_regenerate_types": true,
101
+ "exposed_schemas": ["public", "graphql_public"],
102
+ "last_shipped_migration_version": ""
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ When `auto_regenerate_types: true`, the surface deploy step regenerates types after a successful push and surfaces the diff. The user commits the types diff before completing the checkpoint.
109
+
110
+ ### Step 7/7: Verify
111
+
112
+ ```bash
113
+ supabase migration list --linked
114
+ # Should show all local migrations + remote application status
115
+
116
+ supabase db diff --use-migra
117
+ # Should show NO diff (local migrations match remote)
118
+ ```
119
+
120
+ If `db diff` shows differences, you have drift — resolve before first shipment:
121
+
122
+ ```bash
123
+ # Capture remote drift into a migration:
124
+ supabase db diff --use-migra -f resolve_drift
125
+ # Review, edit, commit
126
+ ```
127
+
128
+ ## Done
129
+
130
+ Surface is ready. `/cbp-ship` will offer to push pending migrations at checkpoint end.
131
+
132
+ ## Common setup issues
133
+
134
+ | Symptom | Fix |
135
+ |---|---|
136
+ | `supabase link` fails "project not found" | Wrong ref; copy from dashboard URL `https://supabase.com/dashboard/project/<REF>` |
137
+ | `db dump` is huge | Schema-only is fine; `--data-only=false` gets just schema |
138
+ | Types regen output is empty | Project has no exposed schemas; check `config.toml` `api.schemas` |
139
+ | Migration push fails on RLS policy | Migration references a role/table that doesn't exist yet; fix migration order |
140
+ | `pnpm install` fails after type regen | Types file has invalid TS syntax (rare CLI bug); regenerate, or hand-fix the offending block |
141
+
142
+ ## Per-environment shipment (future)
143
+
144
+ Currently this surface only ships to the `linked` project (production). Multi-environment shipment (preview / staging Supabase projects) is planned — for now, use Supabase branches in the dashboard for dev/preview.
145
+
146
+ ## Supabase Branching Setup
147
+
148
+ After standard configure completes, `/cbp-ship-configure` checks for the GitHub branching
149
+ integration and delegates to `/cbp-supabase-setup` when unset.
150
+
151
+ ### Dashboard checklist (abbreviated)
152
+
153
+ 1. **Project Settings → Integrations → GitHub** — Authorize GitHub, select repo,
154
+ set directory `./supabase`, enable Automatic branching + Supabase changes only +
155
+ Deploy to production.
156
+ 2. **GitHub → repo Settings → Branches** — add required-status-check rule for `main`
157
+ (and for `branch_config.integration` when different from `main`); select
158
+ **Supabase Preview** as the required check.
159
+
160
+ Full walkthrough: `cbp-supabase-setup/reference/branching-setup.md`.
161
+
162
+ ### Persistent branch (`[remotes.<name>]` in `supabase/config.toml`)
163
+
164
+ Only needed when `branch_config.integration` is set and differs from `main`.
165
+
166
+ ```toml
167
+ [remotes.development]
168
+ project_id = "xyzwabcd" # 8-char ref from `supabase --experimental branches list`
169
+
170
+ # Optional seed on branch reset (default OFF):
171
+ # [remotes.development.db.seed]
172
+ # enabled = true
173
+ # sql_paths = ["./seed.sql"]
174
+ ```
175
+
176
+ Replace `development` and `xyzwabcd` with the actual integration branch name and project
177
+ ref for this repo (confirmed in `.codebyplan.json` `branch_config.integration`).
178
+
179
+ ### Idempotency marker
180
+
181
+ Written to `.codebyplan.json` after setup completes:
182
+
183
+ ```json
184
+ {
185
+ "shipment": {
186
+ "surfaces": {
187
+ "supabase": {
188
+ "branching_configured": {
189
+ "enabled_at": "2026-05-20T10:00:00Z",
190
+ "github_app_installed": true,
191
+ "required_check_enforced": true
192
+ }
193
+ }
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ Re-running `/cbp-ship-configure --surface=supabase` reads this marker and skips steps
200
+ already completed. Re-running `/cbp-supabase-setup` directly also respects it.
@@ -0,0 +1,181 @@
1
+ # Configure: tauri-desktop
2
+
3
+ Walkthrough for first-time Tauri desktop release pipeline setup.
4
+
5
+ This walkthrough sets up a complete Tauri desktop release pipeline (signing, notarization, GitHub Actions tag-trigger) step by step.
6
+
7
+ ## Prerequisites
8
+
9
+ - Apple Developer Program enrollment (for macOS signing/notarization)
10
+ - (Optional) Windows code signing certificate
11
+ - (Optional) Linux: no signing prereq, only AppImage
12
+ - Tauri 2.x app already scaffolded in `src-tauri/`
13
+
14
+ ## Probe
15
+
16
+ ```bash
17
+ test -f src-tauri/tauri.conf.json || { echo "No Tauri app detected"; exit 1; }
18
+ which gh || { echo "Install gh CLI: brew install gh"; exit 1; }
19
+ gh auth status || { echo "Run: gh auth login"; exit 1; }
20
+ which jq
21
+ ```
22
+
23
+ ## Setup walkthrough
24
+
25
+ ### Step 1/7: Generate Tauri updater signing key
26
+
27
+ ```bash
28
+ mkdir -p ~/.tauri
29
+ APP_SLUG=$(jq -r .productName src-tauri/tauri.conf.json | tr '[:upper:] ' '[:lower:]-')
30
+ npx tauri signer generate -w ~/.tauri/${APP_SLUG}.key
31
+ ```
32
+
33
+ Set a passphrase when prompted. **Save the passphrase** — you'll add it as a GH secret.
34
+
35
+ The command outputs a `pubkey` value. Add it to `src-tauri/tauri.conf.json`:
36
+
37
+ ```json
38
+ {
39
+ "tauri": {
40
+ "bundle": {
41
+ "updater": {
42
+ "active": true,
43
+ "endpoints": ["https://your-blob-host/latest.json"],
44
+ "pubkey": "<paste here>"
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ ### Step 2/7: Apple Developer ID Application certificate
52
+
53
+ If you don't have one yet:
54
+
55
+ ```
56
+ 1. Go to https://developer.apple.com/account/resources/certificates/add
57
+ 2. Choose 'Developer ID Application'
58
+ 3. Generate CSR via Keychain Access → Certificate Assistant → Request a Certificate from a Certificate Authority
59
+ 4. Upload CSR, download the .cer file
60
+ 5. Double-click .cer to install in Keychain
61
+ 6. In Keychain Access, find 'Developer ID Application: <Your Name>' → right-click → Export
62
+ 7. Choose .p12 format, set a password
63
+ ```
64
+
65
+ Then:
66
+
67
+ ```bash
68
+ # Base64 encode for GH secret
69
+ base64 -i DeveloperIDApplication.p12 | pbcopy
70
+ # Identity name (paste into APPLE_SIGNING_IDENTITY)
71
+ security find-identity -p codesigning -v | grep "Developer ID Application"
72
+ ```
73
+
74
+ ### Step 3/7: App Store Connect API key (for notarization)
75
+
76
+ Same key as `expo-mobile` setup if you already did that. Otherwise:
77
+
78
+ ```
79
+ 1. https://appstoreconnect.apple.com/access/api
80
+ 2. Generate Key, role 'Developer' (or higher)
81
+ 3. Download .p8 file (one chance only)
82
+ 4. Note Key ID and Issuer ID
83
+ ```
84
+
85
+ ### Step 4/7: Vercel Blob token (for hosting downloads + updater manifest)
86
+
87
+ ```
88
+ 1. https://vercel.com/dashboard → Storage → Blob → Create
89
+ 2. Connect to your Vercel project
90
+ 3. Copy the BLOB_READ_WRITE_TOKEN value
91
+ ```
92
+
93
+ (Skip if you're hosting downloads on GH Releases only — the updater manifest can be served from there.)
94
+
95
+ ### Step 5/7: Upload all 9 GH secrets
96
+
97
+ The skill walks the user through `gh secret set` for each:
98
+
99
+ ```bash
100
+ REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
101
+
102
+ gh secret set TAURI_SIGNING_PRIVATE_KEY -R "$REPO" < ~/.tauri/${APP_SLUG}.key
103
+ gh secret set TAURI_SIGNING_PRIVATE_KEY_PASSWORD -R "$REPO" # paste passphrase
104
+ gh secret set APPLE_CERTIFICATE -R "$REPO" # paste base64 .p12
105
+ gh secret set APPLE_CERTIFICATE_PASSWORD -R "$REPO" # paste .p12 password
106
+ gh secret set APPLE_SIGNING_IDENTITY -R "$REPO" # paste 'Developer ID Application: ...'
107
+ gh secret set APPLE_API_ISSUER -R "$REPO" # paste UUID
108
+ gh secret set APPLE_API_KEY -R "$REPO" # paste 10-char Key ID
109
+ gh secret set APPLE_API_KEY_CONTENT -R "$REPO" # paste raw .p8 content (with BEGIN/END)
110
+ gh secret set BLOB_READ_WRITE_TOKEN -R "$REPO" # paste from step 4 (skip if not using)
111
+ ```
112
+
113
+ After each, verify:
114
+
115
+ ```bash
116
+ gh secret list -R "$REPO" | grep -E "TAURI|APPLE|BLOB"
117
+ # Expect: 9 entries
118
+ ```
119
+
120
+ ### Step 6/7: Scaffold the workflow
121
+
122
+ Copy the template:
123
+
124
+ ```bash
125
+ cp ${CLAUDE_PLUGIN_ROOT}/skills/ship/templates/workflow-tauri-release.yml .github/workflows/release-desktop.yml
126
+ ```
127
+
128
+ Customize the matrix (which platforms to build) and the artifact upload step.
129
+
130
+ The workflow triggers on `v*.*.*` tag push. It:
131
+
132
+ 1. Checks out
133
+ 2. Installs Rust + Node + pnpm
134
+ 3. Restores Apple cert from `APPLE_CERTIFICATE` secret
135
+ 4. Writes `APPLE_API_KEY_CONTENT` to `~/private_keys/AuthKey.p8`
136
+ 5. Builds via `tauri-action`
137
+ 6. Uploads .dmg / .msi / .AppImage to GH Releases
138
+ 7. Updates `latest.json` (Tauri updater manifest) and uploads to Vercel Blob (if configured)
139
+
140
+ ### Step 7/7: Persist + dry-run
141
+
142
+ `.codebyplan/shipment.json`:
143
+
144
+ ```json
145
+ {
146
+ "surfaces": {
147
+ "tauri-desktop": {
148
+ "configured_at": "<now>",
149
+ "app_path": "apps/desktop",
150
+ "platforms": ["macos-arm64", "macos-x64"],
151
+ "updater_endpoint": "https://your-blob-host/latest.json",
152
+ "versioning": "manual"
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ Test with a dry-run tag (the workflow runs but you can delete the release after):
159
+
160
+ ```bash
161
+ git tag v0.0.0-test
162
+ git push origin v0.0.0-test
163
+ gh run watch
164
+ # After verification:
165
+ gh release delete v0.0.0-test --yes
166
+ git push origin :v0.0.0-test
167
+ git tag -d v0.0.0-test
168
+ ```
169
+
170
+ ## Done
171
+
172
+ Surface is ready. `/cbp-ship` will offer desktop release when version bumps.
173
+
174
+ ## Common setup issues
175
+
176
+ | Symptom | Fix |
177
+ |---|---|
178
+ | Notarization step times out | `notarytool` slow under heavy queue; the workflow waits up to 30min, usually completes |
179
+ | "Invalid p12 password" | Test locally: `security import DeveloperIDApplication.p12 -P "$PASS"` |
180
+ | `latest.json` not updating in Vercel Blob | Check `BLOB_READ_WRITE_TOKEN` scope (must be read+write, not read-only) |
181
+ | Workflow fails on Linux runner | Common: missing `webkit2gtk-4.1` system dep; add to apt install step |
@@ -0,0 +1,117 @@
1
+ # Configure: vercel-web
2
+
3
+ Walkthrough for first-time Vercel link.
4
+
5
+ ## Prerequisites
6
+
7
+ - Vercel account (free tier OK for hobby; Pro for teams)
8
+ - For monorepo: decide which app folder gets linked (each app needs its own link)
9
+
10
+ ## Probe
11
+
12
+ ```bash
13
+ which vercel || { echo "Install: npm i -g vercel"; exit 1; }
14
+ vercel --version
15
+ vercel whoami || { echo "Run: vercel login"; exit 1; }
16
+ ```
17
+
18
+ ## Setup walkthrough
19
+
20
+ ### Step 1/6: Pick the app folder
21
+
22
+ If monorepo, ask user which `apps/*` directory. If single-app repo, use the repo root.
23
+
24
+ ### Step 2/6: Run `vercel link`
25
+
26
+ ```
27
+ You'll run: vercel link
28
+
29
+ This creates .vercel/project.json. Choose:
30
+ - Existing project: pick from list
31
+ - New project: type name, accept defaults
32
+
33
+ Press Enter to run, or 'skip' to do it yourself in another terminal.
34
+ ```
35
+
36
+ If user runs it in this terminal, observe the resulting `.vercel/project.json`.
37
+
38
+ ### Step 3/6: Configure framework settings
39
+
40
+ If Next.js + monorepo, set:
41
+
42
+ ```
43
+ Vercel dashboard → project → Settings → General:
44
+ - Framework Preset: Next.js
45
+ - Root Directory: apps/{instance}
46
+ - Build Command: cd ../.. && pnpm turbo build --filter={instance}
47
+ - Install Command: cd ../.. && pnpm install --frozen-lockfile
48
+ - Output Directory: (leave default)
49
+ ```
50
+
51
+ ### Step 4/6: Sync env vars
52
+
53
+ ```bash
54
+ # Read from .env.example for the keys
55
+ KEYS=$(grep -E '^[A-Z_]+=' "$APP_PATH/.env.example" | cut -d= -f1)
56
+ echo "Vars to set in Vercel: $KEYS"
57
+
58
+ # For each, prompt user — values come from their secret store, not this skill
59
+ ```
60
+
61
+ For each key, instruct:
62
+
63
+ ```
64
+ Set $KEY in Vercel:
65
+ vercel env add $KEY production
66
+ vercel env add $KEY preview
67
+
68
+ (or via dashboard → Settings → Environment Variables)
69
+ ```
70
+
71
+ ### Step 5/6: Verify GH integration
72
+
73
+ ```bash
74
+ vercel git connect 2>&1 | head -5
75
+ # Should report the linked GitHub repo. If not connected:
76
+ echo "Vercel dashboard → project → Settings → Git → Connect GitHub Repository"
77
+ ```
78
+
79
+ ### Step 6/6: Persist + verify
80
+
81
+ Write `.codebyplan/shipment.json`:
82
+
83
+ ```json
84
+ {
85
+ "surfaces": {
86
+ "vercel-web": {
87
+ "configured_at": "<now>",
88
+ "instance": "apps/web",
89
+ "project_id": "<from .vercel/project.json>",
90
+ "org_id": "<from .vercel/project.json>",
91
+ "framework": "nextjs",
92
+ "production_branch": "<branch_config.production>"
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ Verify:
99
+
100
+ ```bash
101
+ PROJECT_ID=$(jq -r '.surfaces."vercel-web".project_id' .codebyplan/shipment.json)
102
+ vercel inspect "$PROJECT_ID" --json | jq -r '.name, .latestDeployments[0].readyState'
103
+ ```
104
+
105
+ Expect: project name + `READY` (or `BUILDING` if mid-deploy).
106
+
107
+ ## Done
108
+
109
+ Surface is ready. `/cbp-ship` can now deploy this app.
110
+
111
+ ## Common setup issues
112
+
113
+ | Symptom | Fix |
114
+ |---|---|
115
+ | `vercel link` errors "team not found" | Re-login: `vercel logout && vercel login` |
116
+ | Build fails on first deploy | Verify Root Directory and Build Command match monorepo layout |
117
+ | "No Production Deployment" status | Push to production branch (or run `vercel --prod` once) to seed |