|
1 | | -Review the pull request: $ARGUMENTS |
2 | | - |
3 | | -Follow these steps carefully. Use the `gh` CLI for all GitHub interactions. |
4 | | - |
5 | | -## Step 1: Resolve the PR |
6 | | - |
7 | | -Parse `$ARGUMENTS` to determine the PR. It can be: |
8 | | - |
9 | | -- A full URL like `https://github.com/owner/repo/pull/123` |
10 | | -- A `owner/repo#123` reference |
11 | | -- A bare number like `123` (use the current repo) |
12 | | -- A description — search for it with `gh pr list --search "<description>" --limit 5` and pick the best match |
13 | | - |
14 | | -Once resolved, fetch the PR metadata: |
15 | | - |
16 | | -```bash |
17 | | -gh pr view <PR> --json number,title,body,author,state,baseRefName,headRefName,url,labels,milestone,additions,deletions,changedFiles,createdAt,updatedAt,mergedAt,reviewDecision,reviews,assignees |
18 | | -``` |
19 | | - |
20 | | -## Step 2: Gather the diff |
21 | | - |
22 | | -Get the full diff of the PR: |
23 | | - |
24 | | -```bash |
25 | | -gh pr diff <PR> |
26 | | -``` |
27 | | - |
28 | | -If the diff is very large (>3000 lines), focus on the most important files first and summarize the rest. |
29 | | - |
30 | | -## Step 3: Collect PR discussion context |
31 | | - |
32 | | -Fetch all comments and review threads: |
33 | | - |
34 | | -```bash |
35 | | -gh api repos/{owner}/{repo}/pulls/{number}/comments --paginate |
36 | | -gh api repos/{owner}/{repo}/issues/{number}/comments --paginate |
37 | | -gh api repos/{owner}/{repo}/pulls/{number}/reviews --paginate |
38 | | -``` |
39 | | - |
40 | | -Pay attention to: |
41 | | - |
42 | | -- Reviewer feedback and requested changes |
43 | | -- Author responses and explanations |
44 | | -- Any unresolved conversations |
45 | | -- Approval or rejection status |
46 | | - |
47 | | -## Step 4: Find and read linked issues |
48 | | - |
49 | | -Look for issue references in: |
50 | | - |
51 | | -- The PR body (patterns like `#123`, `fixes #123`, `closes #123`, `resolves #123`) |
52 | | -- The PR branch name (patterns like `issue-123`, `fix/123`) |
53 | | -- Commit messages |
54 | | - |
55 | | -For each linked issue, fetch its content: |
56 | | - |
57 | | -```bash |
58 | | -gh issue view <number> --json title,body,comments,labels,state |
59 | | -``` |
60 | | - |
61 | | -Read through issue comments to understand the original problem, user reports, and any discussed solutions. |
62 | | - |
63 | | -## Step 5: Analyze and validate |
64 | | - |
65 | | -With all context gathered, analyze the PR critically: |
66 | | - |
67 | | -1. **Intent alignment**: Does the code change actually solve the problem described in the PR and/or linked issues? |
68 | | -2. **Completeness**: Are there aspects of the issue or requested feature that the PR doesn't address? |
69 | | -3. **Scope**: Does the PR include changes unrelated to the stated goal? Are there unnecessary modifications? |
70 | | -4. **Correctness**: Based on the diff, are there obvious bugs, edge cases, or logic errors? |
71 | | -5. **Testing**: Does the PR include tests? Are they meaningful and do they cover the important cases? |
72 | | -6. **Breaking changes**: Could this PR break existing functionality or APIs? |
73 | | -7. **Unresolved feedback**: Are there reviewer comments that haven't been addressed? |
74 | | - |
75 | | -## Step 6: Produce the review summary |
76 | | - |
77 | | -Present the summary in this format: |
78 | | - |
79 | | ---- |
80 | | - |
81 | | -### PR Review: `<title>` (<url>) |
82 | | - |
83 | | -**Author:** <author> | **Status:** <state> | **Review decision:** <decision> |
84 | | -**Base:** `<base>` ← `<head>` | **Changed files:** <n> | **+<additions> / -<deletions>** |
85 | | - |
86 | | -#### Problem |
87 | | - |
88 | | -<1-3 sentences describing what problem this PR is trying to solve, based on the PR description and linked issues> |
89 | | - |
90 | | -#### Solution |
91 | | - |
92 | | -<1-3 sentences describing the approach taken in the code> |
93 | | - |
94 | | -#### Key changes |
95 | | - |
96 | | -<Bulleted list of the most important changes, grouped by theme. Include file paths.> |
97 | | - |
98 | | -#### Linked issues |
99 | | - |
100 | | -<List of linked issues with their title, state, and a one-line summary of the discussion> |
101 | | - |
102 | | -#### Discussion highlights |
103 | | - |
104 | | -<Summary of important comments from reviewers and the author. Flag any unresolved threads.> |
105 | | - |
106 | | -#### Concerns |
107 | | - |
108 | | -<List any issues found during validation: bugs, missing tests, scope creep, unaddressed feedback, etc. If none, say "No concerns found."> |
109 | | - |
110 | | -#### Verdict |
111 | | - |
112 | | -<One of: APPROVE / REQUEST CHANGES / NEEDS DISCUSSION, with a brief justification> |
113 | | - |
114 | | -#### Suggested action |
115 | | - |
116 | | -<Clear recommendation for the reviewer: what to approve, what to push back on, what to ask about> |
117 | | - |
118 | | ---- |
| 1 | +Review the pull request: $ARGUMENTS |
| 2 | + |
| 3 | +Follow these steps carefully. Use the `gh` CLI for all GitHub interactions. |
| 4 | + |
| 5 | +## Step 1: Resolve the PR |
| 6 | + |
| 7 | +Parse `$ARGUMENTS` to determine the PR. It can be: |
| 8 | + |
| 9 | +- A full URL like `https://github.com/owner/repo/pull/123` |
| 10 | +- A `owner/repo#123` reference |
| 11 | +- A bare number like `123` (use the current repo) |
| 12 | +- A description — search for it with `gh pr list --search "<description>" --limit 5` and pick the best match |
| 13 | + |
| 14 | +Once resolved, fetch the PR metadata: |
| 15 | + |
| 16 | +```bash |
| 17 | +gh pr view <PR> --json number,title,body,author,state,baseRefName,headRefName,url,labels,milestone,additions,deletions,changedFiles,createdAt,updatedAt,mergedAt,reviewDecision,reviews,assignees |
| 18 | +``` |
| 19 | + |
| 20 | +## Step 2: Gather the diff |
| 21 | + |
| 22 | +Get the full diff of the PR: |
| 23 | + |
| 24 | +```bash |
| 25 | +gh pr diff <PR> |
| 26 | +``` |
| 27 | + |
| 28 | +If the diff is very large (>3000 lines), focus on the most important files first and summarize the rest. |
| 29 | + |
| 30 | +## Step 3: Collect PR discussion context |
| 31 | + |
| 32 | +Fetch all comments and review threads: |
| 33 | + |
| 34 | +```bash |
| 35 | +gh api repos/{owner}/{repo}/pulls/{number}/comments --paginate |
| 36 | +gh api repos/{owner}/{repo}/issues/{number}/comments --paginate |
| 37 | +gh api repos/{owner}/{repo}/pulls/{number}/reviews --paginate |
| 38 | +``` |
| 39 | + |
| 40 | +Pay attention to: |
| 41 | + |
| 42 | +- Reviewer feedback and requested changes |
| 43 | +- Author responses and explanations |
| 44 | +- Any unresolved conversations |
| 45 | +- Approval or rejection status |
| 46 | + |
| 47 | +## Step 4: Find and read linked issues |
| 48 | + |
| 49 | +Look for issue references in: |
| 50 | + |
| 51 | +- The PR body (patterns like `#123`, `fixes #123`, `closes #123`, `resolves #123`) |
| 52 | +- The PR branch name (patterns like `issue-123`, `fix/123`) |
| 53 | +- Commit messages |
| 54 | + |
| 55 | +For each linked issue, fetch its content: |
| 56 | + |
| 57 | +```bash |
| 58 | +gh issue view <number> --json title,body,comments,labels,state |
| 59 | +``` |
| 60 | + |
| 61 | +Read through issue comments to understand the original problem, user reports, and any discussed solutions. |
| 62 | + |
| 63 | +## Step 5: Analyze and validate |
| 64 | + |
| 65 | +With all context gathered, analyze the PR critically: |
| 66 | + |
| 67 | +1. **Intent alignment**: Does the code change actually solve the problem described in the PR and/or linked issues? |
| 68 | +2. **Completeness**: Are there aspects of the issue or requested feature that the PR doesn't address? |
| 69 | +3. **Scope**: Does the PR include changes unrelated to the stated goal? Are there unnecessary modifications? |
| 70 | +4. **Correctness**: Based on the diff, are there obvious bugs, edge cases, or logic errors? |
| 71 | +5. **Testing**: Does the PR include tests? Are they meaningful and do they cover the important cases? |
| 72 | +6. **Breaking changes**: Could this PR break existing functionality or APIs? |
| 73 | +7. **Unresolved feedback**: Are there reviewer comments that haven't been addressed? |
| 74 | + |
| 75 | +## Step 6: Produce the review summary |
| 76 | + |
| 77 | +Present the summary in this format: |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +### PR Review: `<title>` (<url>) |
| 82 | + |
| 83 | +**Author:** <author> | **Status:** <state> | **Review decision:** <decision> |
| 84 | +**Base:** `<base>` ← `<head>` | **Changed files:** <n> | **+<additions> / -<deletions>** |
| 85 | + |
| 86 | +#### Problem |
| 87 | + |
| 88 | +<1-3 sentences describing what problem this PR is trying to solve, based on the PR description and linked issues> |
| 89 | + |
| 90 | +#### Solution |
| 91 | + |
| 92 | +<1-3 sentences describing the approach taken in the code> |
| 93 | + |
| 94 | +#### Key changes |
| 95 | + |
| 96 | +<Bulleted list of the most important changes, grouped by theme. Include file paths.> |
| 97 | + |
| 98 | +#### Linked issues |
| 99 | + |
| 100 | +<List of linked issues with their title, state, and a one-line summary of the discussion> |
| 101 | + |
| 102 | +#### Discussion highlights |
| 103 | + |
| 104 | +<Summary of important comments from reviewers and the author. Flag any unresolved threads.> |
| 105 | + |
| 106 | +#### Concerns |
| 107 | + |
| 108 | +<List any issues found during validation: bugs, missing tests, scope creep, unaddressed feedback, etc. If none, say "No concerns found."> |
| 109 | + |
| 110 | +#### Verdict |
| 111 | + |
| 112 | +<One of: APPROVE / REQUEST CHANGES / NEEDS DISCUSSION, with a brief justification> |
| 113 | + |
| 114 | +#### Suggested action |
| 115 | + |
| 116 | +<Clear recommendation for the reviewer: what to approve, what to push back on, what to ask about> |
| 117 | + |
| 118 | +--- |
0 commit comments