tui

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package tui implements the terminal UI: a stack of screens over the gitlabx service, built on Bubble Tea.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(deps Deps) error

Run starts the TUI and blocks until the user quits.

func SelectInstance added in v1.5.0

func SelectInstance(instances []config.Instance) (string, error)

SelectInstance runs a minimal inline picker over the configured GitLab instances and returns the chosen name. It runs before the main TUI starts because the GitLab client is built for the chosen instance.

Types

type App

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

App is the root Bubble Tea model: it owns the screen stack and window chrome and routes every other message to the top screen.

func NewApp

func NewApp(deps Deps) *App

NewApp builds the root model. With projects/groups configured the MR list is the bottom screen; otherwise a selector lists the user's available groups and projects to pick from.

func (*App) Init

func (a *App) Init() tea.Cmd

func (*App) Update

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

func (*App) View

func (a *App) View() tea.View

type CheckoutFunc

type CheckoutFunc = runner.CheckoutFunc

CheckoutFunc prepares a review worktree for an MR and returns its path plus a cleanup function. Progress lines go to the TUI's review log.

type Deps

type Deps struct {
	Cfg      config.Config
	Svc      gitlabx.Service
	Reviewer review.Reviewer
	Checkout CheckoutFunc
	CfgFor   func(projectPath string) config.Config
	// Logs stores each review run's progress log for later viewing; nil
	// disables both storing and the log screens' content.
	Logs *runlog.Store
	// Results stores each review's result with its curation states, so past
	// reviews can be reopened; nil disables storing and reopening.
	Results *resultstore.Store
	OpenURL func(url string) error
}

Deps bundles everything screens need. CfgFor resolves per-project overrides on top of the base configuration. OpenURL overrides the default browser launcher (tests inject a recorder).

type Screen

type Screen interface {
	Init() tea.Cmd
	Update(msg tea.Msg) (Screen, tea.Cmd)
	View() string
	Title() string
	// Hints is the contextual key help shown in the status bar.
	Hints() string
}

Screen is one screen on the navigation stack. Screens receive an adjusted WindowSizeMsg (content area only) and may emit pushScreenMsg/popScreenMsg commands to navigate.

Jump to

Keyboard shortcuts

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