gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

feat: allow exit and quit commands without leading slash

Open pm-bhatt opened this issue 1 year ago • 13 comments

This PR updates the slash command processor to allow 'exit' and 'quit' commands to be used without a leading slash, improving user experience for those accustomed to other CLI tools. It also updates the documentation and adds a test case.

(Re-submission of #13680 to resolve CLA signature issues)

pm-bhatt avatar Nov 23 '25 12:11 pm-bhatt

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Nov 23 '25 12:11 google-cla[bot]

Summary of Changes

Hello @pm-bhatt, I'm Gemini Code Assist[^1]! 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 improves the user experience of the CLI by making the exit and quit commands more intuitive. It modifies the command processing logic to recognize these commands even when a leading slash is not provided, aligning with common conventions in other command-line interfaces. This change streamlines interaction for users familiar with such tools.

Highlights

  • Enhanced Command Recognition: The exit and quit commands can now be used without a leading slash, improving usability and aligning with common CLI patterns.
  • Command Processor Update: The slashCommandProcessor logic has been modified to correctly identify and handle exit and quit commands even when the leading slash is omitted, by internally prepending the slash for processing.
  • Documentation Update: The CLI command documentation has been updated to reflect the new behavior for exit and quit, informing users of the simplified input method.
  • New Test Case: A new test has been added to ensure the exit command without a leading slash is correctly processed by the system.
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 :thumbsup: and :thumbsdown: 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.

[^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.

gemini-code-assist avatar Nov 23 '25 12:11 gemini-code-assist

@dtedesco1-at-google emini-code-assist : Can you please approve ? ?

pm-bhatt avatar Nov 24 '25 13:11 pm-bhatt

Just quickly tested this and exit and quit do not seem to make the application quit for me...

@pm-bhatt it seems like you removed our standard PR template which had areas for how reviewers should test, which OS types you had tested etc. Those could be helpful to see what worked for you and what was tested.

Do you have a screencast or something showing it working for you?

jackwotherspoon avatar Nov 24 '25 13:11 jackwotherspoon

@jackwotherspoon Thanks for the review 🙇🏽

I investigated the issue and found that the exit command was hanging because the CLI was waiting for the IDE to close open diffs during the disconnect process. The default timeout for this operation was set to 10 mins updated the PR with the following changes:

  1. Fix for IDE Disconnect Hang: Added a 2-second timeout to the closeDiff calls in IdeClient.disconnect() to prevent the CLI from hanging if the IDE is unresponsive.
  2. to verify that exit and quit (case-insensitive) are correctly treated as slash commands.

I've verified these changes locally and all tests are passing. Attaching video for the same.

Regarding the PR template: I apologize if I missed filling out some sections. I have tested this on macOS.

Just quickly tested this and exit and quit do not seem to make the application quit for me...

@pm-bhatt it seems like you removed our standard PR template which had areas for how reviewers should test, which OS types you had tested etc. Those could be helpful to see what worked for you and what was tested.

Do you have a screencast or something showing it working for you?

https://github.com/user-attachments/assets/4394aa37-6390-4026-81ff-858b34337cd8

pm-bhatt avatar Nov 24 '25 16:11 pm-bhatt

@jackwotherspoon - can you approve ?

pm-bhatt avatar Nov 26 '25 13:11 pm-bhatt

Testing it and it seems to work for me.

Going to let @abhipatel12 review this as he know slash commands better than most and will have ideas if there are areas that need cleaning up 👍

jackwotherspoon avatar Nov 26 '25 14:11 jackwotherspoon

@abhipatel12 - Request for approval please.

pm-bhatt avatar Nov 28 '25 06:11 pm-bhatt

I strongly advise against this change due to a significant UX regression regarding Command/Input Segregation.

Unlike standard shells (Bash/Zsh) where input is strictly procedural, an LLM CLI interface operates on natural language. We need a strict separation between the control layer (app commands) and the content layer (user prompts).

The Risk: If a user is discussing logic flow with Gemini and replies with "exit" (e.g., answering a question like "Should the script exit on error?"), this change would cause the CLI to terminate immediately instead of sending the message.

The leading slash (/) is not just a stylistic choice; it acts as a necessary namespace separator preventing collision between system commands and common natural language words. Removing it creates ambiguity and prone-to-error behavior.

Mastemmah avatar Nov 30 '25 07:11 Mastemmah

I strongly advise against this change due to a significant UX regression regarding Command/Input Segregation.

@pm-bhatt @Mastemmah Yes some folks on the Gemini CLI team have also brought up that this behavior may violate user expectations.

The team will discuss it more thoroughly before we decide on a decision.

I wonder potentially if an alternative solution is to just add to our system prompt that if a user seems to be wanting to exit or is asking about how they can exit Gemini CLI, to explicitly suggest /exit or /quit back to the user.

jackwotherspoon avatar Nov 30 '25 17:11 jackwotherspoon

Hey @jackwotherspoon @Mastemmah

Thanks a lot for the comments. Please note that I am not experienced programmer, so apologies if I made any mistakes. (Have used AI to polish the reply)

I believe the risk assessment is overstated and real-world evidence from other AI CLI tools demonstrates this is a solved problem.

Addressing the "exit" collision concern: The scenario where a user types standalone "exit" as a conversational response is extremely low probability. In natural conversation with an LLM: Users don't typically send single-word responses like "exit"

Context matters: "Should the script exit on error?" would be answered with "yes", "no", "yes, exit on error", or similar—not just "exit"

Even if someone did type just "exit", a simple confirmation prompt ("Exit Gemini CLI? [y/N]") completely eliminates accidental exits

Real-world evidence from other AI CLI tools:

Let me share what I found from researching actual AI CLI implementations:

  • Claude Code - Uses /exit (slash required) - causing user confusion where people accidentally send /exit as a prompt instead of exiting.
  • Aider - Uses /exit and /quit (slash required) - Following the same non-standard pattern
  • GitHub Copilot CLI - Uses "Exit" as a menu option and Esc key - No slash prefix needed, just select "Exit" from options or press Esc.
  • Cursor CLI - uses exit.

This shows that forcing non-standard exit commands creates real UX friction.

The namespace separator argument doesn't hold:

Standard CLIs have solved command/text disambiguation for decades without requiring prefix characters:

  • Git doesn't require /commit to prevent collision with the word "commit"
  • Docker doesn't require /exit Even tools with rich command sets (like gdb, psql) use contextual parsing, not mandatory prefixes
  • Every major REPL (Python, Node.js, MySQL, Redis, PostgreSQL) accepts exit or quit without special prefixes

Why the system prompt solution is insufficient:

Having Gemini suggest /exit when users ask how to exit is a band-aid that Still requires users to discover they need help (failed discoverability).

It Adds an extra step (ask AI → receive suggestion → type command) and doesn't't help users who try the standard exit first and get frustrated.

Proposed solution with zero risk: Implement exit and quit as standard commands with a simple confirmation prompt:

exit Exit Gemini CLI? (y/n):

The real question:

  • What user benefit justifies breaking decades of CLI conventions? The namespace collision risk is theoretical and easily mitigated with a single confirmation prompt. The UX friction is real, immediate, and frustrating for every new user(including me)

  • Users transitioning from any other CLI tool (including other AI CLIs) will try to exit first. Why make them fail and then learn your non-standard syntax when a simple confirmation solves the collision concern entirely?

pm-bhatt avatar Nov 30 '25 19:11 pm-bhatt

Sorry for disturbing you @jackwotherspoon , but do we have any update ?

pm-bhatt avatar Dec 05 '25 19:12 pm-bhatt

Can this be approved ?

pm-bhatt avatar Dec 12 '25 11:12 pm-bhatt