| name | code-review |
| description | Review a pull request for code quality, correctness, and project conventions. Use when the user asks to review a PR, code review, or examine changes on a branch. Accepts a GitHub PR URL, PR number, or local branch name. |
Code Review
Review a pull request diff against this project's conventions and best
practices.
Step 1 — Obtain the diff
The user will provide one of the following:
A) GitHub PR URL
Extract the remote and PR number from the URL.
https://github.com/openshift/lightspeed-console/pull/123 → remote
upstream, PR 123
Then fetch and diff:
git fetch <remote> pull/<number>/head:pr-<number>
git diff <remote>/main...pr-<number>
B) PR number (bare number)
Assume the PR is on upstream (openshift/lightspeed-console).
git fetch upstream pull/<number>/head:pr-<number>
git diff upstream/main...pr-<number>
C) Branch name
The branch already exists locally. Determine its base branch by reading
release-branches.md for the list of branches.
For each branch, compute the merge-base and count the commits between them:
mb=$(git merge-base <branch> <candidate>)
git rev-list --count "$mb"..<branch>
The base branch is whichever candidate has the lowest commit count (fewest
commits between the merge-base and the branch). If counts are tied, prefer
main.
Then diff against the detected base:
git diff <base-branch>...<branch>