Skip to content

feat(cli): add gemini update command#24080

Open
gvenugo3 wants to merge 1 commit intogoogle-gemini:mainfrom
gvenugo3:feat/gemini-update-command
Open

feat(cli): add gemini update command#24080
gvenugo3 wants to merge 1 commit intogoogle-gemini:mainfrom
gvenugo3:feat/gemini-update-command

Conversation

@gvenugo3
Copy link
Copy Markdown

Summary

Implement a new gemini update command that checks for and installs newer versions of the CLI while preserving the current release channel (stable, preview, or nightly).

Features

  • Check for updates - Queries npm registry for latest version
  • Preserve release channel - Maintains current channel (stable/preview/nightly) during update
  • Multi-package manager support - Works with npm, yarn, pnpm, bun, and homebrew
  • Graceful fallback - Informative messages for unsupported installation methods
  • Dual interface - Available as both:
    • CLI command: gemini update
    • Slash command: /update (in interactive mode)
  • Comprehensive testing - 13 unit tests with full coverage

Implementation Details

  • Core update logic in performUpdate.ts (200 LOC)
  • Reuses existing infrastructure:
    • Installation detection (getInstallationInfo)
    • Version checking logic
    • Package manager integration
  • Proper TypeScript typing with union types for update results
  • All linting and pre-commit checks passing

Test Results

✅ 13/13 unit tests passing
✅ Zero TypeScript errors
✅ ESLint: 0 warnings, 0 errors

Files Changed

  • packages/cli/src/commands/update.ts - Yargs CLI command
  • packages/cli/src/ui/commands/updateCommand.ts - Slash command
  • packages/cli/src/utils/performUpdate.ts - Core update logic
  • packages/cli/src/utils/performUpdate.test.ts - Unit tests
  • packages/cli/src/config/config.ts - Command registration
  • packages/cli/src/services/BuiltinCommandLoader.ts - Slash command registration
  • packages/cli/package.json - Added semver dependency

Resolves #16122

@gvenugo3 gvenugo3 requested review from a team as code owners March 28, 2026 02:49
@gemini-code-assist
Copy link
Copy Markdown
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 introduces a manual update mechanism for the Gemini CLI, enabling users to proactively manage their installation version. By providing both a CLI command and an interactive slash command, it improves the developer experience for maintaining the tool across various package managers and environments.

Highlights

  • New Update Command: Implemented a new gemini update CLI command and /update slash command to allow users to manually check for and install CLI updates.
  • Cross-Platform Support: Added support for multiple package managers including npm, yarn, pnpm, bun, and Homebrew, ensuring the correct release channel is preserved.
  • Robust Update Logic: Introduced core update logic in performUpdate.ts that runs in the foreground, provides structured feedback, and includes comprehensive unit tests.
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.

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.

Copy link
Copy Markdown
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 update command to the Gemini CLI, allowing users to check for and install the latest version directly from the terminal. The implementation includes a core performUpdate utility that handles different package managers (npm, yarn, pnpm, bun, homebrew) and provides feedback through both the standard CLI and the interactive UI. Comprehensive unit tests have been added to verify the update logic across various environments and failure scenarios. The review feedback correctly identifies that all new source files must use the year 2026 in their license headers to comply with the repository's style guide.

Comment thread packages/cli/src/commands/update.ts Outdated
Comment thread packages/cli/src/ui/commands/updateCommand.ts Outdated
Comment thread packages/cli/src/utils/performUpdate.ts Outdated
Comment thread packages/cli/src/utils/performUpdate.test.ts Outdated
@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Mar 28, 2026
@SHARABUMANOJKUMAR
Copy link
Copy Markdown

Hi, I would like to work on this issue.

I’m a GSoC 2026 applicant and have experience with Python and Node.js and CLI tools. I’d love to contribute to this feature.

Could you please guide me on how to proceed?

Thanks!

Comment thread packages/cli/src/utils/performUpdate.ts
@gvenugo3 gvenugo3 force-pushed the feat/gemini-update-command branch 2 times, most recently from 59e3ef9 to 1193583 Compare April 6, 2026 04:41
@gvenugo3
Copy link
Copy Markdown
Author

@mrpmohiburrahman made the changes you pointed out! Please let me know if everything looks good.

Implement a new 'gemini update' command that checks for and installs newer
versions of the CLI while preserving the current release channel (stable,
preview, or nightly).

Features:
- Check for available updates from npm registry
- Preserve release channel during update (stable/preview/nightly)
- Support all major package managers (npm, yarn, pnpm, bun, homebrew)
- Provide graceful handling for unsupported installation methods
- Available as both CLI command (gemini update) and slash command (/update)
- Comprehensive unit tests (14 test cases)

Implementation:
- Core update logic in performUpdate.ts (200+ LOC)
- Reuses existing infrastructure for installation detection and package
  manager integration
- Proper TypeScript typing with union types for update results
- Handles preview channel versions alongside nightly and stable builds

The implementation resolves issue google-gemini#16122 by providing users with a
straightforward way to update their CLI installation without needing to
manually invoke package manager commands.
@gvenugo3 gvenugo3 force-pushed the feat/gemini-update-command branch from 1193583 to a09cd90 Compare April 22, 2026 06:04
@gvenugo3
Copy link
Copy Markdown
Author

@Adib234 please let me know if this implementation looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add gemini update command

3 participants