-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat(tui): add support for bash tool expansion and colored ANSI output #4791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
cdab204 to
18c535b
Compare
There was a problem hiding this 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-vtlibrary 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.
f8ee907 to
6a9856d
Compare
cde0b0c to
c90b204
Compare
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
4f6a8b0 to
9b55c81
Compare
e658d3e to
ec52beb
Compare
07e2446 to
aa3661a
Compare
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
cf40ccb to
76ebaa1
Compare
…x-on-click # Conflicts: # bun.lock # packages/opencode/src/cli/cmd/tui/routes/session/index.tsx # packages/opencode/src/tool/bash.ts
This reverts commit ff9f424.
|
Any blockers to this PR? @rekram1-node |
|
I thought Dax replied to you about how we should use pty for this or something, may be wrong |
|
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 |
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]>
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
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
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)
ghostty-opentuigh run watch)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