claude-plugin-viban 1.2.0 → 1.2.1
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.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Assign and resolve multiple independent backlog issues in parallel using git worktrees and coordinated agents"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Run `/viban:parallel-assign` to process multiple backlog issues simultaneously.
|
|
6
|
+
|
|
7
|
+
Usage: `/viban:parallel-assign [count]`
|
|
8
|
+
|
|
9
|
+
- `count`: Number of issues to process in parallel (default: 3, max: 5)
|
|
10
|
+
|
|
11
|
+
Examples:
|
|
12
|
+
- `/viban:parallel-assign` — resolve up to 3 backlog issues in parallel
|
|
13
|
+
- `/viban:parallel-assign 5` — resolve up to 5 backlog issues in parallel
|
|
14
|
+
|
|
15
|
+
Each issue gets its own opus agent working in an isolated git worktree. After all agents finish, PRs are created, local branches are preserved, and worktrees are cleaned up.
|
package/package.json
CHANGED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parallel-assign
|
|
3
|
+
description: "Assign and resolve multiple independent backlog issues in parallel using git worktrees and coordinated agents"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /parallel-assign
|
|
7
|
+
|
|
8
|
+
Parallel resolution of independent backlog issues via git worktrees.
|
|
9
|
+
|
|
10
|
+
> **CLI only** (no direct viban.json access) | **Opus sub-agents** in isolated worktrees
|
|
11
|
+
|
|
12
|
+
**Input**: `$ARGUMENTS` (optional: number of issues, default 3)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Phase 0: SETUP
|
|
17
|
+
|
|
18
|
+
### 0.1 Read Workflow
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
[ -f ".viban/workflow.md" ] && cat ".viban/workflow.md"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Fallback to CLAUDE.md, then default. Same as `/viban:assign` Phase 0.1.
|
|
25
|
+
|
|
26
|
+
### 0.2 Parse Arguments
|
|
27
|
+
|
|
28
|
+
Extract count from `$ARGUMENTS`:
|
|
29
|
+
- Number provided (e.g. `/viban:parallel-assign 5`) → use that number
|
|
30
|
+
- No number → default to 3
|
|
31
|
+
- Maximum: 5
|
|
32
|
+
|
|
33
|
+
### 0.3 Check Backlog & Git State
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
viban list
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Count available backlog issues. Adjust N down if fewer available.
|
|
40
|
+
If backlog is empty: notify user and exit.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
[ -n "$(git status --porcelain)" ] && echo "Warning: Uncommitted changes"
|
|
44
|
+
git checkout main && git fetch origin main && git reset --hard origin/main
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 0.4 Assign Issues
|
|
48
|
+
|
|
49
|
+
Assign N issues, each with a unique session ID. Determine branch names per workflow convention:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ISSUES=() # Array of "ID|BRANCH" pairs
|
|
53
|
+
for i in $(seq 1 $N); do
|
|
54
|
+
SESSION=$(echo "${RANDOM}${i}" | md5 | head -c 8)
|
|
55
|
+
ID=$(viban assign "$SESSION" 2>&1 | tail -1)
|
|
56
|
+
[[ -z "$ID" || "$ID" == "No backlog" ]] && break
|
|
57
|
+
|
|
58
|
+
# Determine branch name (same logic as /viban:assign Phase 0.3)
|
|
59
|
+
ISSUE_JSON=$(viban get "$ID")
|
|
60
|
+
EXT_ID=$(echo "$ISSUE_JSON" | jq -r '.external_id // ""')
|
|
61
|
+
if [ -n "$EXT_ID" ] && [ "$EXT_ID" != "null" ]; then
|
|
62
|
+
EXTERNAL_NUM="${EXT_ID##*:}"
|
|
63
|
+
TITLE=$(echo "$ISSUE_JSON" | jq -r '.title' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | head -c 40)
|
|
64
|
+
BRANCH="issue-${EXTERNAL_NUM}-${TITLE}"
|
|
65
|
+
else
|
|
66
|
+
BRANCH="issue-${ID}"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
ISSUES+=("${ID}|${BRANCH}")
|
|
70
|
+
done
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If no issues were assigned: notify user and exit.
|
|
74
|
+
|
|
75
|
+
### 0.5 Create Worktrees
|
|
76
|
+
|
|
77
|
+
For each assigned issue, create an isolated git worktree:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
81
|
+
mkdir -p "$REPO_ROOT/.viban/worktrees"
|
|
82
|
+
|
|
83
|
+
for entry in "${ISSUES[@]}"; do
|
|
84
|
+
ID="${entry%%|*}"
|
|
85
|
+
BRANCH="${entry##*|}"
|
|
86
|
+
WT_DIR="$REPO_ROOT/.viban/worktrees/$BRANCH"
|
|
87
|
+
|
|
88
|
+
git worktree add -b "$BRANCH" "$WT_DIR" origin/main
|
|
89
|
+
done
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 0.6 Sync Status
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
viban sync --push-only
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Phase 1: DISPATCH PARALLEL AGENTS
|
|
101
|
+
|
|
102
|
+
Spawn one **opus** agent per issue using `Task` tool. All agents launch in a single message with `run_in_background: true`.
|
|
103
|
+
|
|
104
|
+
**Agent prompt template** (per issue):
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
You are resolving viban issue #{ID} in an isolated git worktree.
|
|
108
|
+
|
|
109
|
+
## Environment
|
|
110
|
+
- Worktree path: {REPO_ROOT}/.viban/worktrees/{BRANCH}
|
|
111
|
+
- Branch: {BRANCH}
|
|
112
|
+
- Main repo: {REPO_ROOT}
|
|
113
|
+
- ALL file operations must happen inside the worktree path
|
|
114
|
+
|
|
115
|
+
## Workflow
|
|
116
|
+
{paste workflow.md content}
|
|
117
|
+
|
|
118
|
+
## Issue Details
|
|
119
|
+
{paste viban get output}
|
|
120
|
+
|
|
121
|
+
## Plan (if available)
|
|
122
|
+
{paste .viban/plans/{ID}.md content, or "No plan available"}
|
|
123
|
+
|
|
124
|
+
## Instructions
|
|
125
|
+
|
|
126
|
+
You are one of {N} parallel agents working in isolated git worktrees.
|
|
127
|
+
|
|
128
|
+
1. Work ONLY inside your worktree: {REPO_ROOT}/.viban/worktrees/{BRANCH}
|
|
129
|
+
- cd to the worktree before any work
|
|
130
|
+
- All reads, edits, and writes must target files under this path
|
|
131
|
+
|
|
132
|
+
2. Follow the project workflow phases:
|
|
133
|
+
- Analyze: understand the issue, locate code, identify root cause
|
|
134
|
+
- Implement: make focused changes following project conventions
|
|
135
|
+
- Verify: manual verification of the fix
|
|
136
|
+
|
|
137
|
+
3. After implementation, commit on your branch:
|
|
138
|
+
```bash
|
|
139
|
+
cd {REPO_ROOT}/.viban/worktrees/{BRANCH}
|
|
140
|
+
git add <specific files>
|
|
141
|
+
git commit -m "type: description
|
|
142
|
+
|
|
143
|
+
- Root cause: ...
|
|
144
|
+
- Solution: ...
|
|
145
|
+
|
|
146
|
+
Resolves: #{ID}"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
4. Push and create PR:
|
|
150
|
+
```bash
|
|
151
|
+
git push -u origin {BRANCH}
|
|
152
|
+
gh pr create --title "type: title" --body "..." --base main
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
5. Move issue to review:
|
|
156
|
+
```bash
|
|
157
|
+
cd {REPO_ROOT}
|
|
158
|
+
viban review {ID}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
CRITICAL:
|
|
162
|
+
- Always run `viban review {ID}` before finishing, even on errors.
|
|
163
|
+
- Do NOT run the full test suite — the coordinator handles that.
|
|
164
|
+
- Do NOT remove the worktree — the coordinator handles cleanup.
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Dispatch Pattern
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
# Pseudo-code for the dispatch
|
|
171
|
+
for each (ID, BRANCH) in ISSUES:
|
|
172
|
+
Task(
|
|
173
|
+
subagent_type="general-purpose",
|
|
174
|
+
model="opus",
|
|
175
|
+
run_in_background=True,
|
|
176
|
+
prompt=filled_template(ID, BRANCH, workflow, issue_json, plan)
|
|
177
|
+
)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Phase 2: MONITOR & COLLECT
|
|
183
|
+
|
|
184
|
+
1. Wait for all background agents to complete (poll via `TaskOutput`)
|
|
185
|
+
2. Collect results — note successes and failures
|
|
186
|
+
3. For any issue where `viban review` was not called, run it now as safety net:
|
|
187
|
+
```bash
|
|
188
|
+
viban review $ID
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Phase 3: TRANSPLANT & CLEANUP
|
|
194
|
+
|
|
195
|
+
After all agents finish, for each issue:
|
|
196
|
+
|
|
197
|
+
### 3.1 Verify Local Branches
|
|
198
|
+
|
|
199
|
+
The local branch already exists (created by `git worktree add -b`). After worktree removal, the branch and its commits remain in the local repo.
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
203
|
+
cd "$REPO_ROOT"
|
|
204
|
+
|
|
205
|
+
for entry in "${ISSUES[@]}"; do
|
|
206
|
+
BRANCH="${entry##*|}"
|
|
207
|
+
git log --oneline -3 "$BRANCH"
|
|
208
|
+
done
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 3.2 Remove Worktrees
|
|
212
|
+
|
|
213
|
+
PRs have been created — worktrees are no longer needed:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
for entry in "${ISSUES[@]}"; do
|
|
217
|
+
BRANCH="${entry##*|}"
|
|
218
|
+
WT_DIR="$REPO_ROOT/.viban/worktrees/$BRANCH"
|
|
219
|
+
git worktree remove "$WT_DIR" --force
|
|
220
|
+
done
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 3.3 Verify PRs Exist
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
for entry in "${ISSUES[@]}"; do
|
|
227
|
+
BRANCH="${entry##*|}"
|
|
228
|
+
gh pr list --head "$BRANCH" --json number,title,url -q '.[0]'
|
|
229
|
+
done
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Phase 4: TEST & REPORT
|
|
235
|
+
|
|
236
|
+
### 4.1 Run Tests
|
|
237
|
+
|
|
238
|
+
Run the full test suite once on main (not per-agent):
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
zsh tests/run_all.zsh
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
If tests fail: identify which agent's changes caused the failure and report.
|
|
245
|
+
|
|
246
|
+
### 4.2 Sync
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
viban sync --push-only
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 4.3 Report
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
Parallel Resolution Complete
|
|
256
|
+
|
|
257
|
+
| Issue | Title | Branch | PR | Status |
|
|
258
|
+
|-------|-------|--------|----|--------|
|
|
259
|
+
| #ID | ... | ... | #N | review |
|
|
260
|
+
|
|
261
|
+
Total: N issues processed
|
|
262
|
+
Succeeded: X
|
|
263
|
+
Failed: Y
|
|
264
|
+
|
|
265
|
+
Local branches available:
|
|
266
|
+
- {BRANCH_1}
|
|
267
|
+
- {BRANCH_2}
|
|
268
|
+
...
|
|
269
|
+
|
|
270
|
+
Worktrees cleaned up. All PRs ready for human review.
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Error Handling
|
|
276
|
+
|
|
277
|
+
- **Agent fails mid-work**: coordinator calls `viban review {ID}` as safety net
|
|
278
|
+
- **Worktree creation fails**: skip that issue, log error, continue with others
|
|
279
|
+
- **PR creation fails in agent**: coordinator reports it; local branch still available for manual PR
|
|
280
|
+
- **Test failures**: report which branch likely caused the failure
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## CRITICAL RULES
|
|
285
|
+
|
|
286
|
+
> 1. **NEVER exit with any issue still in `in_progress`.** For every assigned issue, ensure `viban review {ID}` has been called.
|
|
287
|
+
> 2. **ALWAYS clean up worktrees** after PRs are created. Worktree dirs must not linger in `.viban/worktrees/`.
|
|
288
|
+
|
|
289
|
+
## CLI Reference
|
|
290
|
+
|
|
291
|
+
| Command | Description |
|
|
292
|
+
|---------|-------------|
|
|
293
|
+
| `viban list` | Print board |
|
|
294
|
+
| `viban assign [session]` | Assign issue |
|
|
295
|
+
| `viban get <id>` | View issue |
|
|
296
|
+
| `viban review <id>` | Move to review |
|
|
297
|
+
| `viban sync --push-only` | Sync to GitHub |
|