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,109 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-checkpoint-complete
4
+ description: Complete a checkpoint after all tasks are done
5
+ argument-hint: [checkpoint-number]
6
+ effort: low
7
+ ---
8
+
9
+ # Checkpoint Complete Command
10
+
11
+ Finalize a checkpoint after all tasks are completed.
12
+
13
+ ## Instructions
14
+
15
+ ### Step 0.5: Parse `$ARGUMENTS`
16
+
17
+ Parse the argument:
18
+
19
+ | Shape | Regex | Resolves to |
20
+ |-------|-------|-------------|
21
+ | `{chk}` (e.g. `108`) | `^[0-9]+$` | Target CHK-{chk} |
22
+ | _(empty)_ | — | Use MCP `get_current_task` to find the active checkpoint |
23
+
24
+ Anything else is malformed — surface this error and stop:
25
+
26
+ ```
27
+ checkpoint-complete: invalid argument `{value}`. Expected:
28
+ 108 → CHK-108
29
+ (empty) → active checkpoint
30
+ ```
31
+
32
+ #### Worked examples
33
+
34
+ - `checkpoint-complete 108` → CHK-108
35
+ - `checkpoint-complete` (no arg) → active checkpoint via `get_current_task`
36
+ - `checkpoint-complete abc` → error: malformed
37
+ - `checkpoint-complete 108-1` → error: malformed (that is task-start's shape)
38
+
39
+ ### Step 1: Get Active Checkpoint
40
+
41
+ Given the parse from Step 0.5:
42
+
43
+ | Parse | Resolution path |
44
+ |-------|-----------------|
45
+ | `{chk}` | MCP `get_checkpoints(repo_id)` → filter `number === {chk}` (must exist). |
46
+ | _(empty)_ | MCP `get_current_task` with repo_id. Get the active checkpoint. If no active checkpoint, show error and stop. |
47
+
48
+ ### Step 2: Verify Checkpoint End Has Run
49
+
50
+ Check `checkpoint.context.shipment` — must exist with at least `feat_to_dev.merged: true`.
51
+
52
+ If not:
53
+ ```
54
+ ## Cannot Complete Checkpoint
55
+
56
+ Checkpoint has not been shipped yet. Run `/cbp-checkpoint-end` first to merge feat branch to development.
57
+ ```
58
+ Stop here.
59
+
60
+ ### Step 2.5: Verify All Tasks Complete
61
+
62
+ Use MCP `get_tasks` for the checkpoint. Verify all tasks have status `completed`.
63
+
64
+ If incomplete tasks remain:
65
+ ```
66
+ ## Cannot Complete Checkpoint
67
+
68
+ CHK-[NNN] has [N] incomplete tasks:
69
+ - TASK-[N]: [title] (status: [status])
70
+
71
+ Complete remaining tasks first, then run `/cbp-checkpoint-complete`.
72
+ ```
73
+ Stop here.
74
+
75
+ ### Step 3: Aggregate QA
76
+
77
+ Collect QA results from all tasks and rounds. Build checkpoint-level QA summary:
78
+ - Count auto checks passed/failed
79
+ - List user QA items pending review
80
+
81
+ If any critical failures, warn the user but don't block.
82
+
83
+ ### Step 4: Complete Checkpoint
84
+
85
+ Use MCP `complete_checkpoint(checkpoint_id)`.
86
+
87
+ This automatically:
88
+ - Sets status to `completed`
89
+ - Sets `completed_at` to now
90
+ - Triggers auto-push to main if enabled
91
+
92
+ ### Step 5: Show Result and Route
93
+
94
+ ```
95
+ ## Checkpoint Completed
96
+
97
+ **CHK-[NNN]**: [Title]
98
+ **Tasks**: [N] completed
99
+ **QA**: [summary]
100
+ **Auto-push**: [result]
101
+ ```
102
+
103
+ **Next**: Run `/clear`, then `/cbp-todo` to find the next checkpoint or standalone task.
104
+
105
+ ## Integration
106
+
107
+ - **Triggered by**: `/cbp-checkpoint-end` (auto, after successful shipment)
108
+ - **Reads**: MCP `get_current_task`, `get_tasks`, `get_rounds`
109
+ - **Writes**: MCP `complete_checkpoint`
@@ -0,0 +1,287 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-checkpoint-create
4
+ description: In-depth idea assessment, Q&A, and task creation
5
+ argument-hint: [checkpoint description]
6
+ effort: xhigh
7
+ ---
8
+
9
+ # Checkpoint Create Command
10
+
11
+ Runs INLINE (no subagent) - all context stays in session. Assesses the idea, runs research if needed, conducts exhaustive Q&A, builds context, and creates tasks as vertical slices.
12
+
13
+ ## Instructions
14
+
15
+ ### Step 1: Check for Existing Checkpoint Data
16
+
17
+ Before asking the user anything, check if a checkpoint already exists with ideas/context:
18
+
19
+ 1. Use MCP `get_next_action` response context — if it includes a checkpoint, load it via MCP `get_checkpoints`
20
+ 2. If `$ARGUMENTS` contains a checkpoint number (e.g., `69` or `CHK-69`), load that checkpoint
21
+ 3. Check the checkpoint's `ideas` array and `context` fields
22
+
23
+ **If checkpoint has `ideas[]` with descriptions/requirements:**
24
+ - Use `ideas[].description` as the checkpoint description (DO NOT ask the user)
25
+ - Use `ideas[].requirements` as the requirements list
26
+ - Use existing `context` (decisions, discoveries, etc.) if populated
27
+ - Skip Steps 1b and 2 if deadline already set
28
+ - Proceed directly to Step 3 with this pre-loaded context
29
+
30
+ **If checkpoint has NO ideas or is brand new:** Continue to Step 1b.
31
+
32
+ ### Step 1b: Get Checkpoint Description
33
+
34
+ **If arguments provided:** Use `$ARGUMENTS` as `user_prompt`
35
+
36
+ **If NO arguments:** Ask user via AskUserQuestion:
37
+ ```
38
+ What should this checkpoint accomplish?
39
+ Describe the work in a sentence or two.
40
+ ```
41
+
42
+ **Data routing for ideas[]:**
43
+ - `ideas[].description` = user's raw prompt (user-written, immutable after creation)
44
+ - `ideas[].assessment` = Claude's structured analysis of this idea (Claude-updatable)
45
+ - `context` = structured analysis output (decisions, constraints, discoveries)
46
+ - Do NOT write Claude analysis into `user_context` — that field is for raw user text only
47
+
48
+ ### Step 2: Prompt for Deadline
49
+
50
+ **Skip if checkpoint already has a deadline set.**
51
+
52
+ Ask user via AskUserQuestion with options:
53
+ - Today
54
+ - Tomorrow
55
+ - This week (Friday)
56
+ - Custom date
57
+
58
+ ### Step 2.9: Semantic-Domain Module Dedup (BEFORE assessment)
59
+
60
+ Run BEFORE Step 3 (Assess Idea) so the assessment factors in any existing module that might already cover the proposed feature. Cheaper to clarify intent at checkpoint creation than during planner Phase 1 Q&A.
61
+
62
+ **Trigger**: the checkpoint description (or any `ideas[].description`) contains a feature verb in a user-facing semantic domain. Domain table — extend as new modules ship:
63
+
64
+ | Domain | Trigger verbs / nouns | Glob target |
65
+ |--------|----------------------|-------------|
66
+ | Eating | eat, meal, food, recipe, ingredient, nutrition, kitchen | `apps/mobile/src/features/modules/food*/`, `apps/mobile/src/features/modules/eating*/` |
67
+ | Sleeping | sleep, nap, bedtime, wake, dream, rest | `apps/mobile/src/features/modules/sleep*/` |
68
+ | Fitness | workout, exercise, fitness, training, run, lift, rep | `apps/mobile/src/features/modules/fitness*/` |
69
+ | Hobbies | hobby, leisure, craft, game | `apps/mobile/src/features/modules/hobb*/` |
70
+ | Finance | money, expense, budget, transaction, pay, income | `apps/mobile/src/features/modules/finance*/`, `apps/mobile/src/features/modules/money*/` |
71
+ | Mood | mood, emotion, feeling, journal, reflect | `apps/mobile/src/features/modules/mood*/` |
72
+ | Social | friend, contact, message, share, social | `apps/mobile/src/features/modules/social*/` |
73
+ | Reading | read, book, chapter, library | `apps/mobile/src/features/modules/reading*/` |
74
+ | Self-care | selfcare, hygiene, skincare, wellness | `apps/mobile/src/features/modules/selfcare*/`, `apps/mobile/src/features/modules/hygiene*/` |
75
+ | Pets | pet, dog, cat, animal | `apps/mobile/src/features/modules/pet*/` |
76
+ | Work | work, job, task, productivity | `apps/mobile/src/features/modules/work*/` |
77
+
78
+ **Procedure**:
79
+
80
+ 1. Tokenise the description into verbs/nouns. Match against the trigger column.
81
+ 2. For each matched domain, Glob the corresponding target. If the glob returns zero entries, no overlap — proceed.
82
+ 3. If the glob returns one or more existing modules, ask the user via AskUserQuestion (BEFORE running Step 3 codebase analysis):
83
+
84
+ > Found existing module(s) `{matched-paths}` which may already cover {domain} functionality.
85
+ >
86
+ > A) Extend the existing module — add the new feature inside `{primary-match}` rather than creating a new module
87
+ > B) Build a separate module — explain the distinction in 1-2 sentences (different user intent / different data shape)
88
+ > C) Unrelated — the new feature is in the same semantic neighbourhood but does not overlap functionally
89
+ > D) Cancel checkpoint creation — re-frame the description
90
+
91
+ 4. Save the answer as a locked decision in checkpoint context:
92
+ ```json
93
+ {
94
+ "decision": "Extend existing food module rather than create eating module",
95
+ "rationale": "User clarified meal-tracking lives alongside existing food/recipe data",
96
+ "locked": true
97
+ }
98
+ ```
99
+ Pass `locked: true` so planner Phase 2 honors it.
100
+
101
+ 5. If (B) "Build separate", record the user's distinction verbatim as the rationale — planner Phase 1 will use it to avoid duplicate scaffolding.
102
+
103
+ **Why this fires here, not in planner Phase 1**: the planner's Q&A already catches duplicates (livebyplan TASK-4 caught "eating" → existing "food" via planner Q&A), but only after spawning Explore and reading codebase context — wasteful when the question is "is this even a new module?" Catching at checkpoint creation halves the round-1 surface area for duplicate-feature checkpoints.
104
+
105
+ Skip this step when the description has zero domain matches OR when the user explicitly states intent in the prompt ("extend the existing food module to support meal sessions") with a referenced module path.
106
+
107
+ ### Step 3: Assess Idea (INLINE - no subagent)
108
+
109
+ Analyze the idea thoroughly:
110
+
111
+ 1. **Discovery Level Detection:**
112
+ - Level 0: Simple change, no research needed
113
+ - Level 1: Minor research, check existing patterns
114
+ - Level 2: Moderate research, check docs/APIs
115
+ - Level 3: Deep research, unfamiliar territory
116
+
117
+ 2. **Codebase Analysis:** Use Glob/Grep/Read to understand:
118
+ - Related existing code
119
+ - Patterns to follow
120
+ - Dependencies affected
121
+ - Files that will need changes
122
+
123
+ 3. **Research (Level 2+ only):** Spawn a single `research` subagent for web research. Wait for results.
124
+ - Research findings MUST be stored in checkpoint.research JSONB via MCP `update_checkpoint` — NEVER write to local docs/ folder
125
+
126
+ 4. **Cross-Reference All Ideas:**
127
+ - When analyzing ideas[], iterate ALL items — not just the first
128
+ - Cross-reference requirements across all context items
129
+ - Identify overlaps, conflicts, and dependencies between ideas
130
+ - Store cross-reference results in checkpoint context (discoveries[], dependencies[])
131
+
132
+ 5. **Store Assessment Per Idea:**
133
+ - For each idea analyzed, write Claude's analysis into `ideas[N].assessment`
134
+ - Use MCP `update_checkpoint` with the full ideas array including assessment fields
135
+ - The assessment is Claude-written; the description remains the user's original text
136
+
137
+ ### Step 4: Exhaustive Q&A
138
+
139
+ Ask the user targeted questions to fill gaps. Every answer gets saved immediately.
140
+
141
+ **Build questions based on:**
142
+ - Ambiguities in the description
143
+ - Multiple valid approaches detected
144
+ - UI/UX decisions needed
145
+ - Scope boundaries unclear
146
+ - Integration points uncertain
147
+
148
+ Use AskUserQuestion for each question batch (max 4 per call). After each response, save to checkpoint context via MCP `update_checkpoint`:
149
+
150
+ ```json
151
+ {
152
+ "context": {
153
+ "decisions": [{"decision": "...", "rationale": "...", "locked": true}],
154
+ "discoveries": [{"topic": "...", "finding": "..."}],
155
+ "dependencies": ["..."],
156
+ "constraints": ["..."],
157
+ "qa_answers": [{"question": "...", "answer": "..."}]
158
+ }
159
+ }
160
+ ```
161
+
162
+ Continue asking until all ambiguities resolved.
163
+
164
+ ### Step 5: Determine Next Checkpoint Number
165
+
166
+ Use MCP `get_checkpoints` for the repo. Find highest checkpoint number, add 1.
167
+
168
+ ### Step 6: Create Checkpoint in DB
169
+
170
+ **Before calling `create_checkpoint`**: resolve worktree_id via `npx codebyplan resolve-worktree 2>/dev/null`. If non-empty, pass as the `worktree_id` parameter so the checkpoint is born assigned to this worktree. (Per CHK-104 TASK-2 — DB-level hard-lock requires identifying the caller worktree at creation time.)
171
+
172
+ **Why here specifically**: this is the first identity-stamping point for the checkpoint; if `worktree_id` is missing here, every downstream task and round inherits the gap and the hard-lock pre-guards have no caller identity to compare against. If empty, prompt the user to run `npx codebyplan setup` first from this directory to register the worktree before creating the checkpoint.
173
+
174
+ Use MCP `create_checkpoint`:
175
+ - `repo_id`: from .codebyplan/repo.json
176
+ - `worktree_id`: from `npx codebyplan resolve-worktree 2>/dev/null` (omit param if empty — checkpoint is created with NULL worktree_id, unassigned)
177
+ - `title`: derived from description
178
+ - `number`: next number
179
+ - `goal`: detailed goal from assessment
180
+ - `deadline`: from Step 2
181
+ - `status`: "pending"
182
+ - `context`: accumulated from Q&A
183
+ - `research`: from Step 3 (if any)
184
+
185
+ ### Step 6b: Generate Plan
186
+
187
+ Based on the assessment and Q&A, generate a structured plan:
188
+
189
+ 1. Analyze ALL `ideas[]` items — every description and every requirement
190
+ 2. Create an ordered sequence of plan steps that covers everything
191
+ 3. Each step: `{ title: "What to build", description: "How and why", scope: "Which idea(s) it addresses" }`
192
+ 4. Ensure every idea description and every requirement is addressed by at least one step
193
+ 5. Cross-reference: if multiple ideas relate, consolidate into cohesive steps
194
+
195
+ Save plan to checkpoint via MCP `update_checkpoint(checkpoint_id, plan: { steps: [...] })`.
196
+
197
+ ### Step 7: Create Tasks as Vertical Slices
198
+
199
+ **Critical design principle:** Each task is a complete vertical slice that can be independently implemented and tested. Each task should produce a complete, production-ready deliverable.
200
+
201
+ **BAD (horizontal layers):**
202
+ - TASK-1: Create database functions
203
+ - TASK-2: Create API routes
204
+ - TASK-3: Create UI components
205
+
206
+ **GOOD (vertical slices grouped by theme):**
207
+ - TASK-1: Implement user authentication (DB + API + UI)
208
+ - TASK-2: Implement user profile page (DB + API + UI)
209
+
210
+ **GOOD (theme-based grouping for infrastructure):**
211
+ - TASK-1: Config rule + remove Step 0 from all commands (one theme: eliminate redundant reads)
212
+ - TASK-2: Task sizing + round workflow improvements (one theme: workflow optimization)
213
+
214
+ **Sizing:** With 1M token context, tasks can be large. Group logically by theme — each task should encompass all work needed to deliver a complete feature or improvement. Only split a vertical slice when it covers genuinely independent themes, not because of size. A single task touching 30+ files is fine if they all serve one coherent purpose.
215
+
216
+ For each task, use MCP `create_task`:
217
+ - `checkpoint_id`: from Step 6
218
+ - `title`: descriptive vertical slice title
219
+ - `number`: sequential
220
+ - `requirements`: detailed requirements
221
+ - `context`: extracted relevant context from checkpoint
222
+
223
+ ### Step 8: Create Git Branch
224
+
225
+ Check: `git branch -a | grep development`
226
+
227
+ **If NO development branch (local or remote):**
228
+ Create it from main:
229
+ ```bash
230
+ git checkout main && git checkout -b development && git push -u origin development && echo "Created development branch from main"
231
+ ```
232
+
233
+ **If development branch exists:**
234
+
235
+ Detect worktree: `IS_WORKTREE=$(test -f "$(git rev-parse --show-toplevel)/.git" && echo "yes" || echo "no")`
236
+
237
+ **(a) In a worktree:** Create feature branch from current branch:
238
+ ```bash
239
+ git checkout -b feat/CHK-{NNN}-{slug}
240
+ git push -u origin feat/CHK-{NNN}-{slug}
241
+ ```
242
+
243
+ **(b) Not in a worktree:** Run:
244
+ ```bash
245
+ git checkout -b feat/CHK-{NNN}-{slug}
246
+ git push -u origin feat/CHK-{NNN}-{slug}
247
+ ```
248
+
249
+ ### Step 9: Assign Worktree
250
+
251
+ Resolve `worktree_id` at runtime (CHK-108: never read from `.codebyplan/repo.json`):
252
+
253
+ ```bash
254
+ WORKTREE_ID=$(npx codebyplan resolve-worktree 2>/dev/null)
255
+ ```
256
+
257
+ If `WORKTREE_ID` is non-empty:
258
+ ```
259
+ MCP update_checkpoint(checkpoint_id, worktree_id: WORKTREE_ID)
260
+ ```
261
+
262
+ If empty (tuple unmatched): skip — Step 6 already passed `worktree_id` to `create_checkpoint`, so this re-stamp is only a defensive no-op.
263
+
264
+ ### Step 10: Show Result
265
+
266
+ ```
267
+ ## Checkpoint Created
268
+
269
+ **ID**: CHK-[NNN]
270
+ **Title**: [Title]
271
+ **Deadline**: [date]
272
+ **Discovery Level**: [0-3]
273
+ **Tasks**: [N]
274
+
275
+ ### Tasks:
276
+ 1. TASK-1: [title]
277
+ 2. TASK-2: [title]
278
+ ...
279
+
280
+ Run `/cbp-todo` to start working.
281
+ ```
282
+
283
+ ## Integration
284
+
285
+ - **Runs inline**: All analysis in current session (no context loss)
286
+ - **Spawns**: `research` agent (Level 2+ only, for web research)
287
+ - **Saves to DB**: Context, research, QA answers via MCP
@@ -0,0 +1,241 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-checkpoint-end
4
+ description: Single point for all shipment — branch promotion to main via /cbp-ship-main, runtime deploy via /cbp-ship, branch cleanup, summary. Standalone tasks bypass shipment entirely.
5
+ effort: xhigh
6
+ ---
7
+
8
+ # Checkpoint End Command
9
+
10
+ Ship the checkpoint in three phases:
11
+ 1. **Branch promotion** — merge feat → main via `/cbp-ship-main` (which runs `codebyplan ship`)
12
+ 2. **Runtime deploy** — call `/cbp-ship` to deploy every configured surface (Vercel, EAS, npm, Tauri, Railway, Supabase migrations, VS Code marketplace)
13
+ 3. **Cleanup + summary** — stale feat branch removal, comprehensive shipment record
14
+
15
+ Standalone tasks (per `task-start.md`) do NOT go through `/cbp-checkpoint-end` — only checkpoint-bound tasks ship.
16
+
17
+ ## When to Use
18
+
19
+ - After `/cbp-checkpoint-check` confirms checkpoint is ready
20
+ - Before `/cbp-checkpoint-complete`
21
+ - Checkpoint CANNOT be completed without successful shipment
22
+
23
+ ## Instructions
24
+
25
+ ### Step 0: Sync with Main (mandatory)
26
+
27
+ Before any shipment logic, ensure the feat branch is current against main. Shipment from a stale feat branch causes preventable PR-time conflicts and a noisy merge history.
28
+
29
+ 1. Trigger `/cbp-merge-main`.
30
+ 2. If the skill exits with failure (offline, unresolved conflicts, user-aborted): surface the failure and STOP `/cbp-checkpoint-end` — shipment is not safe until the branch is reconciled. The user resolves and re-invokes.
31
+ 3. On clean success: continue to Step 1.
32
+
33
+ ### Step 1: Get Active Checkpoint
34
+
35
+ Use MCP `get_current_task` with repo_id. Get the active checkpoint.
36
+
37
+ If no active checkpoint, show error and stop.
38
+
39
+ ### Step 2: Verify Checkpoint Check Passed
40
+
41
+ Check `checkpoint.context.check_results` — must exist.
42
+
43
+ If not: `Run /cbp-checkpoint-check first.`
44
+
45
+ ### Step 3: Read Branch Config
46
+
47
+ Read `.codebyplan/git.json` and extract `branch_config` (handle missing file gracefully):
48
+
49
+ ```
50
+ BASE = branch_config.base ?? branch_config.production ?? "main"
51
+ PROTECTED = branch_config.protected (default: ["main"])
52
+ ```
53
+
54
+ Read `.codebyplan/server.json` and extract `auto_push_enabled` (default: false).
55
+
56
+ If `branch_config` is absent, use defaults above.
57
+
58
+ ### Step 4: Verify Branch Existence
59
+
60
+ ```bash
61
+ git fetch origin
62
+ ```
63
+
64
+ Check that the base branch exists remotely:
65
+
66
+ | Branch | Required | If Missing |
67
+ |--------|----------|------------|
68
+ | BASE | Yes | **STOP** — cannot ship without production branch |
69
+
70
+ ### Step 5: Ship to Production
71
+
72
+ If `auto_push_enabled` is true, run `/cbp-ship-main`.
73
+
74
+ If false, inform user:
75
+ ```
76
+ Auto-push is disabled. To ship to production, run `/cbp-ship-main` manually.
77
+ ```
78
+
79
+ Wait for result. If `/cbp-ship-main` exits with failure (checks failed, PR conflicts, auth error), investigate and fix.
80
+
81
+ If merge conflicts arise at PR time:
82
+ 1. Show the conflicts
83
+ 2. Suggest: run `/cbp-merge-main` on the feat branch to resolve conflicts (Step 0 should have caught this — if Step 0 was skipped or new conflicts appeared since, this re-runs the merge gate). NEVER rebase.
84
+ 3. **STOP** — wait for user to resolve
85
+
86
+ ### Step 6: Verify Merge Landed
87
+
88
+ After `/cbp-ship-main` completes, verify the merge landed:
89
+
90
+ ```bash
91
+ PR_DATA=$(gh pr view --json mergedAt,mergeCommit,statusCheckRollup)
92
+ ```
93
+
94
+ Runtime deployment for the base branch is handled in Step 7 by `/cbp-ship` (which detects + verifies all surfaces uniformly). Do NOT do per-surface verification inline here — that duplicates `/cbp-ship` and skips uncovered surfaces.
95
+
96
+ ### Step 7: Runtime Shipment via `/cbp-ship`
97
+
98
+ After branch promotion to main completes, invoke `/cbp-ship` to deploy every configured surface:
99
+
100
+ - Vercel auto-deploy verification
101
+ - Mobile shipment (asks user: skip / EAS internal TestFlight / EAS external TestFlight)
102
+ - Tauri desktop release (if version bumped)
103
+ - npm package publish (if version bumped — interactive 2FA)
104
+ - VS Code extension publish (if version bumped)
105
+ - Railway backend deploy
106
+ - Supabase migration push (interactive review per migration)
107
+
108
+ `/cbp-ship` handles its own confirmation + per-surface verification. Wait for it to complete before continuing.
109
+
110
+ If `/cbp-ship` reports `aborted_at` (user aborted) or any surface failed verification, halt — do NOT proceed to cleanup. Surface the failure to the user; resolve, then re-run `/cbp-checkpoint-end`.
111
+
112
+ If the repo has zero configured surfaces (very early-stage), `/cbp-ship` exits with `## No deployable surfaces configured` — that's a success state, continue to cleanup.
113
+
114
+ ### Step 8: Stale Feat Branch Cleanup
115
+
116
+ After successful shipment, identify stale remote feat branches:
117
+
118
+ ```bash
119
+ git branch -r --list 'origin/feat/*' | sed 's|origin/||'
120
+ ```
121
+
122
+ For each feat branch (excluding current):
123
+ - Check if associated checkpoint is completed (via MCP or branch name matching)
124
+ - Check age: `git log -1 --format=%ci "origin/$BRANCH"`
125
+ - Flag as stale if: checkpoint completed OR older than 30 days
126
+
127
+ If stale branches found, present list to user via AskUserQuestion:
128
+ ```
129
+ Found [N] stale feat branches:
130
+
131
+ | Branch | Last Commit | Status |
132
+ |--------|-------------|--------|
133
+ | feat/CHK-XXX-... | YYYY-MM-DD | completed / >30 days old |
134
+
135
+ Delete these branches? (both local and remote)
136
+ Options:
137
+ A) Delete all listed
138
+ B) Delete specific ones (list numbers)
139
+ C) Keep all
140
+ ```
141
+
142
+ Only delete with explicit user confirmation. Delete both local and remote:
143
+ ```bash
144
+ git branch -d "$BRANCH" 2>/dev/null
145
+ git push origin --delete "$BRANCH"
146
+ ```
147
+
148
+ ### Step 9: Current Feat Branch Cleanup
149
+
150
+ Present comprehensive summary first (Step 10), then ask about current feat branch via AskUserQuestion:
151
+
152
+ ```
153
+ The current feat branch [BRANCH] has been fully merged.
154
+
155
+ Delete this branch? (both local and remote)
156
+ A) Yes, delete
157
+ B) No, keep it
158
+ ```
159
+
160
+ **Never auto-delete.** Only delete with explicit user confirmation.
161
+
162
+ If user confirms:
163
+ ```bash
164
+ git checkout "$BASE"
165
+ git branch -d "$FEAT_BRANCH"
166
+ git push origin --delete "$FEAT_BRANCH"
167
+ ```
168
+
169
+ ### Step 10: Save Shipment Results and Summary
170
+
171
+ Update checkpoint context via MCP `update_checkpoint`. The `shipment` block contains both branch promotion AND runtime surface results (from `/cbp-ship` Step 7):
172
+
173
+ ```
174
+ context.shipment: {
175
+ timestamp: [ISO],
176
+ branch_config: { base, protected },
177
+ feat_to_base: { pr_url, merged: true/false },
178
+ surfaces: [...], // populated by /cbp-ship — per-surface deploy results
179
+ skipped: [...], // populated by /cbp-ship — surfaces explicitly skipped
180
+ stale_branches_cleaned: [list of deleted branches],
181
+ feat_branch_deleted: true/false
182
+ }
183
+ ```
184
+
185
+ Present summary:
186
+
187
+ ```
188
+ ## Checkpoint Shipment Summary
189
+
190
+ ### Branch Promotion
191
+ - **feat -> [BASE]**: [PR URL] (merged)
192
+
193
+ ### Runtime Surfaces (via /cbp-ship)
194
+ | Surface | Variant | Status | URL/ID |
195
+ | ... | ... | ... | ... |
196
+ (Table populated from context.shipment.surfaces[])
197
+
198
+ ### Branch Operations
199
+ - Stale branches deleted: [N] ([list])
200
+ - Feat branch: [deleted/kept]
201
+
202
+ ### Before/After Branch State
203
+ - Before: [list of feat/* branches]
204
+ - After: [list of remaining feat/* branches]
205
+ ```
206
+
207
+ Auto-trigger `/cbp-checkpoint-complete`.
208
+
209
+ ## Error Handling
210
+
211
+ | Error | Action |
212
+ |-------|--------|
213
+ | Merge fails (conflicts) | Keep feat branch, report failure, suggest resolution via feat branch |
214
+ | Merge fails (CI/review) | Keep feat branch, report status, wait for user |
215
+ | Vercel deployment fails | Keep feat branch, report status, do NOT proceed to cleanup |
216
+ | Branch creation fails | Report error, suggest manual resolution |
217
+ | gh CLI not authenticated | **STOP** — `Run: gh auth login` |
218
+
219
+ **On any shipment failure:**
220
+ 1. Keep the feat branch intact
221
+ 2. Report which step failed and why
222
+ 3. Suggest resolution path
223
+ 4. Route to error recovery (user fixes, then re-runs `/cbp-checkpoint-end`)
224
+
225
+ ## Key Rules
226
+
227
+ - **Never skip shipment errors** — investigate and fix
228
+ - **PRs only** — never direct push to protected branches
229
+ - **Checkpoint completion is blocked** until shipment succeeds
230
+ - **All merges use `--merge`** — never squash or rebase
231
+ - **Never auto-delete any branch** — always ask user first
232
+ - **Protected branches are NEVER deleted** — read from `branch_config.protected`
233
+ - **Read all branch names from config** — never hardcode
234
+
235
+ ## Integration
236
+
237
+ - **Triggered by**: `/cbp-checkpoint-check` (auto, when ready)
238
+ - **Reads**: MCP `get_current_task`, `.codebyplan/git.json` (`branch_config`), `.codebyplan/server.json` (`auto_push_enabled`), `.codebyplan/shipment.json` (`shipment`), git branches
239
+ - **Writes**: MCP `update_checkpoint` (context.shipment — both branch promotion and runtime surface results)
240
+ - **Calls**: `/cbp-merge-main` (Step 0, sync); `/cbp-ship-main` (Step 5, branch promotion to main); `/cbp-ship` (Step 7, runtime surface deploy + verification)
241
+ - **Triggers**: `/cbp-checkpoint-complete` (auto, after successful shipment)