opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): add support for bash tool expansion and colored ANSI output

Open remorses opened this issue 4 weeks ago • 4 comments

  • 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.

https://github.com/user-attachments/assets/c05c8be8-76f5-4f2a-b1c1-310cf74d4ab6

remorses avatar Nov 26 '25 19:11 remorses

Any blockers to this PR? @rekram1-node

remorses avatar Dec 09 '25 10:12 remorses

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

rekram1-node avatar Dec 09 '25 20:12 rekram1-node

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

remorses avatar Dec 09 '25 21:12 remorses