Repository navigation
Description
Description
Environment
- OS: Windows 10
- Terminal: wezterm
- Shell: PowerShell 7.4.7
- Bun version: 1.3.10
- Node.js: Works correctly
Problem
When running opencode-cli on Windows with wezterm terminal, ANSI escape codes are displayed as literal text instead of being rendered as colors/styles.
Example of corrupted output:
m┃H Build [
38; ssion - 2026-03-09T02:30:38.791Z █ 2
0m 8
;238m续 3
8;2 55m [
12;4H
;
30m█ 3
0;30;30m█ 4
8;2;3 m█
The escape sequences like [38;2;255;255;255m, [30m, [48;2;30;30;30m
should render colors, but are shown as plain text.
Reproduction Steps
1. Install Bun on Windows
2. Use wezterm as terminal
3. Run any Bun-based CLI with colored output
bun -e "console.log('\x1b[31mRed\x1b[0m')"
Expected: "Red" in red color
Actual: "[31mRed[0m" as literal text
What I've Tried
-
✅ Node.js works correctly:
node -e "console.log('\x1b[31mRed\x1b[0m')"Output: Red (in red color)
-
❌ Setting FORCE_COLOR:
$env:FORCE_COLOR = "1"No effect
-
❌ Setting TERM variables:
$env:TERM = "xterm-256color"
$env:COLORTERM = "truecolor"No effect
-
❌ UTF-8 encoding:
chcp 65001No effect
-
❌ Modified wezterm.lua:
config.set_environment_variables = {
TERM = 'xterm-256color',
COLORTERM = 'truecolor',
}
No improvement. -
✅ PowerShell native colors work:
Write-Host "Red" -ForegroundColor RedWorks correctly
-
❌ Both opencode versions affected:
- npx opencode - same issue
- npx oh-my-opencode - same issue
Environment Variables Check
$env:TERM # xterm-256color ✓
$env:COLORTERM # truecolor ✓
$env:TERM_PROGRAM # WezTerm ✓
chcp # 65001 (UTF-8) ✓
All settings appear correct.
Root Cause Analysis
- Node.js correctly detects the terminal as TTY and renders ANSI codes
- Bun appears to not properly handle ANSI escape sequences on Windows + wezterm
- The issue is specific to Bun on Windows with wezterm (not reproducible with Node.js)
Expected Behavior
ANSI escape codes should render as colors/styles, matching Node.js behavior.
Actual Behavior
ANSI escape codes are printed as literal text, making the UI unreadable.
Suggested Fix
Bun should properly detect Windows terminals (wezterm, Windows Terminal, etc.) and pass ANSI escape codes through correctly, similar to how Node.js handles them.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Activity
github-actions commentedon Mar 9, 2026
This issue might be a duplicate of existing issues. Please check:
Please review these issues to see if they cover the same problem before continuing. If your issue is distinct, feel free to clarify what makes it different.
adminxxt commentedon Jun 18, 2026
Has it been resolved? How to solve @Aaron-myeh
github-actions commentedon Aug 18, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.