tui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package tui is the GopherTrunk TUI — a read-only operator view over the daemon's REST + SSE API. The root Model dispatches keystrokes to one of eight panels and runs a fan of polling Cmds + a long-lived SSE pump to keep its SharedState fresh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is the root bubbletea model.

func New

func New(cli *client.Client, opts Options) *Model

New constructs a Model pointed at cli.

func (*Model) Init

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

Init kicks off the initial polling fan + SSE connect.

func (*Model) Update

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

Update is the bubbletea reducer. Order matters: window/quit/help are handled at the root, then SSE/poll msgs update SharedState, then the active panel gets the message.

func (*Model) View

func (m *Model) View() string

View renders the chrome (tabs, status bar) and delegates the body to the active panel.

type Options

type Options struct {
	NoColor bool
	// Write enables the TUI's mutation keybindings. AND-ed with
	// the daemon's /api/v1/mutations capability — both must agree
	// for write-side keys to fire.
	Write bool
}

Options controls the TUI's startup behaviour.

type RingBuf

type RingBuf[T any] struct {
	// contains filtered or unexported fields
}

RingBuf is a fixed-capacity FIFO. Push overwrites the oldest entry once the buffer is full. Snapshot returns a copy of the entries in chronological (oldest-first) order.

func NewRingBuf

func NewRingBuf[T any](cap int) *RingBuf[T]

NewRingBuf returns a buffer of the given capacity.

func (*RingBuf[T]) Clear

func (r *RingBuf[T]) Clear()

func (*RingBuf[T]) Latest

func (r *RingBuf[T]) Latest(n int) []T

Latest returns up to n most-recent entries, newest first. If n is zero or larger than the buffer, the whole buffer is returned.

func (*RingBuf[T]) Len

func (r *RingBuf[T]) Len() int

func (*RingBuf[T]) Push

func (r *RingBuf[T]) Push(v T)

func (*RingBuf[T]) Snapshot

func (r *RingBuf[T]) Snapshot() []T

Directories

Path Synopsis
Package client is the TUI's network layer.
Package client is the TUI's network layer.
Package panels contains the eight read-only panels rendered by the TUI.
Package panels contains the eight read-only panels rendered by the TUI.
Package state holds the SharedState struct and PanelKind enum so the root tui package and panels sub-package can both import it without an import cycle.
Package state holds the SharedState struct and PanelKind enum so the root tui package and panels sub-package can both import it without an import cycle.
Package theme owns the TUI's semantic colour palette and the derived high-level lipgloss styles.
Package theme owns the TUI's semantic colour palette and the derived high-level lipgloss styles.

Jump to

Keyboard shortcuts

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