Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01050a4

Browse files
committed
wip: refactoring tui
1 parent 0b565b1 commit 01050a4

60 files changed

Lines changed: 115 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
.DS_Store
12
node_modules
23
.opencode
34
.sst
4-
app.log
55
.env

packages/tui/cmd/opencode/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010

1111
tea "github.com/charmbracelet/bubbletea"
1212
zone "github.com/lrstanley/bubblezone"
13+
"github.com/sst/opencode/internal/app"
1314
"github.com/sst/opencode/internal/pubsub"
1415
"github.com/sst/opencode/internal/tui"
15-
"github.com/sst/opencode/internal/tui/app"
1616
"github.com/sst/opencode/pkg/client"
1717
)
1818

@@ -46,7 +46,7 @@ func main() {
4646
ctx, cancel := context.WithCancel(context.Background())
4747
defer cancel()
4848

49-
app, err := app.New(ctx, httpClient)
49+
app_, err := app.New(ctx, httpClient)
5050
if err != nil {
5151
slog.Error("Failed to create app", "error", err)
5252
// return err
@@ -55,7 +55,7 @@ func main() {
5555
// Set up the TUI
5656
zone.NewGlobal()
5757
program := tea.NewProgram(
58-
tui.New(app),
58+
tui.NewModel(app_),
5959
tea.WithAltScreen(),
6060
)
6161

@@ -78,7 +78,7 @@ func main() {
7878
}()
7979

8080
// Setup the subscriptions, this will send services events to the TUI
81-
ch, cancelSubs := setupSubscriptions(app, ctx)
81+
ch, cancelSubs := setupSubscriptions(app_, ctx)
8282

8383
// Create a context for the TUI message handler
8484
tuiCtx, tuiCancel := context.WithCancel(ctx)
@@ -113,7 +113,7 @@ func main() {
113113
cancelSubs()
114114

115115
// Then shutdown the app
116-
app.Shutdown()
116+
app_.Shutdown()
117117

118118
// Then cancel TUI message handler
119119
tuiCancel()
6 KB
Binary file not shown.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
"log/slog"
1010

1111
tea "github.com/charmbracelet/bubbletea"
12+
"github.com/sst/opencode/internal/config"
1213
"github.com/sst/opencode/internal/fileutil"
14+
"github.com/sst/opencode/internal/state"
1315
"github.com/sst/opencode/internal/status"
14-
"github.com/sst/opencode/internal/tui/config"
15-
"github.com/sst/opencode/internal/tui/state"
16-
"github.com/sst/opencode/internal/tui/theme"
17-
"github.com/sst/opencode/internal/tui/util"
16+
"github.com/sst/opencode/internal/theme"
17+
"github.com/sst/opencode/internal/util"
1818
"github.com/sst/opencode/pkg/client"
1919
)
2020

packages/tui/internal/completions/files-folders.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/lithammer/fuzzysearch/fuzzy"
1010
"github.com/sst/opencode/internal/fileutil"
1111
"github.com/sst/opencode/internal/status"
12-
"github.com/sst/opencode/internal/tui/components/dialog"
12+
"github.com/sst/opencode/internal/components/dialog"
1313
)
1414

1515
type filesAndFoldersContextGroup struct {

packages/tui/internal/tui/components/chat/chat.go renamed to packages/tui/internal/components/chat/chat.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66

77
"github.com/charmbracelet/lipgloss"
88
"github.com/charmbracelet/x/ansi"
9-
"github.com/sst/opencode/internal/tui/app"
10-
"github.com/sst/opencode/internal/tui/styles"
11-
"github.com/sst/opencode/internal/tui/theme"
9+
"github.com/sst/opencode/internal/app"
10+
"github.com/sst/opencode/internal/styles"
11+
"github.com/sst/opencode/internal/theme"
1212
)
1313

1414
type SendMsg struct {

packages/tui/internal/tui/components/chat/editor.go renamed to packages/tui/internal/components/chat/editor.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import (
1313
"github.com/charmbracelet/bubbles/textarea"
1414
tea "github.com/charmbracelet/bubbletea"
1515
"github.com/charmbracelet/lipgloss"
16+
"github.com/sst/opencode/internal/app"
17+
"github.com/sst/opencode/internal/components/dialog"
18+
"github.com/sst/opencode/internal/image"
19+
"github.com/sst/opencode/internal/layout"
1620
"github.com/sst/opencode/internal/status"
17-
"github.com/sst/opencode/internal/tui/app"
18-
"github.com/sst/opencode/internal/tui/components/dialog"
19-
"github.com/sst/opencode/internal/tui/image"
20-
"github.com/sst/opencode/internal/tui/layout"
21-
"github.com/sst/opencode/internal/tui/styles"
22-
"github.com/sst/opencode/internal/tui/theme"
23-
"github.com/sst/opencode/internal/tui/util"
21+
"github.com/sst/opencode/internal/styles"
22+
"github.com/sst/opencode/internal/theme"
23+
"github.com/sst/opencode/internal/util"
2424
)
2525

2626
type editorCmp struct {

packages/tui/internal/tui/components/chat/message.go renamed to packages/tui/internal/components/chat/message.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88

99
"github.com/charmbracelet/lipgloss"
1010
"github.com/charmbracelet/x/ansi"
11-
"github.com/sst/opencode/internal/tui/components/diff"
12-
"github.com/sst/opencode/internal/tui/styles"
13-
"github.com/sst/opencode/internal/tui/theme"
11+
"github.com/sst/opencode/internal/components/diff"
12+
"github.com/sst/opencode/internal/styles"
13+
"github.com/sst/opencode/internal/theme"
1414
"github.com/sst/opencode/pkg/client"
1515
"golang.org/x/text/cases"
1616
"golang.org/x/text/language"

packages/tui/internal/tui/components/chat/messages.go renamed to packages/tui/internal/components/chat/messages.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"github.com/charmbracelet/bubbles/viewport"
1010
tea "github.com/charmbracelet/bubbletea"
1111
"github.com/charmbracelet/lipgloss"
12-
"github.com/sst/opencode/internal/tui/app"
13-
"github.com/sst/opencode/internal/tui/components/dialog"
14-
"github.com/sst/opencode/internal/tui/state"
15-
"github.com/sst/opencode/internal/tui/styles"
16-
"github.com/sst/opencode/internal/tui/theme"
12+
"github.com/sst/opencode/internal/app"
13+
"github.com/sst/opencode/internal/components/dialog"
14+
"github.com/sst/opencode/internal/state"
15+
"github.com/sst/opencode/internal/styles"
16+
"github.com/sst/opencode/internal/theme"
1717
"github.com/sst/opencode/pkg/client"
1818
)
1919

packages/tui/internal/tui/components/chat/sidebar.go renamed to packages/tui/internal/components/chat/sidebar.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77

88
tea "github.com/charmbracelet/bubbletea"
99
"github.com/charmbracelet/lipgloss"
10-
"github.com/sst/opencode/internal/tui/app"
11-
"github.com/sst/opencode/internal/tui/state"
12-
"github.com/sst/opencode/internal/tui/styles"
13-
"github.com/sst/opencode/internal/tui/theme"
10+
"github.com/sst/opencode/internal/app"
11+
"github.com/sst/opencode/internal/state"
12+
"github.com/sst/opencode/internal/styles"
13+
"github.com/sst/opencode/internal/theme"
1414
)
1515

1616
type sidebarCmp struct {

0 commit comments

Comments
 (0)