Skip to content

Conversation

@remorses
Copy link
Contributor

@remorses remorses commented Nov 26, 2025

  • Add full-screen bash output viewer with ANSI color rendering via ghostty-opentui
  • Truncated preview (20 lines) with "Click to view full output" expansion
  • Feed ANSI-stripped content to LLM for better token efficiency, while keeping colors in UI
  • Handles terminal control sequences properly (e.g. clear stdout in long running commands like gh run watch)
  • Force color output in bash commands via env vars (FORCE_COLOR, CLICOLOR, TERM, etc.)
  • Limit output during streaming to prevent RAM growth on large outputs
  • Preserve prompt text when entering/exiting viewer

I am using this branch as my daily driver, it works pretty well on macOS.

Screen.Recording.2025-11-26.at.23.50.55_fast_30fps.mp4

@remorses remorses force-pushed the bash-outout-scrollbox-on-click branch 2 times, most recently from cdab204 to 18c535b Compare November 26, 2025 22:53
@remorses remorses marked this pull request as ready for review November 26, 2025 23:12
Copilot AI review requested due to automatic review settings November 26, 2025 23:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for viewing bash command output with full ANSI color rendering in the TUI. When bash commands produce more than 20 lines of output, users can click to expand into a full-screen viewer with color support and keyboard navigation.

Key Changes:

  • Integrated opentui-ansi-vt library for terminal buffer rendering with ANSI color support
  • Added expandable bash output viewer with keyboard navigation (ESC/Ctrl+C to close, arrow keys to scroll)
  • Enhanced bash tool to force color output via comprehensive environment variables (FORCE_COLOR, CLICOLOR, TERM, etc.)

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/opencode/src/tool/bash.ts Added environment variables to force color output in bash commands
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx Implemented bash output viewer with ANSI rendering, keyboard navigation, and prompt text preservation
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx Added initialValue prop to restore draft text when exiting bash viewer
packages/opencode/package.json Added [email protected] dependency
nix/hashes.json Updated node modules hash for Nix build
flake.lock Updated nixpkgs lock reference
bun.lock Updated lock file with new dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Adds an bash output viewer with full ANSI color support. When bash commands
produce more than 20 lines of output, users can click to expand into a
full-screen viewer with syntax highlighting and keyboard navigation.

Key features:
- Full ANSI/VT color rendering using opentui-ansi-vt terminal emulation
- Truncated preview (20 lines) with 'Click to view full output' expansion
- Prompt text preservation when entering/exiting viewer
- Force color output in bash commands (FORCE_COLOR, CLICOLOR, TERM env vars)

Technical changes:
- Added opentui-ansi-vt dependency for terminal buffer rendering
- Added initialValue prop to Prompt component to restore draft text
- Strip ANSI codes for search to match actual text content
@remorses remorses force-pushed the bash-outout-scrollbox-on-click branch from 4f6a8b0 to 9b55c81 Compare November 27, 2025 10:09
@remorses remorses force-pushed the bash-outout-scrollbox-on-click branch from e658d3e to ec52beb Compare November 27, 2025 10:30
@remorses remorses force-pushed the bash-outout-scrollbox-on-click branch from 07e2446 to aa3661a Compare November 29, 2025 09:42
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Nov 30, 2025
Merges upstream PR sst#4791 which adds:
- Bash output viewer with full ANSI color support using opentui-ansi-vt
- Terminal emulation for accurate color rendering
- Page up/down and Home/End navigation in bash output viewer
- Click to view full output for truncated bash results
- Forces color output in bash commands (FORCE_COLOR=1)
- Adds initialValue prop to Prompt component for restoring drafts

Preserves our local features:
- Token tracking and context percentage display
- Search in messages (Ctrl+F) from PR sst#4898
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Nov 30, 2025
Merged upstream PRs:
- sst#4898: Search in messages (Ctrl+F)
- sst#4791: Bash output viewer with ANSI color support
- sst#4900: Double Ctrl+C to exit
- sst#4709: Token counting fixes for synthetic/noReply messages

Updated README for shuvcode fork project.
@remorses remorses marked this pull request as ready for review December 5, 2025 17:28
@remorses remorses force-pushed the bash-outout-scrollbox-on-click branch from cf40ccb to 76ebaa1 Compare December 6, 2025 10:24
@remorses
Copy link
Contributor Author

remorses commented Dec 9, 2025

Any blockers to this PR? @rekram1-node

@rekram1-node
Copy link
Collaborator

I thought Dax replied to you about how we should use pty for this or something, may be wrong

@remorses
Copy link
Contributor Author

remorses commented Dec 9, 2025

Do you mean this? https://x.com/thdxr/status/1994862262125789425?s=20

This PR does not handle interactive commands. That's a lot more complex and will take a while (also planning what it should look like)

This PR adds support for showing ANSI colors in the UI and make bash outputs expandable. It does not run commands in a pty (terminal emulator).

I am using this branch as my daily driver and it's so much better UX: I no longer have super long command outputs in the chat and everything is pretty because of the colors

shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Dec 11, 2025
This merge brings upstream changes while preserving fork-specific features:

Preserved fork features:
- PR sst#4898: Search in messages (Ctrl+F)
- PR sst#4791: Bash output with ANSI colors
- PR sst#4900: Double Ctrl+C to exit
- PR sst#4709: Live token usage during streaming
- PR sst#4865: Subagents sidebar with clickable navigation
- PR sst#4515: Show plugins in /status
- Fork-only: Toggle session header visibility

Resolved conflicts:
- Package versions updated to upstream v1.0.149
- Keybind type changes (cmd -> super)
- Desktop context files updated with defensive API checks
- UI components updated for new items prop signature
- input.css/tsx renamed to text-field.css/tsx

Validation:
- All typechecks pass (12/12 packages)
- All tests pass (281 passed, 1 skipped)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
opencode-agent bot added a commit to Latitudes-Dev/shuvcode that referenced this pull request Dec 18, 2025
Resolved conflicts:
- bun.lock: Regenerated from scratch
- packages/*/package.json: Accept upstream version (1.0.167)
- packages/extensions/zed/extension.toml: Accept upstream version

Upstream changes include:
- Version bump to 1.0.167
- Terminal title toggle feature added to config
- MCP authentication improvements
- Legal pages (privacy policy, terms of service)
- Tauri package updates

Fork features preserved:
- PR sst#4898: Search in messages (Ctrl+F)
- PR sst#4791: ANSI bash output support
- PR sst#4900: Double Ctrl+C to exit
- PR sst#4709: Live token usage during streaming
- PR sst#4865: Subagents sidebar navigation
- PR sst#4515: Show plugins in /status
- PR sst#5508: Cache management commands
- PR #ariane-emory: Granular file permissions
- PR #fork-140: Toggle transparent background
- Desktop features: slash commands, shell mode, themes, branding
opencode-agent bot added a commit to Latitudes-Dev/shuvcode that referenced this pull request Dec 19, 2025
Resolved conflicts:
- script/publish.ts: kept fork version (fork-specific publishing to Latitudes-Dev/shuvcode)

Auto-merged files with upstream improvements:
- packages/opencode/src/cli/cmd/tui/routes/session/index.tsx: new dialog-subagent component
- packages/opencode/src/session/message-v2.ts: improved error handling
- packages/desktop/src/context/global-sync.tsx: added null directory guards

Preserved fork features:
- PR sst#4898: Search in messages (Ctrl+F)
- PR sst#4791: Bash output with ANSI
- PR sst#4900: Double Ctrl+C to exit
- PR sst#4709: Live token usage during streaming
- PR sst#4865: Subagents sidebar with clickable navigation
- PR sst#5508: Cache management command
- Glob permissions feature
- Toggle transparent background
- Desktop slash commands and share functionality
opencode-agent bot added a commit to Latitudes-Dev/shuvcode that referenced this pull request Dec 19, 2025
Resolved conflicts:
- packages/opencode/src/cli/cmd/tui/routes/session/index.tsx: Merged fork search highlighting with upstream user message markdown toggle
- packages/opencode/package.json: Accept upstream v1.0.170, preserved ghostty-opentui dependency
- .github/workflows/generate.yml: Keep fork-specific workflow (better error messaging)
- script/publish.ts: Keep fork-specific publish script (shuvcode registry, contributors)
- packages/extensions/zed/extension.toml: Accept upstream v1.0.170
- All other package.json files: Accept upstream v1.0.170 versions
- bun.lock: Regenerated

Preserved fork features:
- PR sst#4898: Search in messages (Ctrl+F with highlighting)
- PR sst#4791: Bash output with ANSI (ghostty-opentui)
- PR sst#4900: Double Ctrl+C to exit
- PR sst#4709: Live token usage during streaming
- PR sst#4865: Subagents sidebar with clickable navigation
- PR #fork-140: Toggle transparent background
- Fork: Toggle session header visibility
- Fork: Desktop slash commands and shell input mode
- Fork: Desktop Night Owl theme
- Fork: Desktop theme/font pickers and branding
- Fork: Share functionality for shuv.ai
- Fork: Desktop mobile responsiveness
- Fork: Desktop review pane resizing

New upstream feature integrated:
- User message markdown toggle (enable/disable markdown rendering in user messages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants