Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ If you do not yet have Gemini CLI installed, or if the installed version is olde

The Code Review extension adds the `/code-review` command to Gemini CLI which analyzes code changes on your current branch for quality issues.

By default, it compares against the merge base with `origin/HEAD`. To review only uncommitted changes, request that scope explicitly:

```text
/code-review my uncommitted changes
```

This reviews staged and unstaged changes to tracked files against `HEAD`, excluding changes already committed on the branch. Untracked files must be added to Git first to appear in the diff.

### Reviewing a pull request

The Code Review extension adds the `/pr-code-review` command to Gemini CLI which analyzes code changes on your pull request for quality issues.
Expand Down
7 changes: 5 additions & 2 deletions commands/code-review.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
description = "Reviews the code changes on your current branch"
description = "Reviews branch or uncommitted code changes"
prompt = """
<CONTEXT>
**Code Changes**: call the `git diff -U5 --merge-base origin/HEAD` tool to retrieve the changes.
**User Request**: {{args}}
**Code Changes**: Select the diff based on the user's requested scope:
- If the user explicitly asks to review local, uncommitted, or working-tree changes, run `git diff -U5 HEAD`. This includes staged and unstaged changes to tracked files without including changes already committed on the branch.
- For branch or PR changes, or when no scope is specified, run `git diff -U5 --merge-base origin/HEAD` to preserve the default branch comparison.
</CONTEXT>

<PROTOCOL>
Expand Down