125 lines
3.0 KiB
Markdown
125 lines
3.0 KiB
Markdown
---
|
|
name: spawn-pr-fixes
|
|
description: Spawn parallel background agents to address PR review feedback
|
|
model: haiku
|
|
argument-hint: [pr-number...]
|
|
allowed-tools: Bash, Task, Read
|
|
user-invocable: true
|
|
---
|
|
|
|
# Spawn PR Fixes
|
|
|
|
Spawn background agents to address review feedback on multiple PRs in parallel. Each agent works in an isolated git worktree.
|
|
|
|
## Arguments
|
|
|
|
Optional PR numbers separated by spaces: `$ARGUMENTS`
|
|
|
|
- With arguments: `/spawn-pr-fixes 12 15 18` - fix specific PRs
|
|
- Without arguments: `/spawn-pr-fixes` - find and fix all PRs with requested changes
|
|
|
|
## Process
|
|
|
|
### Step 1: Get Repository Info
|
|
|
|
```bash
|
|
REPO_PATH=$(pwd)
|
|
REPO_NAME=$(basename $REPO_PATH)
|
|
```
|
|
|
|
### Step 2: Determine PRs to Fix
|
|
|
|
**If PR numbers provided**: Use those directly
|
|
|
|
**If no arguments**: Find PRs needing work
|
|
```bash
|
|
# List open PRs
|
|
tea pulls --state open
|
|
|
|
# For each PR, check if it has review comments requesting changes
|
|
tea pulls <number> --comments
|
|
```
|
|
|
|
Look for PRs where:
|
|
- Review comments exist that haven't been addressed
|
|
- PR is not approved yet
|
|
- PR is open (not merged/closed)
|
|
|
|
### Step 3: For Each PR
|
|
|
|
1. Fetch PR title using `tea pulls <number>`
|
|
|
|
2. Spawn background agent using Task tool:
|
|
```
|
|
Task tool with:
|
|
- subagent_type: "pr-fixer"
|
|
- run_in_background: true
|
|
- prompt: See agent prompt below
|
|
```
|
|
|
|
### Agent Prompt
|
|
|
|
For each PR, use this prompt:
|
|
|
|
```
|
|
You are a pr-fixer agent. Address review feedback on PR #<NUMBER> autonomously.
|
|
|
|
Context:
|
|
- Repository path: <REPO_PATH>
|
|
- Repository name: <REPO_NAME>
|
|
- PR number: <NUMBER>
|
|
|
|
Instructions from @agents/pr-fixer/agent.md:
|
|
|
|
1. Get PR details and review comments:
|
|
cd <REPO_PATH>
|
|
git fetch origin
|
|
tea pulls <NUMBER> --comments
|
|
|
|
2. Setup worktree from PR branch:
|
|
git worktree add ../<REPO_NAME>-pr-<NUMBER> origin/<branch-name>
|
|
cd ../<REPO_NAME>-pr-<NUMBER>
|
|
git checkout <branch-name>
|
|
|
|
3. Analyze feedback, create todos with TodoWrite
|
|
|
|
4. Address each piece of feedback
|
|
|
|
5. Commit and push:
|
|
git add -A && git commit with message "Address review feedback\n\n...\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
|
|
git push
|
|
|
|
6. Spawn code-reviewer synchronously (NOT in background) to re-review
|
|
|
|
7. If needs more work, fix and re-review (max 3 iterations)
|
|
|
|
8. Cleanup (ALWAYS do this):
|
|
cd <REPO_PATH> && git worktree remove ../<REPO_NAME>-pr-<NUMBER> --force
|
|
|
|
9. Output concise summary (5-10 lines max):
|
|
PR #<NUMBER>: <title>
|
|
Status: <fixed|partial|blocked>
|
|
Feedback addressed: <count> items
|
|
Review: <approved|needs-work|skipped>
|
|
|
|
Work autonomously. Make judgment calls on ambiguous feedback. If blocked, note it in a commit message.
|
|
```
|
|
|
|
### Step 4: Report
|
|
|
|
After spawning all agents, display:
|
|
|
|
```
|
|
Spawned <N> pr-fixer agents:
|
|
|
|
| PR | Title | Status |
|
|
|-----|--------------------------|------------|
|
|
| #12 | Add /commit command | spawned |
|
|
| #15 | Add /pr command | spawned |
|
|
| #18 | Add CI status | spawned |
|
|
|
|
Agents working in background. Monitor with:
|
|
- Check PR list: tea pulls
|
|
- Check worktrees: git worktree list
|
|
```
|