Skip to content

Add script to speed up reviewing PRs adding a worktree.#21748

Merged
jacob314 merged 1 commit intomainfrom
review_script
Mar 9, 2026
Merged

Add script to speed up reviewing PRs adding a worktree.#21748
jacob314 merged 1 commit intomainfrom
review_script

Conversation

@jacob314
Copy link
Contributor

@jacob314 jacob314 commented Mar 9, 2026

Summary

This script speeds up queuing manual review of PRs giving you a git worktree with the PR checked out locally and the review script run.

Run
scripts/review.sh <PR#>
to test

Verify that you have a new worktree with the pr running locally and the /review-frontend script auto-started using the pro model.

Fixes #21757

@jacob314 jacob314 requested a review from a team as a code owner March 9, 2026 18:56
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Mar 9, 2026

Hi @jacob314, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the developer experience for reviewing pull requests by introducing an automated helper script. This script streamlines the process of checking out a PR into a dedicated Git worktree, installing dependencies, building the project, and launching the automated review tool, thereby reducing manual setup time and promoting consistent review practices.

Highlights

  • Automated PR Review Setup: Introduced a new review.sh helper script to automate the setup and execution of the PR review tool, significantly streamlining the review process.
  • Updated Contribution Guidelines: The CONTRIBUTING.md documentation was updated to recommend the new helper script for PR authors and reviewers, providing clear instructions for its usage and model selection.
  • Git Worktree Integration: The new script leverages Git worktrees to automatically create isolated environments for reviewing pull requests, ensuring a clean and efficient setup without affecting the main repository clone.
Changelog
  • CONTRIBUTING.md
    • Updated the section on using the automated review tool to include a new recommended helper script.
    • Added instructions for running the review.sh script with optional model selection (gemini-3.1-pro-preview or gemini-3-flash-preview).
    • Clarified the roles of authors and reviewers in using the tool, encouraging authors to self-review.
  • scripts/review.sh
    • Added a new executable shell script that automates the entire PR review setup process.
    • Implemented logic for validating PR numbers, opening PRs in a browser, managing Git worktrees, cleaning and installing npm dependencies, building the project, and running the review-frontend command.
    • Included robust error handling for PR validation, directory existence, build failures, and temporary file creation.
Activity
  • No specific review comments or activity have been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Size Change: -4 B (0%)

Total Size: 26 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.6 MB -4 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@jacob314 jacob314 enabled auto-merge March 9, 2026 19:00
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Mar 9, 2026

Hi there! Thank you for your contribution to Gemini CLI.

To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md.

This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding Fixes #123 or Related to #123), it will be automatically reopened.

How to link an issue:
Add a keyword followed by the issue number (e.g., Fixes #123) in the description of your pull request. For more details on supported keywords and how linking works, please refer to the GitHub Documentation on linking pull requests to issues.

Thank you for your understanding and for being a part of our community!

@gemini-cli gemini-cli bot closed this Mar 9, 2026
auto-merge was automatically disabled March 9, 2026 19:00

Pull request was closed

@scidomino scidomino reopened this Mar 9, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new script, scripts/review.sh, to streamline the process of reviewing pull requests by automating the setup of a worktree. The CONTRIBUTING.md file is also updated to document this new script.

My review focuses on improving the maintainability and robustness of the new script. I've suggested using the project's existing npm run clean script instead of manually deleting directories, which will make the script more resilient to future changes in the project structure.

Comment on lines +77 to +81
echo "review: Clearing possibly stale node_modules..."
rm -rf node_modules
rm -rf packages/core/dist/
rm -rf packages/cli/node_modules/
rm -rf packages/core/node_modules/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The script manually removes build artifacts and dependencies. This can be brittle and hard to maintain. For instance, if a new package with a build output directory is added, this script would need to be updated.

The project already provides a dedicated clean script (npm run clean) for this purpose. It's better to use this script as it's the single source of truth for cleaning the project. This will make the review script more robust and maintainable.

Suggested change
echo "review: Clearing possibly stale node_modules..."
rm -rf node_modules
rm -rf packages/core/dist/
rm -rf packages/cli/node_modules/
rm -rf packages/core/node_modules/
echo "review: Cleaning the project..."
npm run clean
References
  1. Rely on project conventions to simplify code, instead of engineering for theoretical edge cases that the conventions are designed to prevent.

exit 1
fi
pr="$1"
model="${2:-gemini-3.1-pro-preview}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels weird to hardcode gemini 3.1

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Mar 9, 2026
@jacob314 jacob314 enabled auto-merge March 9, 2026 19:12
@jacob314 jacob314 added this pull request to the merge queue Mar 9, 2026
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Mar 9, 2026

Hi there! Thank you for your contribution to Gemini CLI.

To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md.

This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding Fixes #123 or Related to #123), it will be automatically reopened.

How to link an issue:
Add a keyword followed by the issue number (e.g., Fixes #123) in the description of your pull request. For more details on supported keywords and how linking works, please refer to the GitHub Documentation on linking pull requests to issues.

Thank you for your understanding and for being a part of our community!

@gemini-cli gemini-cli bot closed this Mar 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a manual request Mar 9, 2026
@jacob314 jacob314 reopened this Mar 9, 2026
@jacob314 jacob314 enabled auto-merge March 9, 2026 19:29
@jacob314 jacob314 added this pull request to the merge queue Mar 9, 2026
@gemini-cli gemini-cli bot added area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt and removed status/need-issue Pull requests that need to have an associated issue. labels Mar 9, 2026
Merged via the queue into main with commit 9fc03a0 Mar 9, 2026
75 of 81 checks passed
@jacob314 jacob314 deleted the review_script branch March 9, 2026 20:18
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add script to simplify code reviews

2 participants