From b3a401927c61a600cdafadbd7bc43e78f1161cd0 Mon Sep 17 00:00:00 2001 From: Amolith Date: Tue, 9 Dec 2025 11:36:56 -0700 Subject: [PATCH] refactor(update): remove legacy update check Assisted-by: Claude Opus 4.5 via Crush --- internal/app/app.go | 21 --------------------- internal/pubsub/events.go | 7 ------- internal/tui/tui.go | 14 -------------- internal/update/update_test.go | 1 - 4 files changed, 43 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index 1694a0ecb39266cdd4676a346cfdeaa2be47579a..b3ae879b9e5bbfdb8bc53cf079fae58a1f34ff44 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -33,8 +33,6 @@ import ( "github.com/charmbracelet/crush/internal/term" "github.com/charmbracelet/crush/internal/tui/components/anim" "github.com/charmbracelet/crush/internal/tui/styles" - "github.com/charmbracelet/crush/internal/update" - "github.com/charmbracelet/crush/internal/version" "github.com/charmbracelet/x/ansi" "github.com/charmbracelet/x/exp/charmtone" ) @@ -94,9 +92,6 @@ func New(ctx context.Context, conn *sql.DB, cfg *config.Config) (*App, error) { // Initialize LSP clients in the background. app.initLSPClients(ctx) - // Check for updates in the background. - go app.checkForUpdates(ctx) - go func() { slog.Info("Initializing MCP clients") mcp.Initialize(ctx, app.Permissions, cfg) @@ -410,19 +405,3 @@ func (app *App) Shutdown() { } wg.Wait() } - -// checkForUpdates checks for available updates. -func (app *App) checkForUpdates(ctx context.Context) { - checkCtx, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() - - info, err := update.Check(checkCtx, version.Version, update.Default) - if err != nil || !info.Available() { - return - } - app.events <- pubsub.UpdateAvailableMsg{ - CurrentVersion: info.Current, - LatestVersion: info.Latest, - IsDevelopment: info.IsDevelopment(), - } -} diff --git a/internal/pubsub/events.go b/internal/pubsub/events.go index dadecaa14545337404c15000da37fbd5901932df..2fb0a741353bfc5054641815da9ad3292f49e6a3 100644 --- a/internal/pubsub/events.go +++ b/internal/pubsub/events.go @@ -26,10 +26,3 @@ type ( Publish(EventType, T) } ) - -// UpdateAvailableMsg is sent when a new version is available. -type UpdateAvailableMsg struct { - CurrentVersion string - LatestVersion string - IsDevelopment bool -} diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 45f0ae5ec410e85b3d30d620b4db5c499cff09c3..0ac5d2ab4b3fbec145ffdc30264d34a865717222 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -384,20 +384,6 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds = append(cmds, pageCmd) } return a, tea.Batch(cmds...) - // Update Available - case pubsub.UpdateAvailableMsg: - // Show update notification in status bar - statusMsg := fmt.Sprintf("Crush update available: v%s → v%s.", msg.CurrentVersion, msg.LatestVersion) - if msg.IsDevelopment { - statusMsg = fmt.Sprintf("This is a development version of Crush. The latest version is v%s.", msg.LatestVersion) - } - s, statusCmd := a.status.Update(util.InfoMsg{ - Type: util.InfoTypeUpdate, - Msg: statusMsg, - TTL: 10 * time.Second, - }) - a.status = s.(status.StatusCmp) - return a, statusCmd } s, _ := a.status.Update(msg) a.status = s.(status.StatusCmp) diff --git a/internal/update/update_test.go b/internal/update/update_test.go index 7b47b7ba4d5c98fb72adaf5b129e829cbd92cc59..1a44b58ac45e75b3ebc83e3662f578753ef0b110 100644 --- a/internal/update/update_test.go +++ b/internal/update/update_test.go @@ -718,4 +718,3 @@ func TestCopyWithContext(t *testing.T) { require.Equal(t, int64(0), n) }) } -