codebyplan 1.11.2 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +590 -405
- package/package.json +1 -1
- package/templates/hooks/README.md +1 -13
- package/templates/hooks/cbp-statusline.mjs +44 -0
- package/templates/hooks/cbp-statusline.py +24 -2
- package/templates/hooks/cbp-statusline.sh +22 -2
- package/templates/hooks/cbp-test-coverage-gate.sh +8 -0
- package/templates/hooks/cbp-test-hooks.sh +0 -42
- package/templates/hooks/hooks.json +0 -9
- package/templates/rules/README.md +8 -1
- package/templates/rules/supabase-branch-lifecycle.md +99 -0
- package/templates/settings.project.base.json +1 -2
- package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +1 -2
- package/templates/skills/cbp-checkpoint-create/SKILL.md +2 -0
- package/templates/skills/cbp-checkpoint-end/SKILL.md +27 -5
- package/templates/skills/cbp-checkpoint-start/SKILL.md +2 -2
- package/templates/skills/cbp-git-worktree-remove/SKILL.md +17 -1
- package/templates/skills/cbp-session-start/SKILL.md +28 -3
- package/templates/skills/{cbp-e2e-setup → cbp-setup-e2e}/SKILL.md +1 -1
- package/templates/skills/cbp-setup-eslint/SKILL.md +199 -0
- package/templates/skills/cbp-setup-eslint/reference/base.md +82 -0
- package/templates/skills/cbp-setup-eslint/reference/cli.md +56 -0
- package/templates/skills/cbp-setup-eslint/reference/e2e.md +68 -0
- package/templates/skills/cbp-setup-eslint/reference/jest.md +59 -0
- package/templates/skills/cbp-setup-eslint/reference/nestjs.md +69 -0
- package/templates/skills/cbp-setup-eslint/reference/nextjs.md +63 -0
- package/templates/skills/cbp-setup-eslint/reference/node.md +74 -0
- package/templates/skills/cbp-setup-eslint/reference/react-native.md +60 -0
- package/templates/skills/cbp-setup-eslint/reference/react.md +82 -0
- package/templates/skills/cbp-setup-eslint/reference/tailwind.md +64 -0
- package/templates/skills/cbp-setup-eslint/reference/testing-react.md +57 -0
- package/templates/skills/cbp-setup-eslint/reference/vitest.md +62 -0
- package/templates/skills/cbp-ship-main/SKILL.md +13 -0
- package/templates/skills/cbp-supabase-branch-check/SKILL.md +12 -5
- package/templates/skills/cbp-supabase-migrate/SKILL.md +139 -9
- package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +1 -1
- package/templates/skills/cbp-supabase-setup/SKILL.md +13 -7
- package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +2 -2
- package/templates/skills/cbp-task-complete/SKILL.md +1 -3
- package/templates/skills/cbp-task-start/SKILL.md +5 -3
- package/templates/hooks/cbp-mcp-worktree-inject.sh +0 -76
- /package/templates/skills/{cbp-e2e-setup → cbp-setup-e2e}/reference/maestro.md +0 -0
- /package/templates/skills/{cbp-e2e-setup → cbp-setup-e2e}/reference/playwright.md +0 -0
- /package/templates/skills/{cbp-e2e-setup → cbp-setup-e2e}/reference/tauri.md +0 -0
- /package/templates/skills/{cbp-e2e-setup → cbp-setup-e2e}/reference/vscode.md +0 -0
- /package/templates/skills/{cbp-e2e-setup → cbp-setup-e2e}/reference/xcuitest.md +0 -0
|
@@ -26,7 +26,7 @@ Verify: the integration tile now shows the connected repository name.
|
|
|
26
26
|
Protect both `main` AND the integration branch (e.g., `development`) so PRs cannot be merged
|
|
27
27
|
until the Supabase Preview environment passes.
|
|
28
28
|
|
|
29
|
-
For each branch (`main`, then the integration branch from `.codebyplan.json`
|
|
29
|
+
For each branch (`main`, then the integration branch from `.codebyplan/git.json`
|
|
30
30
|
`branch_config.integration`):
|
|
31
31
|
|
|
32
32
|
1. **GitHub → Repository → Settings → Branches → Add branch protection rule**.
|
|
@@ -94,7 +94,7 @@ migration push.
|
|
|
94
94
|
|
|
95
95
|
## 5. Idempotency Marker
|
|
96
96
|
|
|
97
|
-
After setup completes, `/cbp-supabase-setup` writes to `.codebyplan.json`:
|
|
97
|
+
After setup completes, `/cbp-supabase-setup` writes to `.codebyplan/shipment.json`:
|
|
98
98
|
|
|
99
99
|
```json
|
|
100
100
|
{
|
|
@@ -137,9 +137,7 @@ Skip the push only when nothing was committed in Step 5 AND `/cbp-merge-main` re
|
|
|
137
137
|
|
|
138
138
|
### Step 7: Complete Task
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
**When calling `complete_task`**: pass `caller_worktree_id` resolved from `npx codebyplan resolve-worktree`. The MCP server's pre-guard rejects mutations from non-matching worktrees; supplying `caller_worktree_id` ensures legitimate completion succeeds. The server auto-clears `assigned_user_id` + `assigned_worktree_id` on the task; if this was the last sibling task, it also clears the parent checkpoint's assignment. (Per CHK-104 TASK-2 hard-lock.)
|
|
140
|
+
Call `complete_task(task_id)`. The server resolves the caller's worktree identity from the JWT/ctx and enforces the mutate-lock (CHK-140 TASK-3 — `caller_worktree_id` input field removed). The server auto-clears `assigned_user_id` + `assigned_worktree_id` on the task; if this was the last sibling task, it also clears the parent checkpoint's assignment. (Per CHK-104 hard-lock.)
|
|
143
141
|
|
|
144
142
|
### Step 7.5: Standalone Task Branch Merge
|
|
145
143
|
|
|
@@ -115,6 +115,8 @@ fi
|
|
|
115
115
|
|
|
116
116
|
**If `git checkout` exits non-zero** (typically "would clobber" because a tracked file has unstaged changes that conflict with target's version): surface the raw git error verbatim, stop, do NOT attempt recovery. The user resolves and re-invokes. This is the only case where `/cbp-task-start` halts on branch state.
|
|
117
117
|
|
|
118
|
+
**Note — Supabase preview branch**: no Supabase branch is created at this point. Creation is lazy — it happens on the first DB change when `/cbp-supabase-migrate` runs on the feat branch, which provisions a Supabase branch named identically to the git branch. See `cbp-supabase-migrate` Step 2.3 for the creation protocol.
|
|
119
|
+
|
|
118
120
|
#### 3.4 — Persist + verify
|
|
119
121
|
|
|
120
122
|
After successful switch:
|
|
@@ -158,9 +160,9 @@ See `dependency-vulnerability-fixes.md` "Audit Sweep at Task Start" for the sour
|
|
|
158
160
|
|
|
159
161
|
### Step 3.5: Worktree-Match Verification
|
|
160
162
|
|
|
161
|
-
Before activating the task, verify the caller's worktree matches the assigned worktree on the target row. (Per CHK-104
|
|
163
|
+
Before activating the task, verify the caller's worktree matches the assigned worktree on the target row. (Per CHK-104 — DB-level hard-lock prevents cross-worktree mutations; the server resolves caller identity from the JWT/ctx.)
|
|
162
164
|
|
|
163
|
-
1. Read caller worktree: `CALLER_WT=$(npx codebyplan resolve-worktree 2>/dev/null)`.
|
|
165
|
+
1. Read caller worktree: `CALLER_WT=$(npx codebyplan resolve-worktree 2>/dev/null)`.
|
|
164
166
|
2. Determine target worktree:
|
|
165
167
|
- **Checkpoint-bound tasks**: `TARGET_WT = checkpoint.worktree_id` (read from MCP `get_checkpoints`). Note: checkpoint-bound tasks may have a NULL `task.assigned_worktree_id` because the lock lives on the parent checkpoint — fall through to `checkpoint.worktree_id`.
|
|
166
168
|
- **Standalone tasks**: `TARGET_WT = task.assigned_worktree_id`.
|
|
@@ -220,7 +222,7 @@ Display context summary:
|
|
|
220
222
|
|
|
221
223
|
Use MCP `update_task(task_id, status: "in_progress")`.
|
|
222
224
|
|
|
223
|
-
If worktree_id present, include `claim_worktree_id` to auto-claim the checkpoint
|
|
225
|
+
If worktree_id present, include `claim_worktree_id` to auto-claim the checkpoint. The server resolves the caller's worktree identity from the JWT/ctx (CHK-140 TASK-3 — `caller_worktree_id` input field removed).
|
|
224
226
|
|
|
225
227
|
### Step 6: Auto-trigger Round Start
|
|
226
228
|
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# @scope: org-shared
|
|
3
|
-
# Hook: PreToolUse mcp__codebyplan__(update_task|complete_task|complete_round|update_checkpoint)
|
|
4
|
-
# Purpose: Auto-inject caller_worktree_id into MCP mutation calls when not already
|
|
5
|
-
# present. Uses the PreToolUse hookSpecificOutput.updatedInput contract
|
|
6
|
-
# (Claude Code v2.1 — see hooks.md "PreToolUse decision control"):
|
|
7
|
-
# - Output JSON with hookSpecificOutput.permissionDecision="allow" and
|
|
8
|
-
# hookSpecificOutput.updatedInput containing the full modified tool_input.
|
|
9
|
-
# This hook NEVER exits non-zero — it is a no-op on all failure paths.
|
|
10
|
-
#
|
|
11
|
-
# Fallback chain:
|
|
12
|
-
# 1. caller_worktree_id already present in tool_input → passthrough (no-op)
|
|
13
|
-
# 2. Primary: npx codebyplan resolve-worktree → UUID found → inject
|
|
14
|
-
# 3. Secondary: npx codebyplan resolve-worktree --fallback-from-branch → UUID found → inject
|
|
15
|
-
# 4. Both empty → passthrough (server pre-guard skips when absent)
|
|
16
|
-
#
|
|
17
|
-
# NEVER exit non-zero — backwards-compat passthrough when resolver is broken.
|
|
18
|
-
|
|
19
|
-
INPUT=$(cat)
|
|
20
|
-
|
|
21
|
-
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
|
|
22
|
-
|
|
23
|
-
# Only intercept matching MCP mutation tools
|
|
24
|
-
case "$TOOL_NAME" in
|
|
25
|
-
mcp__codebyplan__update_task|\
|
|
26
|
-
mcp__codebyplan__complete_task|\
|
|
27
|
-
mcp__codebyplan__complete_round|\
|
|
28
|
-
mcp__codebyplan__update_checkpoint) ;;
|
|
29
|
-
*) exit 0 ;;
|
|
30
|
-
esac
|
|
31
|
-
|
|
32
|
-
# If caller_worktree_id is already present, pass through unchanged
|
|
33
|
-
EXISTING=$(echo "$INPUT" | jq -r '.tool_input.caller_worktree_id // empty' 2>/dev/null)
|
|
34
|
-
if [ -n "$EXISTING" ]; then
|
|
35
|
-
exit 0
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Try primary resolver
|
|
39
|
-
UUID=$(npx --yes codebyplan resolve-worktree 2>/dev/null)
|
|
40
|
-
|
|
41
|
-
# Try fallback if primary returned empty
|
|
42
|
-
if [ -z "$UUID" ]; then
|
|
43
|
-
UUID=$(npx --yes codebyplan resolve-worktree --fallback-from-branch 2>/dev/null)
|
|
44
|
-
fi
|
|
45
|
-
|
|
46
|
-
# If no UUID resolved, passthrough unchanged
|
|
47
|
-
if [ -z "$UUID" ]; then
|
|
48
|
-
exit 0
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# Extract tool_input and guard against null before merging
|
|
52
|
-
TOOL_INPUT=$(echo "$INPUT" | jq -c '.tool_input' 2>/dev/null)
|
|
53
|
-
if [ -z "$TOOL_INPUT" ] || [ "$TOOL_INPUT" = "null" ]; then
|
|
54
|
-
# No tool_input to mutate — output original input unchanged
|
|
55
|
-
echo "$INPUT"
|
|
56
|
-
exit 0
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
MERGED_TOOL_INPUT=$(echo "$TOOL_INPUT" | jq -c --arg uuid "$UUID" '. + {caller_worktree_id: $uuid}' 2>/dev/null)
|
|
60
|
-
if [ -z "$MERGED_TOOL_INPUT" ] || [ "$MERGED_TOOL_INPUT" = "null" ]; then
|
|
61
|
-
echo "$INPUT"
|
|
62
|
-
exit 0
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# Output PreToolUse hookSpecificOutput with updatedInput
|
|
66
|
-
jq -n \
|
|
67
|
-
--argjson updated "$MERGED_TOOL_INPUT" \
|
|
68
|
-
'{
|
|
69
|
-
hookSpecificOutput: {
|
|
70
|
-
hookEventName: "PreToolUse",
|
|
71
|
-
permissionDecision: "allow",
|
|
72
|
-
updatedInput: $updated
|
|
73
|
-
}
|
|
74
|
-
}'
|
|
75
|
-
|
|
76
|
-
exit 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|