opencode
opencode copied to clipboard
feat(tui): add per-workspace TUI display settings
Summary
- Add configurable TUI display settings that can be set per-workspace via
opencode.json - Enables different visual configurations for different contexts (technical vs non-technical sessions)
Disclaimer
This PR was created with the assistance of Claude. Manual testing has been done in the TUI but additional testing would be appreciated.
Changes
Problem
TUI display settings (thinking visibility, sidebar, timestamps, etc.) are stored in a global KV store (~/.local/state/opencode/kv.json). Toggling /thinking off in one workspace affects all workspaces.
I've been building a life-coach/personal assistant setup using OpenCode where thinking blocks add visual clutter. But in coding workspaces, I want them visible. Currently requires manual toggling every context switch.
Solution
Expose TUI display settings in the config schema:
{
"tui": {
"show_thinking": false,
"sidebar": "hide"
}
}
Config values act as workspace defaults. Runtime toggles still work as session-only overrides.
Backward Compatibility
- All new config fields are optional with no defaults
- When config fields are unset, existing KV behavior is preserved exactly
- Users without any
tuiconfig see zero change
Files Changed
-
packages/opencode/src/config/config.ts- Add 8 optional TUI schema fields -
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx- Config defaults with KV fallback -
packages/sdk/js/src/v2/gen/types.gen.ts- Regenerated SDK types -
packages/sdk/openapi.json- Updated OpenAPI spec
Testing
- TypeScript passes (turbo typecheck: 12/12 packages)
- Config schema validates correctly
- Backward compatible: no config = existing KV behavior preserved