Skip to content

feat(cli): introduce compact tool output layout#18728

Closed
jwhelangoog wants to merge 21 commits into
mainfrom
feature/dense-tool-output-mods
Closed

feat(cli): introduce compact tool output layout#18728
jwhelangoog wants to merge 21 commits into
mainfrom
feature/dense-tool-output-mods

Conversation

@jwhelangoog

@jwhelangoog jwhelangoog commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR introduces the ui.enableCompactToolOutput setting (labeled as "Compact Tool Output"), which defaults to true. This significantly improves terminal ergonomics by rendering most tool outputs as high-signal, single-line summaries. This "Compact View" reduces box clutter in the conversational history while maintaining immediate visual feedback for agent actions.

Details

Compact Tool Rendering: Implemented a new layout for standard tools (file operations, grep, etc.) that presents Name, Description, and Result in a single line.
Improved History Clarity: Intelligently merges consecutive tool outputs and removes redundant box borders, resulting in a cleaner and more readable chat history.
User Choice: Added the ui.enableCompactToolOutput boolean setting (enabled by default). Users can toggle back to the traditional "Boxed" view at any time for a more detailed display.
Test Reliability:
• Updated UI tests and snapshots to reflect the new default experience.
• Resolved hardcoded path issues in macOS Seatbelt environments.
Documentation: Updated settings.json schema and configuration guides to reflect the refined setting name.

Related Issues

Fixes #16190
Fixes #14569

How to Validate

  1. Compact View (Default): Run a tool like /ls. Verify the output appears as a single line with a status indicator.
  2. Boxed View: Update settings.json to set "ui": { "enableCompactToolOutput": false }. Run the same tool and verify it appears in the traditional boxed layout with full borders.
  3. Mixed Batches: Run a batch containing both a file read and a shell command. Verify the file read is compact while the shell command correctly renders its box.
  4. Automated Tests: Run npm run test -w @google/gemini-cli to verify CLI tests pass.

- Update useGeminiStream to detect dense tool batches (non-verbose, non-shell).
- Update useHistoryManager to merge consecutive tool_group items into a single history entry.
- Add unit tests for history manager merging logic.
- Add DenseToolMessage component for single-line tool output.
- Update ToolGroupMessage to support dense layout and conditional borders.
- Improve padding and layout in ShellToolMessage and ToolMessage.
- Add padding to ShowMoreLines and update UI snapshots.
- Introduce 'ui.enableCompactToolOutput' (default: true) to control tool output layout.
- Separated the overloaded 'output.verbosity' setting into two distinct concerns: 'output.verbosity' now strictly filters history content, while 'ui.enableCompactToolOutput' toggles between dense and boxed layouts.
- Update useGeminiStream and ToolGroupMessage to respect the new architectural separation.
- Add 'ui.enableCompactToolOutput' to configuration guide.
- Regenerate settings documentation to reflect schema changes.
- Update all UI snapshots to synchronize with the new 'compact' default and minor layout tweaks.
- Update legacy UI regression tests to explicitly disable 'enableCompactToolOutput' to verify boxed layout behavior (overflows, sticky headers).
- Refactor 'useGeminiStream.test.tsx' to resolve TypeErrors and use consistent mock settings supporting the new UI options.
- Fix EPERM failures by using 'os.tmpdir()' in a2a-server and CLI theme tests to resolve macOS Seatbelt issues.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jwhelangoog, 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 CLI by introducing a compact tool output layout, which condenses most tool results into single-line summaries, thereby reducing visual clutter and improving the readability of the conversational history. It also refines output verbosity controls, allowing users to tailor the level of detail displayed, and includes important bug fixes for test reliability and temporary directory handling across different operating systems.

Highlights

  • Compact Tool Output Layout: Introduced the ui.enableCompactToolOutput setting, which defaults to true, to render most tool outputs as high-signal, single-line summaries, significantly improving terminal ergonomics and reducing visual clutter in the conversational history.
  • Enhanced Output Verbosity Control: Added a new output.verbosity setting, along with new verbose, debug, and trace message types, allowing users to control the level of detail displayed in the output history.
  • Improved History Clarity: Refined the display logic for tool groups, removing redundant box borders for standard tool sequences and implementing merging of consecutive tool_group history items to streamline the chat history.
  • Test Reliability and Cross-Platform Compatibility: Resolved EPERM issues in macOS Seatbelt environments by migrating hardcoded /tmp paths to os.tmpdir() in test utilities, and fixed TypeError regressions in useGeminiStream tests.
Changelog
  • docs/cli/settings.md
    • Documented new output.verbosity and ui.enableCompactToolOutput settings.
  • docs/get-started/configuration.md
    • Added documentation for output.verbosity and ui.enableCompactToolOutput settings.
  • packages/a2a-server/src/utils/testing_utils.ts
    • Updated temporary directory paths to use os.tmpdir() for improved cross-platform compatibility.
  • packages/cli/src/config/extension-manager-themes.spec.ts
    • Modified temporary directory creation to use os.tmpdir().
  • packages/cli/src/config/settingsSchema.ts
    • Defined new output.verbosity and ui.enableCompactToolOutput settings in the schema.
  • packages/cli/src/ui/AppContainer.tsx
    • Changed memory refresh messages from INFO to VERBOSE type.
  • packages/cli/src/ui/components/HistoryItemDisplay.test.tsx
    • Added a test case for rendering DEBUG message types.
  • packages/cli/src/ui/components/HistoryItemDisplay.tsx
    • Implemented rendering logic for verbose, debug, and trace message types.
  • packages/cli/src/ui/components/MainContent.test.tsx
    • Added tests for filtering history items based on verbosity settings.
  • packages/cli/src/ui/components/MainContent.tsx
    • Integrated settings to filter history items based on output.verbosity and applied useSettings hook.
  • packages/cli/src/ui/components/ShowMoreLines.tsx
    • Adjusted horizontal padding for the 'Show more lines' hint.
  • packages/cli/src/ui/components/snapshots/AlternateBufferQuittingDisplay.test.tsx.snap
    • Updated snapshots to reflect compact tool output.
  • packages/cli/src/ui/components/snapshots/MainContent.test.tsx.snap
    • Updated snapshots for ShowMoreLines component rendering.
  • packages/cli/src/ui/components/snapshots/SettingsDialog.test.tsx.snap
    • Updated snapshots to include new verbosity and compact tool output settings.
  • packages/cli/src/ui/components/snapshots/ToolConfirmationQueue.test.tsx.snap
    • Updated snapshots to reflect padding changes.
  • packages/cli/src/ui/components/messages/DenseToolMessage.test.tsx
    • Added new test file for DenseToolMessage component.
  • packages/cli/src/ui/components/messages/DenseToolMessage.tsx
    • Added new component for rendering compact, single-line tool outputs.
  • packages/cli/src/ui/components/messages/ShellToolMessage.tsx
    • Removed top margin from ShellInputPrompt box.
  • packages/cli/src/ui/components/messages/ToolConfirmationMessageOverflow.test.tsx
    • Updated test to include enableCompactToolOutput setting.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
    • Updated tests to use common settings and reflect changes in tool group rendering logic.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
    • Implemented logic to conditionally render DenseToolMessage and manage border visibility based on ui.enableCompactToolOutput and tool types.
  • packages/cli/src/ui/components/messages/ToolMessage.tsx
    • Removed top margin from ShellInputPrompt box.
  • packages/cli/src/ui/components/messages/ToolResultDisplayOverflow.test.tsx
    • Updated test to include enableCompactToolOutput setting.
  • packages/cli/src/ui/components/messages/ToolStickyHeaderRegression.test.tsx
    • Updated test to include enableCompactToolOutput setting and adjusted scroll amount.
  • packages/cli/src/ui/components/messages/snapshots/ShellToolMessage.test.tsx.snap
    • Updated snapshots for shell tool message rendering.
  • packages/cli/src/ui/components/messages/snapshots/ToolConfirmationMessageOverflow.test.tsx.snap
    • Updated snapshots for tool confirmation message overflow.
  • packages/cli/src/ui/components/messages/snapshots/ToolGroupMessage.test.tsx.snap
    • Updated snapshots for tool group message rendering, including compact view.
  • packages/cli/src/ui/components/messages/snapshots/ToolResultDisplayOverflow.test.tsx.snap
    • Updated snapshots for tool result display overflow.
  • packages/cli/src/ui/components/messages/snapshots/ToolStickyHeaderRegression.test.tsx.snap
    • Updated snapshots for sticky header regression tests.
  • packages/cli/src/ui/hooks/shellCommandProcessor.ts
    • Assigned verbosity level to tool_group history items.
  • packages/cli/src/ui/hooks/toolMapping.test.ts
    • Added tests for verbosity assignment in tool_group items.
  • packages/cli/src/ui/hooks/toolMapping.ts
    • Implemented logic to assign verbosity to tool_group history items based on isClientInitiated.
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx
    • Updated tests to pass settings context to renderHookWithProviders.
  • packages/cli/src/ui/hooks/useGeminiStream.ts
    • Integrated enableCompactToolOutput setting to control tool group rendering logic.
  • packages/cli/src/ui/hooks/useHistoryManager.test.ts
    • Added tests for merging consecutive tool_group items and handling verbosity.
  • packages/cli/src/ui/hooks/useHistoryManager.ts
    • Implemented logic to merge consecutive tool_group history items and updated message recording.
  • packages/cli/src/ui/types.ts
    • Defined new HistoryItem types (verbose, debug, trace), Verbosity enum, and VERBOSITY_MAPPING.
  • packages/core/src/tools/ripGrep.ts
    • Adjusted relative path formatting for grep tool descriptions.
  • packages/core/src/tools/web-search.test.ts
    • Simplified returnDisplay string in web search tool tests.
  • packages/core/src/tools/web-search.ts
    • Simplified the returnDisplay message for web search results.
  • schemas/settings.schema.json
    • Added schema definitions for output.verbosity and ui.enableCompactToolOutput.
Activity
  • The pull request introduces a new feature for compact tool output and verbosity settings, with comprehensive updates across UI components, hooks, and settings schemas.
  • Several test files were updated or added to ensure the correct behavior of the new UI and settings, including snapshot tests.
  • Documentation for the new settings has been added to docs/cli/settings.md and docs/get-started/configuration.md.
  • Bug fixes related to temporary directory handling on macOS and TypeError regressions in useGeminiStream tests were addressed.
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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 significant improvement to the CLI's user experience with the new compact tool output layout and verbosity controls. The implementation is well-structured, touching on UI components, state management, and configuration. The accompanying documentation and test updates are thorough. I've found one issue with the new verbosity logic that could cause autonomous tool calls to be displayed incorrectly. The fix is straightforward and detailed in the review comment.

Comment thread packages/cli/src/ui/types.ts Outdated
@jwhelangoog

jwhelangoog commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

Screenshot (link):

image

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality labels Feb 10, 2026
@jwhelangoog jwhelangoog marked this pull request as ready for review February 10, 2026 20:08
@jwhelangoog jwhelangoog requested review from a team as code owners February 10, 2026 20:08
@jwhelangoog

Copy link
Copy Markdown
Contributor Author

PR Review: feat(cli): introduce compact tool output layout

The PR introduces a compact tool output layout, enabled by default, improving terminal ergonomics by merging tool groups and using single-line summaries.

Analysis

  • React Patterns: Robust implementation. useHistoryManager.ts uses functional state updates for safe tool merging.
  • Testing: Adheres to mandates. Uses renderWithProviders, act, and toMatchSnapshot. Merging logic is well-covered.
  • Documentation: Correctly added to settingsSchema.ts and documentation files.
  • Improvements Made: I've removed an unused isFirst prop from DenseToolMessage.tsx and updated the tests accordingly.

Prompt Impact

The change in web-search.ts to use a static returnDisplay: 'Search results returned.' reduces token redundancy. Since the full data is still in llmContent, this is likely safe but technically alters the model's history.

@anj-s Please review the returnDisplay change in web-search.ts to ensure it doesn't impact model reasoning or instruction following for search tools.

…text

Establishes core data contracts and state management for enhanced tool outputs.
- Introduces GrepResult, ListDirectoryResult, and ReadManyFilesResult types.
- Updates tools to return structured data instead of flat strings.
- Preserves confirmation details and diff stats in terminal tool states.
- Ensures backward compatibility in standard CLI views via safe type guards.
Adds a disableColor mode to DiffRenderer and CodeColorizer. This allows for rendering uncolored diffs (for rejected tool calls) while maintaining full layout features like line numbers and indentation.
Introduces a modular architecture for compact tool output in the CLI.
- Separates single-line summaries from multiline payloads across all tools.
- Implements specialized handlers for file operations and ReadManyFiles.
- Passes terminal dimensions to ensure accurate diff rendering in dense mode.
- Ensures state persistence for rejected operations in history.
- Includes unit tests for all new layouts, result types, and terminal states.
…attern

- Support structured summaries and payloads in ToolGroupMessage/DenseToolMessage.
- Add specialized box-layout rendering for file and read-many-files tools.
- Refine tool state management in useGeminiStream during cancellations.
- Update UI tests and snapshots to reflect new compact rendering styles.
…lMessage

- Implement persistent expansion state in ToolActionsContext.

- Add [Show/Hide Diff] toggle button for compact tool outputs.

- Integrate ScrollableList with 120-column max-width for expanded diffs.

- Ensure diffs are hidden by default in Alternate Screen Buffer mode.

- Add comprehensive test coverage for toggle behavior.
@jwhelangoog

Copy link
Copy Markdown
Contributor Author

Closing this PR. See #20974 for this work.

@jwhelangoog jwhelangoog closed this Mar 3, 2026
@jwhelangoog jwhelangoog deleted the feature/dense-tool-output-mods branch April 2, 2026 08:22
@sripasg sripasg added the size/xl An extra large PR label Jun 2, 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/p2 Important but can be addressed in a future release. size/xl An extra large PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Densify ReadFile and ReadManyFile output [Feature Request] Suppress or control verbose tool output (JSON) in the CLI UI

2 participants