greplooplisted
Install: claude install-skill Bboyfarouk/skills
# Greploop
Iteratively fix a PR until Greptile gives a perfect review: 5/5 confidence, zero unresolved comments.
## Inputs
- **PR number** (optional): If not provided, detect the PR for the current branch.
## Instructions
### 1. Identify the PR
```bash
gh pr view --json number,headRefName -q '{number: .number, branch: .headRefName}'
```
Switch to the PR branch if not already on it.
### 2. Loop
Repeat the following cycle. **Max 5 iterations** to avoid runaway loops.
#### A. Trigger Greptile review
Push the latest changes (if any) and wait for Greptile's review check to appear:
```bash
git push
```
Then poll for the Greptile check to complete:
```bash
gh pr checks <PR_NUMBER> --watch
```
#### B. Fetch Greptile review results
Get the latest review from Greptile:
```bash
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews
```
Look for the most recent review from `greptile-apps[bot]` or `greptile-apps-staging[bot]`.
Parse the review body for:
- **Confidence score**: Greptile includes a score like `3/5` or `5/5` in its review summary.
- **Comment count**: Number of inline review comments.
Also fetch all unresolved inline comments:
```bash
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments
```
Filter to comments from Greptile that are on the latest commit.
#### C. Check exit conditions
Stop the loop if **any** of these are true:
- Confidence score is **5/5** AND there are **zero unresolved comments**
- Max iterations reached (report current state)
###