Merge PR #$ARGUMENTS
PR #$ARGUMENTS のマージ処理を行います。
PR Status
!gh pr view $ARGUMENTS --json headRefName,state,mergeable,reviewDecision 2>/dev/null | jq -r '"Branch: \(.headRefName)\nState: \(.state)\nMergeable: \(.mergeable)\nReview: \(.reviewDecision)"' || echo "PR not found"
CI Status
!gh pr checks $ARGUMENTS --json name,state,bucket 2>/dev/null | jq -r '.[] | "\(.state): \(.name)"' | head -5 || echo "No checks"
Worktree Status
!branch=$(gh pr view $ARGUMENTS --json headRefName --jq '.headRefName' 2>/dev/null); dir=$(echo "$branch" | tr '/' '-'); path="/workspaces/search-hub--worktrees/$dir"; if [ -d "$path" ]; then echo "Worktree exists: $path"; else echo "No worktree"; fi
One-Command Merge
Recommended: Use the merge script that handles all edge cases:
./scripts/merge-pr.sh $ARGUMENTS
This script automatically:
- •Waits for CI if still running
- •Merges the PR (squash by default)
- •Switches to main if currently in worktree
- •Kills any agents running in the worktree
- •Removes the worktree (force if locked)
- •Deletes local and remote branches
- •Moves task file to completed (if found)
Options
# Squash merge (default) ./scripts/merge-pr.sh $ARGUMENTS --squash # Regular merge commit ./scripts/merge-pr.sh $ARGUMENTS --merge # Rebase merge ./scripts/merge-pr.sh $ARGUMENTS --rebase # Skip task file management ./scripts/merge-pr.sh $ARGUMENTS --no-task # Preview what would happen ./scripts/merge-pr.sh $ARGUMENTS --dry-run
Batch Merge
For multiple PRs, run sequentially:
./scripts/merge-pr.sh 123 ./scripts/merge-pr.sh 124 ./scripts/merge-pr.sh 125
Or parallel (if no conflicts expected):
./scripts/merge-pr.sh 123 & ./scripts/merge-pr.sh 124 & ./scripts/merge-pr.sh 125 & wait
Post-Merge Tasks
After merge, update ROADMAP if needed:
- •Open
spec/tasks/ROADMAP.md - •Change task status to "Done"
- •Commit:
git add -A && git commit -m "chore(tasks): complete task X" - •Push:
git push
Troubleshooting
"Worktree locked"
The script handles this with --force, but if it still fails:
rm -rf /workspaces/search-hub--worktrees/<branch-dir> git worktree prune
"Branch not fully merged"
Use -D (force delete):
git branch -D <branch-name>
"Cannot delete current branch"
You're still in the worktree. Switch first:
cd /workspaces/search-hub git checkout main
Agent still running in worktree
Kill it first:
./scripts/kill-agent.sh <pane-id>