Skip to content

feat(cli): add shortcuts to /memory list and interactive UI#20429

Open
Oerum wants to merge 2 commits intogoogle-gemini:mainfrom
Oerum:issue-20364
Open

feat(cli): add shortcuts to /memory list and interactive UI#20429
Oerum wants to merge 2 commits intogoogle-gemini:mainfrom
Oerum:issue-20364

Conversation

@Oerum
Copy link

@Oerum Oerum commented Feb 26, 2026

Summary

Extends the /memory list command with an interactive UI and keyboard shortcuts for opening files and folders.

Details

  • Replaced the plain-text output of /memory list with a new interactive MemoryList component.
  • Implemented Ctrl+X shortcut to open the selected GEMINI.md file in the default system editor.
  • Implemented Alt+O shortcut to open the directory containing the selected file.
  • Used the open utility for both actions to prevent command injection vulnerabilities.
  • Added Command.OPEN_DIRECTORY to keyBindings.ts.

Related Issues

Fixes #20364

How to Validate

  1. Run the CLI: npm run start
  2. Execute /memory list
  3. Use arrow keys to navigate the list.
  4. Press Ctrl+X on a file to open it in an external editor.
  5. Press Alt+O on a file to open its containing folder.
  6. Verify tests pass: npm run test -w @google/gemini-cli -- src/ui/commands/memoryCommand.test.ts

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
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@Oerum Oerum requested a review from a team as a code owner February 26, 2026 12:45
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Oerum, 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 user experience of the /memory list command in the CLI by introducing an interactive UI. This change moves away from a simple text-based output to a dynamic list, allowing users to easily navigate and interact with their GEMINI.md files. Furthermore, it integrates convenient keyboard shortcuts for directly opening files in an external editor or revealing their containing directories, all while maintaining robust security practices.

Highlights

  • Interactive Memory List UI: The /memory list command now features an interactive user interface, replacing the previous plain-text output.
  • Open File Shortcut: Users can now press Ctrl+X to open the currently selected GEMINI.md file in their default system editor.
  • Open Directory Shortcut: A new Alt+O shortcut has been added to open the directory containing the selected GEMINI.md file.
  • Enhanced Security: The open utility is now used for both file and directory opening actions to prevent command injection vulnerabilities, adhering to security recommendations from PR feat(cli): add /mds command to list and open memory/agent files #20366.
Changelog
  • packages/cli/src/config/keyBindings.ts
    • Added OPEN_DIRECTORY to the Command enum.
    • Assigned Alt+O as the default key binding for OPEN_DIRECTORY.
    • Included OPEN_DIRECTORY in the App command category.
    • Provided a description for the OPEN_DIRECTORY command.
  • packages/cli/src/ui/commands/memoryCommand.test.ts
    • Updated tests for memoryCommand to assert that it returns a custom_dialog component instead of adding plain text messages to the UI.
    • Removed expectations for mockContext.ui.addItem calls.
  • packages/cli/src/ui/commands/memoryCommand.ts
    • Removed the listMemoryFiles import from @google/gemini-cli-core.
    • Modified the action for the list subcommand to return a custom_dialog containing a React.createElement(MemoryList, ...) instead of directly adding text to the UI context.
  • packages/cli/src/ui/components/MemoryList.tsx
    • Added a new React component MemoryList to render an interactive list of GEMINI.md file paths.
    • Implemented useKeypress hook to handle Escape (close), Ctrl+X (open file), and Alt+O (open directory) shortcuts.
    • Utilized the open package for secure file and directory opening.
    • Displayed a message when no GEMINI.md files are found.
    • Rendered file names and their directories in a selectable list using BaseSelectionList.
Activity
  • The author has implemented the described features, including an interactive UI for /memory list and new keyboard shortcuts.
  • Tests have been updated to reflect these changes, ensuring the new interactive component is correctly handled.
  • The pre-merge checklist indicates validation on Windows and documentation updates have been completed.
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 introduces a new interactive UI for the /memory list command, which is a great improvement for user experience. It adds shortcuts to open memory files and their containing directories. The implementation is solid, using the open package for security and a new React component for the UI. The suggested changes address an important area for improvement related to error handling for the new shortcuts. When opening a file or directory fails, the error is currently swallowed, leading to a silent failure. The comments provide a comprehensive solution to handle these errors and provide feedback to the user. Overall, this is a valuable feature addition.

@gemini-cli gemini-cli bot added priority/p3 Backlog - a good idea but not currently a priority. area/core Issues related to User Interface, OS Support, Core Functionality labels Feb 26, 2026
@Oerum
Copy link
Author

Oerum commented Feb 26, 2026

/gemini review

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 valuable interactive UI for the /memory list command, significantly improving user experience with shortcuts for opening files and directories. The implementation is well-structured, moving presentation logic into a new MemoryList component and correctly updating tests and keybindings. I have one suggestion to optimize performance in the new component.

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/p3 Backlog - a good idea but not currently a priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): Add /mds command to view memory and agent files

1 participant