Skip to content

Fix so shell calls are formatted#21237

Merged
jacob314 merged 1 commit intomainfrom
shell_format
Mar 5, 2026
Merged

Fix so shell calls are formatted#21237
jacob314 merged 1 commit intomainfrom
shell_format

Conversation

@jacob314
Copy link
Copy Markdown
Contributor

@jacob314 jacob314 commented Mar 5, 2026

Summary

Fixes #21235

Large shell scripts are now readable
image
Syntax highlighting for shell scripts is ok but could be better with more advanced bash support.
Now that we highlight radio buttons using a consistent background color there is no risk of users mistaking the shell script content for a radio button. In addition the radio buttons are now consistently at the bottom of the window so are hard to confuse.

@jacob314 jacob314 requested a review from a team as a code owner March 5, 2026 09:10
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Mar 5, 2026

Hi @jacob314, 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
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 significantly improves the user experience when confirming shell command executions within the CLI. It introduces syntax highlighting and proper multiline formatting for shell commands displayed in tool confirmation messages, making them easier to read and understand. This enhancement is supported by new and updated snapshot tests to ensure visual consistency and correctness across various display scenarios.

Highlights

  • Shell Command Formatting: Implemented syntax highlighting for shell commands displayed in tool confirmation messages, improving readability.
  • Multiline Command Rendering: Enhanced the rendering of multiline shell commands to correctly display newlines and apply syntax highlighting.
  • Testing and Snapshots: Added new test cases and updated existing snapshots, including SVG snapshots, to validate the improved shell command formatting and rendering.
  • Dependency Cleanup: Removed an unnecessary 'config' dependency from a useCallback hook in useGeminiStream.ts.
Changelog
  • packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx
    • Added a test case to verify rendering of multiline shell commands with syntax highlighting and redirection warnings.
  • packages/cli/src/ui/components/snapshots/AskUserDialog.test.tsx.snap
    • Removed outdated snapshot entries.
  • packages/cli/src/ui/components/snapshots/ExitPlanModeDialog.test.tsx.snap
    • Removed outdated snapshot entries.
  • packages/cli/src/ui/components/snapshots/InputPrompt.test.tsx.snap
    • Removed outdated snapshot entries.
  • packages/cli/src/ui/components/snapshots/ToolConfirmationQueue-ToolConfirmationQueue-renders-a-multiline-shell-command-with-syntax-highlighting-and-redirection-warning-SVG-snapshot-.snap.svg
    • Added a new SVG snapshot for multiline shell command rendering.
  • packages/cli/src/ui/components/snapshots/ToolConfirmationQueue.test.tsx.snap
    • Updated snapshot to include the new multiline shell command test case.
  • packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx
    • Added a test case to verify multiline shell script rendering with newlines and syntax highlighting.
  • packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
    • Imported colorizeCode utility.
    • Applied colorizeCode to format shell commands, ensuring proper syntax highlighting and multiline display.
  • packages/cli/src/ui/components/messages/snapshots/ToolConfirmationMessage-ToolConfirmationMessage-should-render-multiline-shell-scripts-with-correct-newlines-and-syntax-highlighting-SVG-snapshot-.snap.svg
    • Added a new SVG snapshot for multiline shell script rendering.
  • packages/cli/src/ui/components/messages/snapshots/ToolConfirmationMessage.test.tsx.snap
    • Updated snapshots to reflect changes in multiline command display.
  • packages/cli/src/ui/hooks/useGeminiStream.ts
    • Removed 'config' from the dependency array of a useCallback hook.
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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

Size Change: -179 B (0%)

Total Size: 26 MB

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

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 syntax highlighting for shell commands in the tool confirmation UI, which is a great improvement for readability. The implementation in ToolConfirmationMessage.tsx correctly uses the colorizeCode utility, and the new tests with SVG snapshots are a good addition to verify the visual changes.

However, I've noticed that several snapshot files (AskUserDialog.test.tsx.snap, ExitPlanModeDialog.test.tsx.snap, InputPrompt.test.tsx.snap) have snapshots removed, but their corresponding test files are not included in this PR. This is a significant concern as it might indicate that tests are no longer being properly asserted, and it goes against the repository's guideline to keep pull requests focused. These changes should either be reverted and moved to a separate PR if unrelated, or the corresponding test file changes should be included to provide context.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/cli/src/ui/components/snapshots/InputPrompt.test.tsx.snap (81-100)

high

This change removes multiple snapshots related to 'mouse interaction' tests, but the test file InputPrompt.test.tsx is not part of this PR. Deleting snapshots without modifying the tests that generate them is risky and makes the PR less focused.

Please revert these changes if they are not related to this PR, or provide the context from the test file.

References
  1. Pull requests should be small and focused. The changes to this snapshot file appear unrelated to the main purpose of this PR. (link)

@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Mar 5, 2026
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended to include this svg and the other one in this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. these svgs are verified with the snapshot tests.

@jacob314 jacob314 added this pull request to the merge queue Mar 5, 2026
Merged via the queue into main with commit c7e2dbe Mar 5, 2026
28 checks passed
@jacob314 jacob314 deleted the shell_format branch March 5, 2026 18:52
struckoff pushed a commit to struckoff/gemini-cli that referenced this pull request Mar 6, 2026
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
SUNDRAM07 pushed a commit to SUNDRAM07/gemini-cli that referenced this pull request Mar 30, 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 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confirmation messages for multiline shell scripts are unreadable

2 participants