[PR #6908] fix(tui): make bash outputs respect "Show tool details" toggle #12157

Closed
opened 2026-02-16 18:17:05 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6908

State: closed
Merged: No


Summary

Completes the existing "Show tool details" feature (Ctrl+P command palette) by making it affect bash output rendering in the live TUI view, not just transcript exports.

Problem

The "Show tool details" toggle only affected transcript exports. Bash outputs in the live TUI always showed:

  • Full commands with hundreds of characters of environment variables
  • Complete output regardless of length
  • No way to collapse verbose outputs

This made the TUI difficult to navigate and scan through session history.

Solution

  • Bash outputs now respect the showDetails() setting
  • Truncate output to 5 lines when tool details are hidden
  • Hide verbose env var prefixes when collapsed
  • Add 'o' key to toggle individual bash output expansion
  • Show "... +N lines (press 'o' to expand)" indicator

User Experience

Before (tool details always shown):

# Push to remote
$ export CI=true DEBIAN_FRONTEND=noninteractive GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=never HOMEBREW_NO_AUTO_UPDATE=1 GIT_EDITOR=: EDITOR=: VISUAL='' GIT_SEQUENCE_EDITOR=: GIT_MERGE_AUTOEDIT=no GIT_PAGER=cat PAGER=cat npm_config_yes=true PIP_NO_INPUT=1 YARN_ENABLE_IMMUTABLE_INSTALLS=false; git push origin main

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:user/repo.git
   abc1234..def5678  main -> main
[20+ lines total...]

After (respects "Show tool details" setting):

# Push to remote
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done.
... +15 lines (press 'o' to expand)

Changes

  • Added per-tool expansion state tracking
  • Updated BlockTool component to support onExpand callback and 'o' key handler
  • Modified Bash component to respect showDetails() setting
  • 5-line truncation threshold with line count indicator

Testing

  1. Run bash commands with varying output lengths
  2. Toggle "Show tool details" via Ctrl+P
  3. Press 'o' on individual outputs to expand/collapse
  4. Verify truncated outputs show "... +N lines" indicator
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6908 **State:** closed **Merged:** No --- ## Summary Completes the existing "Show tool details" feature (`Ctrl+P` command palette) by making it affect bash output rendering in the live TUI view, not just transcript exports. ## Problem The "Show tool details" toggle only affected transcript exports. Bash outputs in the live TUI always showed: - Full commands with hundreds of characters of environment variables - Complete output regardless of length - No way to collapse verbose outputs This made the TUI difficult to navigate and scan through session history. ## Solution - Bash outputs now respect the `showDetails()` setting - Truncate output to 5 lines when tool details are hidden - Hide verbose env var prefixes when collapsed - Add 'o' key to toggle individual bash output expansion - Show "... +N lines (press 'o' to expand)" indicator ## User Experience **Before** (tool details always shown): ``` # Push to remote $ export CI=true DEBIAN_FRONTEND=noninteractive GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=never HOMEBREW_NO_AUTO_UPDATE=1 GIT_EDITOR=: EDITOR=: VISUAL='' GIT_SEQUENCE_EDITOR=: GIT_MERGE_AUTOEDIT=no GIT_PAGER=cat PAGER=cat npm_config_yes=true PIP_NO_INPUT=1 YARN_ENABLE_IMMUTABLE_INSTALLS=false; git push origin main Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (2/2), completed with 2 local objects. To github.com:user/repo.git abc1234..def5678 main -> main [20+ lines total...] ``` **After** (respects "Show tool details" setting): ``` # Push to remote Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done. ... +15 lines (press 'o' to expand) ``` ## Changes - Added per-tool expansion state tracking - Updated `BlockTool` component to support `onExpand` callback and 'o' key handler - Modified `Bash` component to respect `showDetails()` setting - 5-line truncation threshold with line count indicator ## Testing 1. Run bash commands with varying output lengths 2. Toggle "Show tool details" via `Ctrl+P` 3. Press 'o' on individual outputs to expand/collapse 4. Verify truncated outputs show "... +N lines" indicator
yindo added the pull-request label 2026-02-16 18:17:05 -05:00
yindo closed this issue 2026-02-16 18:17:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12157