Help us shape the future of Go! Take the 2026 Go Developer Survey

tui

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 47 Imported by: 0

Documentation

Overview

Package-level UI helpers: small render primitives that don't fit cleanly into any one feature module. Today this holds the key-chip pill renderer (used in modal footers and toast actions) and the spinner glyph picker (used in the status area when an action is in flight).

Index

Constants

This section is empty.

Variables

View Source
var KeptAwakeBy = func(string) []string { return nil }

KeptAwakeBy names the pinned sites keeping a service awake. The CLI wires in the idle engine's walk, which this package cannot import without a cycle.

Functions

func Run

func Run(version string) error

Run starts the bubbletea program with the shared podman cache warmed up. Called from cli.NewTuiCmd so the wiring lives next to the rest of the command registry.

Types

type ActionResult

type ActionResult struct {
	Summary string
	Err     error
	Detail  string
}

ActionResult is emitted when an async action (start/stop/restart) finishes. The status bar renders Err/Detail so the user sees failures without dropping out of the TUI.

type DumpEntry added in v1.20.0

type DumpEntry struct {
	ID      string
	TS      string
	Type    string
	Site    string
	Request string
	File    string
	Line    int
	Label   string
	Text    string
}

DumpEntry is a TUI-side mirror of dumps.Event with the fields rendering needs cached as strings so the View path doesn't allocate per frame.

type LogKind

type LogKind int

LogKind picks between `podman logs` (containers), `journalctl --user` (worker systemd units), and `tail -F` (framework app log files). Workers don't run as containers so their output lives in the user journal; sites and services do, and their history is richer when pulled from podman; framework app logs (laravel.log, etc.) live on disk because the framework writes them directly.

type LogTarget

type LogTarget struct {
	Kind  LogKind
	ID    string
	Label string
}

LogTarget fully describes one tail-able source: what to tail, how to tail it, and how to label it in the pane header.

type Model

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

Model is the bubbletea root. Panes are all projections of snap plus small per-pane cursor/scroll state, so every refresh cycle rebuilds from a single source of truth without stale data.

func NewModel

func NewModel(version string) *Model

NewModel builds an initial model. The caller is expected to call podman.Cache.Start before running; NewModel itself is pure.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init implements tea.Model. Kicks off the first snapshot load, the refresh ticker, the eventbus subscription, a one-shot update check, and the spinner tick (a perpetual 100ms heartbeat so the spinner glyph stays animated whenever a "…" status is showing).

func (*Model) Update

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

Update implements tea.Model.

func (*Model) View

func (m *Model) View() tea.View

View implements tea.Model. View wraps the rendered frame in a tea.View, carrying the alt-screen and mouse settings that bubbletea v2 moved off program options and onto the view.

type ServiceRow

type ServiceRow struct {
	Name    string
	Version string
	State   ServiceState
	Custom  bool
	Pinned  bool
	// KeptAwakeBy names the pinned sites keeping the service from sleeping.
	KeptAwakeBy []string
	SiteCount   int
	Dashboard   string
	DependsOn   []string

	WorkerSite string
	WorkerKind string
	WorkerPath string
}

ServiceRow is a flat row for the services pane. Sourced from podman unit status and service config so the TUI doesn't need to reach into ui/server.go. For site-owned workers (queue, schedule, horizon, reverb, custom framework workers) WorkerSite / WorkerKind are set so actions can run the right per-site command instead of `lerd service start/stop` which would fail.

type ServiceState

type ServiceState int

ServiceState is a tri-state the TUI uses to pick a glyph and colour.

type Snapshot

type Snapshot struct {
	Sites    []siteinfo.EnrichedSite
	Services []ServiceRow
	Status   StatusRow
	// Workspaces group sites for display only, in the order the user's config
	// lists them. The TUI shows them and never edits them.
	Workspaces []config.Workspace
	// Private names the sites streaming mode hides whenever it is on, so the
	// activity diff can tell one leaving or returning from an unlink or a link.
	Private map[string]bool
	// Pinned names the sites excluded from idle-suspend.
	Pinned map[string]bool
	// IdleSuspend and IdleServices say whether sites and services can sleep,
	// which is the only time a pin is worth showing.
	IdleSuspend, IdleServices bool
	// HorizonReload names the sites whose horizon restarts on code changes.
	HorizonReload map[string]bool
}

Snapshot is the full view-model the TUI renders from. Produced by loadSnapshot from the same sources lerd-ui uses, so every pane reflects the same point-in-time state.

type StatusRow

type StatusRow struct {
	DNSOk          bool
	DNSDegraded    bool
	DNSDisabled    bool
	TLD            string
	NginxRunning   bool
	WatcherRunning bool
	PHPRunning     []string
	Version        string
	Autostart      bool
	LANExposed     bool
}

StatusRow drives the top header bar.

Jump to

Keyboard shortcuts

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