Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ module github.com/moneycaringcoder/gitstream-tui

go 1.26.1

require (
github.com/blitui/blit v0.2.24
github.com/charmbracelet/bubbletea v1.3.10
github.com/charmbracelet/x/ansi v0.11.6
)
require github.com/blitui/blit v0.2.24

require (
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
Expand All @@ -15,13 +11,15 @@ require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/charmbracelet/bubbles v1.0.0 // indirect
github.com/charmbracelet/bubbletea v1.3.10 // indirect
github.com/charmbracelet/colorprofile v0.4.1 // indirect
github.com/charmbracelet/glamour v1.0.0 // indirect
github.com/charmbracelet/keygen v0.5.3 // indirect
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect
github.com/charmbracelet/log v0.4.1 // indirect
github.com/charmbracelet/ssh v0.0.0-20250128164007-98fd5ae11894 // indirect
github.com/charmbracelet/wish v1.4.7 // indirect
github.com/charmbracelet/x/ansi v0.11.6 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
github.com/charmbracelet/x/conpty v0.1.0 // indirect
github.com/charmbracelet/x/errors v0.0.0-20240508181413-e8d8b6e2de86 // indirect
Expand Down
10 changes: 4 additions & 6 deletions internal/ui/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"sort"
"strings"

tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/x/ansi"
blit "github.com/blitui/blit"
"github.com/blitui/blit/charts"
)
Expand All @@ -32,9 +30,9 @@ func NewDebugOverlay(debugLog *DebugLog) *DebugOverlay {
}
}

func (d *DebugOverlay) Init() tea.Cmd { return nil }
func (d *DebugOverlay) Init() blit.Cmd { return nil }

func (d *DebugOverlay) Update(msg tea.Msg, ctx blit.Context) (blit.Component, tea.Cmd) {
func (d *DebugOverlay) Update(msg blit.Msg, ctx blit.Context) (blit.Component, blit.Cmd) {
comp, cmd := d.logViewer.Update(msg, ctx)
if lv, ok := comp.(*blit.LogViewer); ok {
d.logViewer = lv
Expand Down Expand Up @@ -122,8 +120,8 @@ func (d *DebugOverlay) View() string {
lines = append(lines, "")
}
for i, line := range lines {
if ansi.StringWidth(line) > d.width {
lines[i] = ansi.Truncate(line, d.width, "")
if blit.StringWidth(line) > d.width {
lines[i] = blit.TruncateWith(line, d.width, "")
}
}

Expand Down
7 changes: 3 additions & 4 deletions internal/ui/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"sort"
"strings"

tea "github.com/charmbracelet/bubbletea"
blit "github.com/blitui/blit"
"github.com/moneycaringcoder/gitstream-tui/internal/gitstatus"
)
Expand Down Expand Up @@ -47,11 +46,11 @@ func NewStatusPanel() *StatusPanel {
return p
}

func (p *StatusPanel) Init() tea.Cmd { return nil }
func (p *StatusPanel) Init() blit.Cmd { return nil }

func (p *StatusPanel) Update(msg tea.Msg, ctx blit.Context) (blit.Component, tea.Cmd) {
func (p *StatusPanel) Update(msg blit.Msg, ctx blit.Context) (blit.Component, blit.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
case blit.KeyMsg:
if msg.String() == "enter" || msg.String() == " " {
idx := p.listView.CursorIndex()
if remote, ok := p.headerMap[idx]; ok {
Expand Down
13 changes: 6 additions & 7 deletions internal/ui/polling.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"os/exec"
"sync"

tea "github.com/charmbracelet/bubbletea"
blit "github.com/blitui/blit"
"github.com/moneycaringcoder/gitstream-tui/internal/config"
"github.com/moneycaringcoder/gitstream-tui/internal/discovery"
Expand Down Expand Up @@ -51,8 +50,8 @@ func trimNewline(s string) string {

// pollEvents uses blit.HTTPResource to fetch GitHub events with ETag caching,
// rate-limit tracking, and response fallback.
func pollEvents(cfg *config.Config, debugLog *DebugLog, initial bool) tea.Cmd {
return func() tea.Msg {
func pollEvents(cfg *config.Config, debugLog *DebugLog, initial bool) blit.Cmd {
return func() blit.Msg {
token := githubToken()
repos := cfg.Repos()
pages := 1
Expand Down Expand Up @@ -161,15 +160,15 @@ func pollEvents(cfg *config.Config, debugLog *DebugLog, initial bool) tea.Cmd {
}
}

func discoverRepos(cfg *config.Config) tea.Cmd {
return func() tea.Msg {
func discoverRepos(cfg *config.Config) blit.Cmd {
return func() blit.Msg {
repos := discovery.Discover(cfg.Repos(), cfg.ExplicitPaths())
return discoveryMsg{repos: repos}
}
}

func pollGitStatus(repos []discovery.LocalRepo) tea.Cmd {
return func() tea.Msg {
func pollGitStatus(repos []discovery.LocalRepo) blit.Cmd {
return func() blit.Msg {
var wg sync.WaitGroup
statuses := make([]gitstatus.RepoStatus, len(repos))
for i, r := range repos {
Expand Down
25 changes: 12 additions & 13 deletions internal/ui/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"strings"
"time"

tea "github.com/charmbracelet/bubbletea"
blit "github.com/blitui/blit"
"github.com/moneycaringcoder/gitstream-tui/internal/config"
"github.com/moneycaringcoder/gitstream-tui/internal/discovery"
Expand Down Expand Up @@ -125,28 +124,28 @@ func NewEventStream(cfg *config.Config, debugLog *DebugLog) *EventStream {

s.poller = blit.NewPoller(
time.Duration(cfg.Interval)*time.Second,
func() tea.Cmd {
cmds := []tea.Cmd{pollEvents(cfg, debugLog, false)}
func() blit.Cmd {
cmds := []blit.Cmd{pollEvents(cfg, debugLog, false)}
if len(s.localRepos) > 0 {
cmds = append(cmds, pollGitStatus(s.localRepos))
}
return tea.Batch(cmds...)
return blit.Batch(cmds...)
},
)

return s
}

func (s *EventStream) Init() tea.Cmd {
return tea.Batch(
func (s *EventStream) Init() blit.Cmd {
return blit.Batch(
pollEvents(s.cfg, s.debugLog, true),
discoverRepos(s.cfg),
)
}

func (s *EventStream) Update(msg tea.Msg, ctx blit.Context) (blit.Component, tea.Cmd) {
func (s *EventStream) Update(msg blit.Msg, ctx blit.Context) (blit.Component, blit.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
case blit.KeyMsg:
// Enter opens detail overlay instead of browser
if msg.String() == "enter" && s.DetailOverlay != nil {
idx := s.table.CursorIndex()
Expand All @@ -170,7 +169,7 @@ func (s *EventStream) Update(msg tea.Msg, ctx blit.Context) (blit.Component, tea
idx := s.table.CursorIndex()
if idx >= 0 && idx < len(s.filteredEvents) {
if url := s.filteredEvents[idx].Event.URL(); url != "" {
return s, tea.Batch(
return s, blit.Batch(
blit.CopyToClipboardCmd(url),
blit.ToastSuccess("Copied", url),
blit.Consumed(),
Expand Down Expand Up @@ -227,7 +226,7 @@ func (s *EventStream) Update(msg tea.Msg, ctx blit.Context) (blit.Component, tea
return s, nil
}

func (s *EventStream) handleEvents(msg eventsMsg) (blit.Component, tea.Cmd) {
func (s *EventStream) handleEvents(msg eventsMsg) (blit.Component, blit.Cmd) {
for _, e := range msg.errors {
s.debugLog.Error("%s", e)
}
Expand Down Expand Up @@ -264,7 +263,7 @@ func (s *EventStream) handleEvents(msg eventsMsg) (blit.Component, tea.Cmd) {
}
}

var cmds []tea.Cmd
var cmds []blit.Cmd

if newCount > 0 && !s.isAtNewEdge() {
cmds = append(cmds, blit.ToastInfo("New events",
Expand All @@ -285,10 +284,10 @@ func (s *EventStream) handleEvents(msg eventsMsg) (blit.Component, tea.Cmd) {
}
}

return s, tea.Batch(cmds...)
return s, blit.Batch(cmds...)
}

func (s *EventStream) handleGitStatus(msg gitStatusMsg) (blit.Component, tea.Cmd) {
func (s *EventStream) handleGitStatus(msg gitStatusMsg) (blit.Component, blit.Cmd) {
now := time.Now()
newLocal := 0
for _, st := range msg.statuses {
Expand Down
Loading