|
| 1 | +diff --git a/.opencode.json b/.opencode.json |
| 2 | +index 75e357d..59be1e8 100644 |
| 3 | +--- a/.opencode.json |
| 4 | ++++ b/.opencode.json |
| 5 | +@@ -6,6 +6,6 @@ |
| 6 | + } |
| 7 | + }, |
| 8 | + "tui": { |
| 9 | +- "theme": "opencode-dark" |
| 10 | ++ "theme": "charm" |
| 11 | + } |
| 12 | + } |
| 13 | +diff --git a/go.mod b/go.mod |
| 14 | +index 18ad042..940a8e8 100644 |
| 15 | +--- a/go.mod |
| 16 | ++++ b/go.mod |
| 17 | +@@ -36,6 +36,8 @@ require ( |
| 18 | + github.com/stretchr/testify v1.10.0 |
| 19 | + ) |
| 20 | + |
| 21 | ++require github.com/charmbracelet/x/exp/charmtone v0.0.0-20250530202730-6ba1785cd7b9 // indirect |
| 22 | ++ |
| 23 | + require ( |
| 24 | + cloud.google.com/go v0.116.0 // indirect |
| 25 | + cloud.google.com/go/auth v0.13.0 // indirect |
| 26 | +diff --git a/go.sum b/go.sum |
| 27 | +index f6e08b7..8f347ed 100644 |
| 28 | +--- a/go.sum |
| 29 | ++++ b/go.sum |
| 30 | +@@ -84,6 +84,8 @@ github.com/charmbracelet/x/ansi v0.9.3-0.20250516160309-24eee56f89fa h1:JU05TLAB |
| 31 | + github.com/charmbracelet/x/ansi v0.9.3-0.20250516160309-24eee56f89fa/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE= |
| 32 | + github.com/charmbracelet/x/cellbuf v0.0.14-0.20250516160309-24eee56f89fa h1:lphz0Z3rsiOtMYiz8axkT24i9yFiueDhJbzyNUADmME= |
| 33 | + github.com/charmbracelet/x/cellbuf v0.0.14-0.20250516160309-24eee56f89fa/go.mod h1:xBlh2Yi3DL3zy/2n15kITpg0YZardf/aa/hgUaIM6Rk= |
| 34 | ++github.com/charmbracelet/x/exp/charmtone v0.0.0-20250530202730-6ba1785cd7b9 h1:f6tG7ApqIvXTpgF6MZ+C4Ga7669eiW9BsMkXEjDFHfY= |
| 35 | ++github.com/charmbracelet/x/exp/charmtone v0.0.0-20250530202730-6ba1785cd7b9/go.mod h1:vr+xCFylsPYq2qSz+n5/jItjcK2/PgrKFMTI7VRR6CI= |
| 36 | + github.com/charmbracelet/x/exp/golden v0.0.0-20250207160936-21c02780d27a h1:FsHEJ52OC4VuTzU8t+n5frMjLvpYWEznSr/u8tnkCYw= |
| 37 | + github.com/charmbracelet/x/exp/golden v0.0.0-20250207160936-21c02780d27a/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= |
| 38 | + github.com/charmbracelet/x/exp/slice v0.0.0-20250528180458-2d5d6cb84620 h1:/PN4jqP3ki9NvtHRrYZ9ewCutKZB6DK8frTW+Dj/MWs= |
| 39 | +diff --git a/internal/tui/components/chat/chat.go b/internal/tui/components/chat/chat.go |
| 40 | +index 2ee0b04..52c4dae 100644 |
| 41 | +--- a/internal/tui/components/chat/chat.go |
| 42 | ++++ b/internal/tui/components/chat/chat.go |
| 43 | +@@ -95,7 +95,7 @@ func lspsConfigured() string { |
| 44 | + func logoBlock() string { |
| 45 | + t := theme.CurrentTheme() |
| 46 | + return logo.Render(version.Version, true, logo.Opts{ |
| 47 | +- FieldColor: t.Accent(), |
| 48 | ++ FieldColor: t.Secondary(), |
| 49 | + TitleColorA: t.Primary(), |
| 50 | + TitleColorB: t.Secondary(), |
| 51 | + CharmColor: t.Primary(), |
| 52 | +diff --git a/internal/tui/tui.go b/internal/tui/tui.go |
| 53 | +index 9e8a62a..3f07956 100644 |
| 54 | +--- a/internal/tui/tui.go |
| 55 | ++++ b/internal/tui/tui.go |
| 56 | +@@ -18,6 +18,7 @@ import ( |
| 57 | + "github.com/opencode-ai/opencode/internal/tui/util" |
| 58 | + ) |
| 59 | + |
| 60 | ++// appModel represents the main application model that manages pages, dialogs, and UI state. |
| 61 | + type appModel struct { |
| 62 | + width, height int |
| 63 | + keyMap KeyMap |
| 64 | +@@ -35,6 +36,7 @@ type appModel struct { |
| 65 | + completions completions.Completions |
| 66 | + } |
| 67 | + |
| 68 | ++// Init initializes the application model and returns initial commands. |
| 69 | + func (a appModel) Init() tea.Cmd { |
| 70 | + var cmds []tea.Cmd |
| 71 | + cmd := a.pages[a.currentPage].Init() |
| 72 | +@@ -46,6 +48,7 @@ func (a appModel) Init() tea.Cmd { |
| 73 | + return tea.Batch(cmds...) |
| 74 | + } |
| 75 | + |
| 76 | ++// Update handles incoming messages and updates the application state. |
| 77 | + func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { |
| 78 | + var cmds []tea.Cmd |
| 79 | + var cmd tea.Cmd |
| 80 | +@@ -111,6 +114,7 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { |
| 81 | + return a, tea.Batch(cmds...) |
| 82 | + } |
| 83 | + |
| 84 | ++// handleWindowResize processes window resize events and updates all components. |
| 85 | + func (a *appModel) handleWindowResize(msg tea.WindowSizeMsg) tea.Cmd { |
| 86 | + var cmds []tea.Cmd |
| 87 | + msg.Height -= 1 // Make space for the status bar |
| 88 | +@@ -134,6 +138,7 @@ func (a *appModel) handleWindowResize(msg tea.WindowSizeMsg) tea.Cmd { |
| 89 | + return tea.Batch(cmds...) |
| 90 | + } |
| 91 | + |
| 92 | ++// handleKeyPressMsg processes keyboard input and routes to appropriate handlers. |
| 93 | + func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd { |
| 94 | + switch { |
| 95 | + // completions |
| 96 | +@@ -182,11 +187,7 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd { |
| 97 | + } |
| 98 | + } |
| 99 | + |
| 100 | +-// RegisterCommand adds a command to the command dialog |
| 101 | +-// func (a *appModel) RegisterCommand(cmd dialog.Command) { |
| 102 | +-// a.commands = append(a.commands, cmd) |
| 103 | +-// } |
| 104 | +- |
| 105 | ++// moveToPage handles navigation between different pages in the application. |
| 106 | + func (a *appModel) moveToPage(pageID page.PageID) tea.Cmd { |
| 107 | + if a.app.CoderAgent.IsBusy() { |
| 108 | + // For now we don't move to any page if the agent is busy |
| 109 | +@@ -209,6 +210,7 @@ func (a *appModel) moveToPage(pageID page.PageID) tea.Cmd { |
| 110 | + return tea.Batch(cmds...) |
| 111 | + } |
| 112 | + |
| 113 | ++// View renders the complete application interface including pages, dialogs, and overlays. |
| 114 | + func (a *appModel) View() tea.View { |
| 115 | + pageView := a.pages[a.currentPage].View() |
| 116 | + components := []string{ |
| 117 | +@@ -252,6 +254,7 @@ func (a *appModel) View() tea.View { |
| 118 | + return view |
| 119 | + } |
| 120 | + |
| 121 | ++// New creates and initializes a new TUI application model. |
| 122 | + func New(app *app.App) tea.Model { |
| 123 | + startPage := page.ChatPage |
| 124 | + model := &appModel{ |
0 commit comments