tui

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 36 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tui is `otag tui`: a full-screen view of projects, tasks and runs with a live preview of the selected agent's pane. State comes from the database, never from the screen; the TUI itself only reads it. Actions go through the CLI's own command code, handed in as Options.Call, so the import direction stays cli → tui.

Design: docs/TUI.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(parent context.Context, o Options) error

Run shows the TUI until the user quits or parent ends.

Types

type Model

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

Model is the root model. Update is pure apart from the Cmds it returns: every database, tmux or backend call runs in a Cmd.

func (*Model) Init

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

Init starts the periodic jobs. Each is a one-shot tick that reschedules itself once its result arrives, so nothing piles up while the event loop is busy.

func (*Model) Update

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

Update handles one message.

func (*Model) View

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

View renders the screen. The layout's blocks tile it, so without an overlay the frame is their lines side by side; with one, Lip Gloss layers compose them.

type Options

type Options struct {
	DB      *db.DB       // the same handle the backend uses
	Tmux    *tmux.Client // otag's socket (paths.TmuxSocket / TmuxConf)
	Getenv  func(string) string
	DataDir string
	Project string // initial selection (--project, else the project of the cwd)
	// Call runs a mutation through the CLI command table, with --json and the given
	// --request-id, never cancelled once started.
	Call func(ctx context.Context, args ...string) Outcome
	// Text runs a read command and returns its human output (Details, Stats).
	Text func(ctx context.Context, args ...string) (string, error)
	// Environ is the environment an attach runs with (default os.Environ).
	Environ func() []string
	// Unconfigured: otag has no registry yet; the empty tree points to `otag init`.
	Unconfigured bool
	// AddDir is the git repository the TUI was started in, when no project uses it:
	// the empty tree offers it and key a runs `otag project add` for it.
	AddDir string
}

Options wire the TUI to otag.

type Outcome

type Outcome struct {
	Data  any           // res.data exactly as --json would carry it
	Human string        // the human output: toast and Log text
	Err   *apperr.Error // code, message, retryable
}

Outcome is the result of Options.Call.

type Rect

type Rect struct{ X, Y, W, H int }

Rect is a screen rectangle in cells.

func (Rect) Contains

func (r Rect) Contains(x, y int) bool

Contains reports whether the cell (x, y) is inside r.

func (Rect) Intersect

func (r Rect) Intersect(o Rect) Rect

Intersect is the part of r inside o (empty: zero width or height).

Directories

Path Synopsis
Package attach plans the TUI's full-screen attach to an agent's window (docs/TUI.md "Full-screen attach"): a nested tmux client of otag's server run with tea.ExecProcess, or, inside the user's own tmux, a full-screen display-popup that runs that client.
Package attach plans the TUI's full-screen attach to an agent's window (docs/TUI.md "Full-screen attach"): a nested tmux client of otag's server run with tea.ExecProcess, or, inside the user's own tmux, a full-screen display-popup that runs that client.
Package data reads what the TUI shows: an immutable Snapshot taken in one read transaction, a Watcher that notices commits made by any other connection, and pane liveness.
Package data reads what the TUI shows: an immutable Snapshot taken in one read transaction, a Watcher that notices commits made by any other connection, and pane liveness.
Package fixture is a hand-built data.Snapshot for the TUI's unit and golden tests: every row kind, at a fixed time.
Package fixture is a hand-built data.Snapshot for the TUI's unit and golden tests: every row kind, at a fixed time.
Package form is the TUI's dialog kit: text fields, text areas, selects, checkboxes, pick lists, read-only notes and buttons.
Package form is the TUI's dialog kit: text fields, text areas, selects, checkboxes, pick lists, read-only notes and buttons.
Package preview holds the TUI's view of one agent pane: the last capture, sanitized to text and SGR colours, cropped to the preview's size, with a live (follow) mode and a scroll-locked history mode.
Package preview holds the TUI's view of one agent pane: the last capture, sanitized to text and SGR colours, cropped to the preview's size, with a live (follow) mode and a scroll-locked history mode.
Package style holds the TUI's colours, status glyphs and small text helpers.
Package style holds the TUI's colours, status glyphs and small text helpers.
Package tabs renders the right-hand tabs other than the preview: Needs and Inbox as items with inline actions, and the text of Details and Stats.
Package tabs renders the right-hand tabs other than the preview: Needs and Inbox as items with inline actions, and the text of Details and Stats.
Package tree flattens a data.Snapshot into the rows of the TUI's left pane: projects, their coordinator, the "Ready to deliver" group, tasks by attention, review tasks under the task they review, and runs under their task.
Package tree flattens a data.Snapshot into the rows of the TUI's left pane: projects, their coordinator, the "Ready to deliver" group, tasks by attention, review tasks under the task they review, and runs under their task.
Package tuitest builds isolated otag environments for the TUI's tests: a temporary database, config and data dir, a private tmux socket, and the fake harness.
Package tuitest builds isolated otag environments for the TUI's tests: a temporary database, config and data dir, a private tmux socket, and the fake harness.
pastecheck command
Command pastecheck is a test stand-in for an agent's input box with paste detection, the way Claude and Codex judge it: in raw mode, an Enter that arrives in the same read as text, or less than a threshold after the last text, is part of a paste and becomes a newline; only an Enter on its own submits.
Command pastecheck is a test stand-in for an agent's input box with paste detection, the way Claude and Codex judge it: in raw mode, an Enter that arrives in the same read as text, or less than a threshold after the last text, is part of a paste and becomes a newline; only an Enter on its own submits.
Package typing is the TUI's typing mode (docs/TUI.md "Typing mode"): key events encoded for `tmux send-keys`, and the sender that delivers them to an agent's pane one tmux command per key, in order, holding Enter back until the agent can no longer take it for part of a paste.
Package typing is the TUI's typing mode (docs/TUI.md "Typing mode"): key events encoded for `tmux send-keys`, and the sender that delivers them to an agent's pane one tmux command per key, in order, holding Enter back until the agent can no longer take it for part of a paste.
Package wizard is otag's setup wizard (`otag init`, bare `otag` on a fresh machine, and the confirm step of `otag project add`): a short sequence of form pages built with the TUI's dialog kit (internal/tui/form) and theme.
Package wizard is otag's setup wizard (`otag init`, bare `otag` on a fresh machine, and the confirm step of `otag project add`): a short sequence of form pages built with the TUI's dialog kit (internal/tui/form) and theme.

Jump to

Keyboard shortcuts

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