Skip to content

feat(cli): refactor model command to support set and manage subcommands#19221

Merged
sehoon38 merged 3 commits intomainfrom
feat/model-subcommands
Feb 16, 2026
Merged

feat(cli): refactor model command to support set and manage subcommands#19221
sehoon38 merged 3 commits intomainfrom
feat/model-subcommands

Conversation

@sehoon38
Copy link
Contributor

@sehoon38 sehoon38 commented Feb 16, 2026

Summary

Refactored the /model slash command in the CLI to support subcommands (set and manage). This provides a more consistent interface for both opening the model management dialog and quickly switching models via the terminal.

Details

image
  • Added subCommands support to the modelCommand definition.
  • Implemented /model set <model-name> [--persist] to update the current model.
  • Implemented /model manage to open the existing model configuration dialog.
  • Simplified modelCommand.action to delegate to manageModelCommand, consistent with the stats command routing.
  • Updated tests to cover the new functionality.

Related Issues

Related to #19166 (improving CLI command structure).

How to Validate

  1. Run the CLI: npm run start
  2. Test default behavior: Type /model and press Enter. It should open the model management dialog.
  3. Test manage subcommand: Type /model manage and press Enter. It should also open the dialog.
  4. Test set subcommand: Type /model set gemini-1.5-flash and press Enter. It should update the model.
  5. Test set with persistence: Type /model set gemini-1.5-pro --persist. It should update the model and persist it to config.
  6. Verify error handling: Type /model set without arguments. It should show a usage error.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

@sehoon38 sehoon38 requested a review from a team as a code owner February 16, 2026 19:35
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 16, 2026

Hi @sehoon38, 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 @sehoon38, 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 /model command in the CLI by introducing a subcommand structure. This refactoring provides a more intuitive and powerful interface for users to either quickly switch between models using /model set or access the full model management dialog via /model manage or the default /model command. The changes streamline model interaction within the terminal, improving user experience and command consistency.

Highlights

  • Subcommand Support: The /model CLI command now supports subcommands, specifically set and manage, providing a more structured interface.
  • Model Setting Functionality: A new /model set <model-name> [--persist] subcommand allows users to quickly change the active model, with an option to persist the change across sessions.
  • Dedicated Model Management Dialog: The /model manage subcommand explicitly opens the model configuration dialog, which remains the default behavior for /model without arguments.
  • Refactored Action Routing: The main modelCommand action has been refactored to correctly delegate to its subcommands based on user input, improving command parsing.
  • Enhanced Test Coverage: Comprehensive tests were added and updated to ensure the correct functionality and routing of the new subcommands, including model setting, persistence, and error handling.
Changelog
  • packages/cli/src/ui/commands/modelCommand.test.ts
    • Imported MessageType for testing UI messages.
    • Updated existing test descriptions for clarity, distinguishing between default /model behavior and subcommand behavior.
    • Added new test suites for the manage subcommand, verifying it opens the model dialog and calls refreshUserQuota.
    • Added new test suites for the set subcommand, covering model setting, persistence, and error handling for missing arguments.
    • Adjusted the expected description for modelCommand to reflect its new role as a manager of subcommands.
  • packages/cli/src/ui/commands/modelCommand.ts
    • Imported necessary logging utilities (ModelSlashCommandEvent, logModelSlashCommand) and MessageType.
    • Introduced setModelCommand as a new SlashCommand to handle setting the current model, including logic for parsing model name and --persist flag, and displaying UI messages.
    • Introduced manageModelCommand as a new SlashCommand to specifically open the model configuration dialog.
    • Refactored the main modelCommand to act as a container for subCommands (manageModelCommand and setModelCommand).
    • Modified the modelCommand's action to intelligently route incoming arguments to the appropriate subcommand or default to manageModelCommand if no specific subcommand is provided.
    • Updated the modelCommand's description to reflect its new role as a model configuration manager.
Activity
  • The author has confirmed that relevant documentation and READMEs have been updated.
  • The author has confirmed that tests have been added/updated.
  • The author has validated the changes on MacOS using npm run.
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.

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 effectively refactors the /model command to use a subcommand structure, which improves the CLI's consistency and usability. The introduction of /model set for quick model switching and /model manage for the UI dialog is a good enhancement.

My main feedback is on the implementation of the new parent modelCommand's action. The current logic for handling subcommands has a flaw where it defaults to the manage action for any invalid subcommand, which is not ideal for user experience. It's also not easily maintainable. I've left a specific comment with a suggested refactoring to address this by showing a proper error message and making the subcommand lookup more robust.

Overall, this is a solid refactoring. Addressing the feedback will make it even better.

@github-actions
Copy link

github-actions bot commented Feb 16, 2026

Size Change: +1.22 kB (0%)

Total Size: 24.4 MB

Filename Size Change
./bundle/gemini.js 24.4 MB +1.22 kB (0%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB

compressed-size-action

@gemini-cli gemini-cli bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Feb 16, 2026
@gemini-cli gemini-cli bot added the area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality label Feb 16, 2026
@sehoon38 sehoon38 enabled auto-merge February 16, 2026 20:00
@sehoon38 sehoon38 added this pull request to the merge queue Feb 16, 2026
Merged via the queue into main with commit 7d165e7 Feb 16, 2026
27 checks passed
@sehoon38 sehoon38 deleted the feat/model-subcommands branch February 16, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality area/core Issues related to User Interface, OS Support, Core Functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants