diff --git a/README.md b/README.md index d5389bc..1aa6af5 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/commands/code-review.toml b/commands/code-review.toml index 9c71df8..1836f90 100644 --- a/commands/code-review.toml +++ b/commands/code-review.toml @@ -1,7 +1,10 @@ -description = "Reviews the code changes on your current branch" +description = "Reviews branch or uncommitted code changes" prompt = """ - **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.