tui

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package tui provides a Bubble Tea TUI for revoco.

Package tui provides a Bubble Tea TUI for revoco.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForUpdatesCmd

func CheckForUpdatesCmd() tea.Cmd

CheckForUpdatesCmd returns a command that checks for both revoco and plugin updates.

Types

type AddConnectorModel

type AddConnectorModel struct {
	// contains filtered or unexported fields
}

AddConnectorModel is the wizard for adding a new connector.

func NewAddConnectorModel

func NewAddConnectorModel(sess *session.Session) AddConnectorModel

NewAddConnectorModel creates the add connector wizard.

func (AddConnectorModel) Init

func (m AddConnectorModel) Init() tea.Cmd

Init implements tea.Model.

func (AddConnectorModel) Update

func (m AddConnectorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (AddConnectorModel) View

func (m AddConnectorModel) View() string

View implements tea.Model.

type AnalyzeMode

type AnalyzeMode int

AnalyzeMode tells the analyzer which operation to proceed to on [Start].

const (
	AnalyzeModeProcess AnalyzeMode = iota
)

type AnalyzeModel

type AnalyzeModel struct {
	// contains filtered or unexported fields
}

AnalyzeModel is the pre-flight analyzer screen. It runs engine.Analyze in the background while showing a spinner, then displays the AnalysisResult summary and [Start] / [Cancel] buttons.

func NewAnalyzeModel

func NewAnalyzeModel(mode AnalyzeMode, source, dest, cookieJar, inputJSON, sessionDir string, width, height int) AnalyzeModel

NewAnalyzeModel creates a new AnalyzeModel for the given mode and inputs. sessionDir is the session folder for logs (empty string if no active session).

func NewAnalyzeModelFromSession

func NewAnalyzeModelFromSession(sess *session.Session) AnalyzeModel

NewAnalyzeModelFromSession creates an AnalyzeModel for a connector-based session. It analyzes the session's data directory where retrieved data is stored.

func (AnalyzeModel) Init

func (m AnalyzeModel) Init() tea.Cmd

Init implements tea.Model — starts the analyzer goroutine and the spinner.

func (AnalyzeModel) Update

func (m AnalyzeModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (AnalyzeModel) View

func (m AnalyzeModel) View() string

View implements tea.Model.

type App

type App struct {
	// contains filtered or unexported fields
}

App is the top-level Bubble Tea model that hosts all screens.

func NewApp

func NewApp() App

NewApp creates the TUI application starting on the Sessions screen.

func (App) Init

func (a App) Init() tea.Cmd

Init implements tea.Model.

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (App) View

func (a App) View() string

View implements tea.Model.

type ConfigConnectorModel

type ConfigConnectorModel struct {
	// contains filtered or unexported fields
}

ConfigConnectorModel is the screen for editing a connector's settings.

func NewConfigConnectorModel

func NewConfigConnectorModel(sess *session.Session, instanceID string) ConfigConnectorModel

NewConfigConnectorModel creates the connector configuration screen.

func (ConfigConnectorModel) Init

func (m ConfigConnectorModel) Init() tea.Cmd

Init implements tea.Model.

func (ConfigConnectorModel) Update

func (m ConfigConnectorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (ConfigConnectorModel) View

func (m ConfigConnectorModel) View() string

View implements tea.Model.

type DashboardModel

type DashboardModel struct {
	// contains filtered or unexported fields
}

DashboardModel is the main session view showing configured connectors.

func NewDashboardModel

func NewDashboardModel(sess *session.Session) DashboardModel

NewDashboardModel creates a new dashboard for a session.

func (DashboardModel) Init

func (m DashboardModel) Init() tea.Cmd

Init implements tea.Model.

func (DashboardModel) Update

func (m DashboardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (DashboardModel) View

func (m DashboardModel) View() string

View implements tea.Model.

type FirstRunModel added in v0.1.11

type FirstRunModel struct {
	// contains filtered or unexported fields
}

FirstRunModel is shown once when no config file exists.

func NewFirstRunModel added in v0.1.11

func NewFirstRunModel() FirstRunModel

NewFirstRunModel creates the first-run channel selection prompt.

func (FirstRunModel) Init added in v0.1.11

func (m FirstRunModel) Init() tea.Cmd

func (FirstRunModel) Update added in v0.1.11

func (m FirstRunModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (FirstRunModel) View added in v0.1.11

func (m FirstRunModel) View() string

type PluginUpdateInfo

type PluginUpdateInfo struct {
	ID             string
	CurrentVersion string
	LatestVersion  string
}

PluginUpdateInfo holds update info for a single plugin.

type ProcessModel

type ProcessModel struct {
	// contains filtered or unexported fields
}

ProcessModel is the TUI screen for a processing run. Layout: left panel (~40%) shows phase bars + sparkline,

right panel (~60%) shows the live log,
bottom bar shows stats.

func NewProcessModel

func NewProcessModel(source, dest, sessionDir string, width, height int) ProcessModel

NewProcessModel builds a ProcessModel ready to run. sessionDir, if non-empty, directs logs to the session folder.

func NewProcessModelFromSession

func NewProcessModelFromSession(sess *session.Session) ProcessModel

NewProcessModelFromSession creates a ProcessModel from a session. This extracts source/dest paths from the session configuration.

func (ProcessModel) Init

func (m ProcessModel) Init() tea.Cmd

Init implements tea.Model — starts the pipeline and a tick.

func (ProcessModel) Update

func (m ProcessModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (ProcessModel) View

func (m ProcessModel) View() string

View implements tea.Model — two-panel dashboard.

type PushModel

type PushModel struct {
	// contains filtered or unexported fields
}

PushModel is the output-to-destinations screen.

func NewPushModel

func NewPushModel(sess *session.Session) PushModel

NewPushModel creates the push/output screen.

func (PushModel) Init

func (m PushModel) Init() tea.Cmd

Init implements tea.Model.

func (PushModel) Update

func (m PushModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (PushModel) View

func (m PushModel) View() string

View implements tea.Model.

type RepairModel

type RepairModel struct {
	// contains filtered or unexported fields
}

RepairModel is the fallback-based repair screen.

func NewRepairModel

func NewRepairModel(sess *session.Session) RepairModel

NewRepairModel creates the repair screen.

func (RepairModel) Init

func (m RepairModel) Init() tea.Cmd

Init implements tea.Model.

func (RepairModel) Update

func (m RepairModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (RepairModel) View

func (m RepairModel) View() string

View implements tea.Model.

type RetrieveModel

type RetrieveModel struct {
	// contains filtered or unexported fields
}

RetrieveModel is the data retrieval progress screen.

func NewRetrieveModel

func NewRetrieveModel(sess *session.Session) RetrieveModel

NewRetrieveModel creates the retrieval progress screen.

func (RetrieveModel) Init

func (m RetrieveModel) Init() tea.Cmd

Init implements tea.Model.

func (RetrieveModel) Update

func (m RetrieveModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (RetrieveModel) View

func (m RetrieveModel) View() string

View implements tea.Model.

type Screen

type Screen int

Screen identifies which TUI screen is active.

const (
	ScreenSessions        Screen = iota // session management (landing)
	ScreenDashboard                     // main session view with connectors
	ScreenAddConnector                  // wizard to add a connector
	ScreenConfigConnector               // configure a connector instance
	ScreenRetrieve                      // data retrieval progress
	ScreenProcess                       // processing with processors
	ScreenAnalyze                       // statistics and analysis
	ScreenRepair                        // fallback-based repair
	ScreenPush                          // output to destinations
	ScreenUpdateConfirm                 // update confirmation dialog
	ScreenSettings                      // settings screen
	ScreenFirstRun                      // first-run channel selection
)

type SelfUpdateCompleteMsg

type SelfUpdateCompleteMsg struct {
	Success    bool
	NewVersion string
	Error      error
}

SelfUpdateCompleteMsg is sent when self-update finishes.

type SelfUpdateProgressMsg

type SelfUpdateProgressMsg struct {
	Stage   string // "downloading", "verifying", "installing"
	Percent int    // 0-100
}

SelfUpdateProgressMsg is sent during self-update.

type SelfUpdateStartMsg

type SelfUpdateStartMsg struct{}

SelfUpdateStartMsg is sent when self-update begins.

type SessionsModel

type SessionsModel struct {
	// contains filtered or unexported fields
}

SessionsModel is the TUI screen for managing sessions.

func NewSessionsModel

func NewSessionsModel() SessionsModel

NewSessionsModel creates the session management screen.

func (SessionsModel) Init

func (m SessionsModel) Init() tea.Cmd

Init implements tea.Model.

func (SessionsModel) Update

func (m SessionsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (SessionsModel) View

func (m SessionsModel) View() string

type SettingsModel added in v0.1.11

type SettingsModel struct {
	// contains filtered or unexported fields
}

SettingsModel is the screen for managing application settings.

func NewSettingsModel added in v0.1.11

func NewSettingsModel() SettingsModel

NewSettingsModel creates the settings screen.

func (SettingsModel) Init added in v0.1.11

func (m SettingsModel) Init() tea.Cmd

func (SettingsModel) Update added in v0.1.11

func (m SettingsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SettingsModel) View added in v0.1.11

func (m SettingsModel) View() string

type SwitchScreenMsg

type SwitchScreenMsg struct {
	To      Screen
	Session *session.Session // set when opening a session

	// Screen-specific data for initialization
	Dashboard       *DashboardModel
	AddConnector    *AddConnectorModel
	ConfigConnector *ConfigConnectorModel
	Retrieve        *RetrieveModel
	Process         *ProcessModel
	Analyze         *AnalyzeModel
	Repair          *RepairModel
	Push            *PushModel
}

SwitchScreenMsg is sent to navigate between screens.

type UpdateCheckMsg

type UpdateCheckMsg struct {
	// RevocoUpdate is the new version if available, empty if up-to-date
	RevocoUpdate string
	// PluginUpdates contains plugin IDs that have updates available
	PluginUpdates []PluginUpdateInfo
	// Error is set if the check failed
	Error error
}

UpdateCheckMsg is sent when update check completes.

type UpdateConfirmModel

type UpdateConfirmModel struct {
	// contains filtered or unexported fields
}

UpdateConfirmModel is a modal for confirming self-update.

func NewUpdateConfirmModel

func NewUpdateConfirmModel(currentVersion, newVersion string) UpdateConfirmModel

NewUpdateConfirmModel creates a new update confirmation modal.

func (UpdateConfirmModel) Init

func (m UpdateConfirmModel) Init() tea.Cmd

Init implements tea.Model.

func (UpdateConfirmModel) IsCancelled

func (m UpdateConfirmModel) IsCancelled() bool

IsCancelled returns true if user cancelled.

func (UpdateConfirmModel) IsConfirmed

func (m UpdateConfirmModel) IsConfirmed() bool

IsConfirmed returns true if user confirmed the update.

func (UpdateConfirmModel) Update

func (m UpdateConfirmModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (UpdateConfirmModel) View

func (m UpdateConfirmModel) View() string

View implements tea.Model.

type UpdateState

type UpdateState struct {
	// Checking is true while an update check is in progress
	Checking bool

	// RevocoUpdateAvailable is the new version if available
	RevocoUpdateAvailable string

	// PluginUpdatesAvailable holds plugins with available updates
	PluginUpdatesAvailable []PluginUpdateInfo

	// CheckError holds any error from the last check
	CheckError error

	// LastChecked is when the last check was performed
	LastChecked time.Time

	// Updating is true while a self-update is in progress
	Updating bool

	// UpdateStage describes the current update stage
	UpdateStage string

	// UpdateProgress is 0-100 during update
	UpdateProgress int
}

UpdateState holds the current state of update information for the TUI.

func (*UpdateState) HasUpdates

func (s *UpdateState) HasUpdates() bool

HasUpdates returns true if any updates are available.

func (*UpdateState) StatusLine

func (s *UpdateState) StatusLine() string

StatusLine returns a longer status line for display.

func (*UpdateState) UpdateBadge

func (s *UpdateState) UpdateBadge() string

UpdateBadge returns a short string for display in the header.

Directories

Path Synopsis
Package components provides reusable TUI widgets for revoco.
Package components provides reusable TUI widgets for revoco.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL