codebyplan 1.13.15 → 1.13.17
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/README.md +77 -2
- package/dist/cli.js +709 -116
- package/package.json +2 -2
- package/templates/agents/cbp-e2e-playwright.md +194 -93
- package/templates/context/testing/e2e.md +14 -9
- package/templates/hooks/README.md +23 -1
- package/templates/settings.project.base.json +10 -0
- package/templates/skills/cbp-git-worktree-create/SKILL.md +11 -0
- package/templates/skills/cbp-round-execute/SKILL.md +18 -0
- package/templates/skills/cbp-setup-cmux/SKILL.md +170 -0
- package/templates/skills/cbp-task-complete/SKILL.md +14 -0
- package/templates/skills/cbp-task-start/SKILL.md +8 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
name: cbp-setup-cmux
|
|
4
|
+
description: Configure .codebyplan/cmux.json — choose workspace color and toggle auto_status / auto_dev_server. Interactive, idempotent.
|
|
5
|
+
argument-hint: "[--force]"
|
|
6
|
+
model: sonnet
|
|
7
|
+
effort: xhigh
|
|
8
|
+
allowed-tools: Read, Write, Edit, Bash(cat *), Bash(jq *), Bash(test *), Bash(mv *), Bash(git check-ignore *), Bash(cmux *), AskUserQuestion
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# cmux Setup
|
|
12
|
+
|
|
13
|
+
Configure `.codebyplan/cmux.json` so the cmux workspace integration knows which color to
|
|
14
|
+
apply on session start and whether auto_status / auto_dev_server are enabled.
|
|
15
|
+
|
|
16
|
+
Invoke at any time. Existing values are preserved unless `--force` is passed.
|
|
17
|
+
Pass `--force` to re-ask all questions including already-configured fields.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
Inspect `$ARGUMENTS` for `--force`. If present, set `force_mode = true`.
|
|
22
|
+
Absent: use idempotent mode — preserve existing configured values, skip re-asking
|
|
23
|
+
already-set fields.
|
|
24
|
+
|
|
25
|
+
## Step 1 — Parse --force and read existing config
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cat .codebyplan/cmux.json 2>/dev/null || echo '{}'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Capture the result as `EXISTING_JSON`. Extract existing values:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
EXISTING_COLOR=$(echo "$EXISTING_JSON" | jq -r '.workspace_color // empty')
|
|
35
|
+
EXISTING_AUTO_STATUS=$(echo "$EXISTING_JSON" | jq -r '.auto_status // empty')
|
|
36
|
+
EXISTING_AUTO_DEV=$(echo "$EXISTING_JSON" | jq -r '.auto_dev_server // empty')
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Step 2 — Ask for workspace color
|
|
40
|
+
|
|
41
|
+
**Idempotency gate**: skip this question if `force_mode = false` AND `EXISTING_COLOR`
|
|
42
|
+
is a non-empty string. Print the preserved value and continue to Step 3.
|
|
43
|
+
|
|
44
|
+
Otherwise, AskUserQuestion:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Workspace color for this cmux workspace
|
|
48
|
+
|
|
49
|
+
Choose a named color or enter a custom hex value (#RRGGBB).
|
|
50
|
+
|
|
51
|
+
Named colors:
|
|
52
|
+
A) Red B) Crimson C) Orange D) Amber
|
|
53
|
+
E) Olive F) Green G) Teal H) Aqua
|
|
54
|
+
I) Blue J) Navy K) Indigo L) Purple
|
|
55
|
+
M) Magenta N) Rose O) Brown P) Charcoal
|
|
56
|
+
Q) Custom hex — enter a value in the format #RRGGBB
|
|
57
|
+
|
|
58
|
+
Enter a letter (A-Q) or type a custom hex value directly:
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Validate the input:
|
|
62
|
+
- If a letter A-P: map to the corresponding color name (e.g. "A" → "Red").
|
|
63
|
+
- If "Q": prompt the user to type a custom hex value, then validate the typed value
|
|
64
|
+
against `^#[0-9A-Fa-f]{6}$`. If invalid, re-prompt once with an error. Never pass the
|
|
65
|
+
bare letter "Q" to set-color.
|
|
66
|
+
- If the raw input itself already looks like a hex value: validate it against
|
|
67
|
+
`^#[0-9A-Fa-f]{6}$` and accept on match.
|
|
68
|
+
- Empty input with no existing color: use no color (leave `workspace_color` as `null`).
|
|
69
|
+
|
|
70
|
+
Set `NEW_COLOR` to the chosen color name / hex, or `null` if skipped.
|
|
71
|
+
|
|
72
|
+
## Step 3 — Ask for auto_status and auto_dev_server toggles
|
|
73
|
+
|
|
74
|
+
**Idempotency gate**: skip questions for fields that are already set (non-empty in
|
|
75
|
+
existing config) when `force_mode = false`.
|
|
76
|
+
|
|
77
|
+
For each unset field (or all fields when `force_mode = true`), AskUserQuestion:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
cmux integration toggles
|
|
81
|
+
|
|
82
|
+
auto_status: automatically run `cmux status` in this workspace on session start?
|
|
83
|
+
(default: on)
|
|
84
|
+
A) On
|
|
85
|
+
B) Off
|
|
86
|
+
|
|
87
|
+
auto_dev_server: automatically start the dev server via cmux on session start?
|
|
88
|
+
(default: on)
|
|
89
|
+
A) On
|
|
90
|
+
B) Off
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Ask both in a single question when both are unset. Set `NEW_AUTO_STATUS` and
|
|
94
|
+
`NEW_AUTO_DEV` to `true` or `false` based on the answers.
|
|
95
|
+
|
|
96
|
+
## Step 4 — Write .codebyplan/cmux.json
|
|
97
|
+
|
|
98
|
+
Build the updated payload using jq deep-merge so sibling fields added by future
|
|
99
|
+
schema versions are preserved. Assemble variables first.
|
|
100
|
+
|
|
101
|
+
Backfill any field that the Step 2/3 idempotency gates skipped, so each `jq
|
|
102
|
+
--argjson` always receives valid JSON — an empty shell variable makes `jq` exit 1,
|
|
103
|
+
which would leave `NEW_PAYLOAD` empty and silently no-op the write. Fall back to the
|
|
104
|
+
existing value, then to the default (`true` for the toggles):
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
NEW_COLOR="${NEW_COLOR:-$EXISTING_COLOR}"
|
|
108
|
+
NEW_AUTO_STATUS="${NEW_AUTO_STATUS:-${EXISTING_AUTO_STATUS:-true}}"
|
|
109
|
+
NEW_AUTO_DEV="${NEW_AUTO_DEV:-${EXISTING_AUTO_DEV:-true}}"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
NEW_COLOR_JSON=$(echo "$NEW_COLOR" | jq -R 'if . == "null" or . == "" then null else . end')
|
|
114
|
+
NEW_PAYLOAD=$(jq -n \
|
|
115
|
+
--argjson color "$NEW_COLOR_JSON" \
|
|
116
|
+
--argjson auto_status "$NEW_AUTO_STATUS" \
|
|
117
|
+
--argjson auto_dev_server "$NEW_AUTO_DEV" \
|
|
118
|
+
'{workspace_color: $color, auto_status: $auto_status, auto_dev_server: $auto_dev_server}')
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Atomic write via jq tmp+mv deep-merge (`. * $new` deep-merges, preserving any
|
|
122
|
+
sibling keys not in the new payload):
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
jq --argjson new "$NEW_PAYLOAD" '. * $new' \
|
|
126
|
+
.codebyplan/cmux.json > .codebyplan/cmux.json.tmp \
|
|
127
|
+
&& mv .codebyplan/cmux.json.tmp .codebyplan/cmux.json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Step 5 — Apply color immediately
|
|
131
|
+
|
|
132
|
+
If `NEW_COLOR` is a non-empty, non-null string AND cmux is available in the current
|
|
133
|
+
environment (`$CMUX_WORKSPACE_ID` is set), apply the color immediately so the change
|
|
134
|
+
is visible without needing to restart the session:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
if [ -n "$CMUX_WORKSPACE_ID" ] && [ -n "$NEW_COLOR" ] && [ "$NEW_COLOR" != "null" ]; then
|
|
138
|
+
CMUX_BIN="${CMUX_BUNDLED_CLI_PATH:-${CMUX_CLAUDE_HOOK_CMUX_BIN:-cmux}}"
|
|
139
|
+
"$CMUX_BIN" workspace-action --action set-color --color "$NEW_COLOR" 2>/dev/null || true
|
|
140
|
+
fi
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The guard (`2>/dev/null || true`) ensures a missing or non-zero cmux never blocks
|
|
144
|
+
the skill — applying the color is best-effort.
|
|
145
|
+
|
|
146
|
+
## Step 6 — Verify and report
|
|
147
|
+
|
|
148
|
+
Re-read `.codebyplan/cmux.json` and emit a summary:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
cmux Setup — Complete
|
|
152
|
+
|
|
153
|
+
workspace_color : <value or "(none)">
|
|
154
|
+
auto_status : <true|false>
|
|
155
|
+
auto_dev_server : <true|false>
|
|
156
|
+
|
|
157
|
+
Config written to .codebyplan/cmux.json
|
|
158
|
+
|
|
159
|
+
Next: on the next SessionStart, codebyplan cmux-sync will apply the color
|
|
160
|
+
automatically. Run `/cbp-setup-cmux --force` at any time to reconfigure.
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Key Rules
|
|
164
|
+
|
|
165
|
+
- Atomic write (tmp + mv) — never leaves cmux.json in a partial state
|
|
166
|
+
- Deep-merge with `. * $new` — sibling keys from future schema versions are preserved
|
|
167
|
+
- Color apply is best-effort — a missing cmux binary never causes an error
|
|
168
|
+
- `auto_status` and `auto_dev_server` default to `true` when absent (documented in
|
|
169
|
+
`packages/codebyplan-package/src/lib/types.ts` CmuxConfig)
|
|
170
|
+
- cmux.json is COMMITTED (not gitignored) — workspace color is shared across team members
|
|
@@ -138,6 +138,20 @@ Skip the push only when nothing was committed in Step 5 AND `/cbp-merge-main` re
|
|
|
138
138
|
|
|
139
139
|
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.)
|
|
140
140
|
|
|
141
|
+
### Step 7.3: Push cmux Status (task done + progress)
|
|
142
|
+
|
|
143
|
+
Push completion status and checkpoint progress to the cmux workspace sidebar. Self-no-ops outside cmux or when `auto_status` is disabled.
|
|
144
|
+
|
|
145
|
+
Compute progress from the `get_tasks` data already loaded by the routing step: `completed = count of tasks with status 'completed'`, `total = total task count for the checkpoint`. For standalone tasks (no checkpoint), omit `--progress`.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Checkpoint-bound task:
|
|
149
|
+
npx codebyplan cmux-status --task "TASK-{N}: {task-title} done" --progress {completed}/{total}
|
|
150
|
+
|
|
151
|
+
# Standalone task:
|
|
152
|
+
npx codebyplan cmux-status --task "TASK-{N}: {task-title} done"
|
|
153
|
+
```
|
|
154
|
+
|
|
141
155
|
### Step 8: Run Cleanup + Migration (inline)
|
|
142
156
|
|
|
143
157
|
Apply the `cleanup` skill inline to remove orphan references to deleted/modified files. Then apply `migration` to propagate renames/moves to consumers. Both run without sub-agent spawns. Skip cleanup if no deletions/modifications; skip migration if cleanup handled everything.
|
|
@@ -228,6 +228,14 @@ Display context summary:
|
|
|
228
228
|
- **Previous rounds**: [count] completed
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
+
### Step 4.5: Push cmux Status
|
|
232
|
+
|
|
233
|
+
Push the active checkpoint and task context to the cmux workspace sidebar. Self-no-ops outside cmux or when `auto_status` is disabled in `.codebyplan/cmux.json`.
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
npx codebyplan cmux-status --checkpoint "CHK-{NNN}: {checkpoint-title}" --task "TASK-{N}: {task-title}"
|
|
237
|
+
```
|
|
238
|
+
|
|
231
239
|
### Step 5: Set Task Status
|
|
232
240
|
|
|
233
241
|
Use MCP `update_task(task_id, status: "in_progress")`.
|