Skip to content

fix(cli): replace hardcoded keybinding strings with dynamic formatters#21159

Merged
scidomino merged 1 commit intomainfrom
tomm_keybindings
Mar 5, 2026
Merged

fix(cli): replace hardcoded keybinding strings with dynamic formatters#21159
scidomino merged 1 commit intomainfrom
tomm_keybindings

Conversation

@scidomino
Copy link
Collaborator

@scidomino scidomino commented Mar 4, 2026

Summary

Replaces hardcoded keyboard shortcut strings in the UI and system prompts with dynamic lookups.

Details

Also fixes a flakiness issue in the policy engine integration tests when GEMINI_SYSTEM_MD is set.

Related Issues

Related to #14425

How to Validate

Paste large text and verify that it shows "Press Ctrl+O to expand pasted text"

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on MacOS

@gemini-cli gemini-cli bot added priority/p1 Important and should be addressed in the near term. area/core Issues related to User Interface, OS Support, Core Functionality labels Mar 4, 2026
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Size Change: +169 B (0%)

Total Size: 26 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.5 MB +169 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

@scidomino scidomino marked this pull request as ready for review March 4, 2026 21:33
@scidomino scidomino requested a review from a team as a code owner March 4, 2026 21:33
@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 enhances the CLI's user experience by making keyboard shortcut displays dynamic rather than hardcoded, allowing for greater flexibility and consistency. Additionally, it resolves an intermittent test failure in the policy engine integration suite, contributing to overall system stability.

Highlights

  • Dynamic Keybinding Display: Replaced hardcoded keyboard shortcut strings in the CLI's UI components with dynamic formatters, ensuring consistent and adaptable keybinding displays.
  • System Prompt Updates: Updated system prompts to use dynamic keybinding lookups, specifically changing the interactive shell focus hint from 'Ctrl+F' to 'Tab'.
  • Test Stability Improvement: Addressed a flakiness issue in the policy engine integration tests by stubbing and unstubbing the GEMINI_SYSTEM_MD environment variable, improving test reliability.
Changelog
  • packages/cli/src/config/policy-engine.integration.test.ts
    • Imported beforeEach and afterEach from vitest.
    • Added beforeEach hook to stub GEMINI_SYSTEM_MD environment variable to an empty string.
    • Added afterEach hook to unstub all environment variables.
  • packages/cli/src/ui/components/InputPrompt.tsx
    • Imported formatCommand utility.
    • Replaced hardcoded "Ctrl+O" string with formatCommand(Command.EXPAND_PASTE) for expand pasted text hint.
  • packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx
    • Imported formatCommand utility.
    • Replaced hardcoded "Ctrl+L" string with formatCommand(Command.CLEAR_SCREEN) for reset command hint.
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Updated multiple snapshots to reflect the change from ctrl + f to tab in interactive command instructions.
  • packages/core/src/core/prompts.test.ts
    • Updated test descriptions from "should include 'ctrl + f' instructions" to "should include 'tab' instructions".
    • Modified assertions to check for 'tab' instead of 'ctrl + f' in the generated prompt.
    • Modified assertion to check for 'tab' when interactive shell is disabled.
  • packages/core/src/prompts/snippets.legacy.ts
    • Imported SHELL_PARAM_IS_BACKGROUND.
    • Changed the interactive shell focus hint from ctrl + f to tab.
    • Used SHELL_PARAM_IS_BACKGROUND constant for the background processes parameter.
    • Adjusted formatting for background processes and interactive commands.
  • packages/core/src/prompts/snippets.ts
    • Changed the interactive shell focus hint from ctrl + f to tab.
Activity
  • Updated relevant documentation and README.
  • Added/updated tests for the changes.
  • Validated the changes on MacOS.
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 primarily updates keybinding references across the application, changing the instruction for focusing into the shell from Ctrl+F to Tab. This change is reflected in various system prompt snippets, UI components like InputPrompt.tsx and BaseSettingsDialog.tsx (which now use a formatCommand utility for dynamic keybinding display), and corresponding unit tests and snapshot files. Additionally, integration tests for the policy engine (policy-engine.integration.test.ts) have been enhanced with beforeEach and afterEach hooks to manage environment variables, ensuring better test isolation. The SHELL_PARAM_IS_BACKGROUND constant was also introduced for consistency in prompt generation.

@scidomino scidomino added this pull request to the merge queue Mar 5, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 5, 2026
@scidomino scidomino added this pull request to the merge queue Mar 5, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 5, 2026
@scidomino scidomino added this pull request to the merge queue Mar 5, 2026
Merged via the queue into main with commit 1c3c7a3 Mar 5, 2026
27 checks passed
@scidomino scidomino deleted the tomm_keybindings branch March 5, 2026 18:09
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
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 priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants