name: oxgh:merge-or-fix description: Wait for AI code review on a PR — auto-merge if clean, fix issues if not
Context
First, run these commands and review their output:
- Git remote:
git remote get-url origin
Your Task
- Get PR number: Use
$ARGUMENTSif provided, otherwise detect from current branch withgh pr view --json number --jq '.number' - Checkout PR branch: Run
gh pr checkout <PR_NUMBER>to ensure you're on the PR's branch (safe to run even if already on the branch) - Wait for AI review: Run
python3 scripts/wait_for_ai_review.py <PR_NUMBER>(use 45 minute timeout) - Read all PR comments: Parse the owner/repo from the git remote above, then run
gh api repos/{owner}/{repo}/issues/<PR_NUMBER>/comments - Analyze and respond:
- If there are findings: identify the highest priority review comment only. Investigate the codebase to understand that specific issue, then immediately create an implementation plan to fix it using TDD. Do NOT ask the user whether they want to fix the issue - assume they do. Write the full plan directly. Ignore lower priority comments for now.
- If no findings: auto-merge by running exactly
gh pr merge --auto(no other flags)