ui

package
v0.0.0-...-b74b5fa Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package ui provides an embeddable Bubble Tea component for interactive code review.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App is the main Bubble Tea model for the code review TUI.

func NewApp

func NewApp(backend vcs.Backend, files []model.DiffFile, session *model.ReviewSession, th theme.Theme, opts ...Option) App

NewApp creates a new App model.

func NewAppWithCommits

func NewAppWithCommits(backend vcs.Backend, commits []vcs.CommitInfo, commitDiffs map[string][]model.DiffFile, enabledCommits map[string]bool, includesWorkTree bool, session *model.ReviewSession, th theme.Theme, opts ...Option) App

NewAppWithCommits creates a new App with pre-populated commit list data. commits should be in newest-first order. commitDiffs maps commit IDs (and "worktree") to their individual diffs. enabledCommits indicates which are initially enabled.

func NewPickerApp

func NewPickerApp(backend vcs.Backend, th theme.Theme, opts ...Option) App

NewPickerApp creates an App that starts in the commit picker phase.

func NewProviderApp

func NewProviderApp(
	backend vcs.Backend,
	p provider.Provider,
	id string,
	th theme.Theme,
	opts ...Option,
) App

NewProviderApp creates an App that starts in the loading phase and fetches provider data asynchronously.

func (App) Init

func (a App) Init() tea.Cmd

Init implements tea.Model.

func (*App) SetSize

func (a *App) SetSize(width, height int)

SetSize sets the component's dimensions. Call this from the parent model when the available size changes (e.g. in response to tea.WindowSizeMsg).

func (App) Update

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

Update handles a tea.Msg and returns the updated App and any command.

func (App) View

func (a App) View() tea.View

View implements tea.Model.

type ClipboardMsg

type ClipboardMsg struct {
	Content string
}

ClipboardMsg is emitted when the component wants to copy text to the clipboard.

type DoneMsg

type DoneMsg struct {
	Session *model.ReviewSession
	Err     error
}

DoneMsg is emitted when the component wants to close. Session contains the final review state (nil if no review was started). Err is set if the component encountered a fatal error (e.g. provider loading failed).

type Option

type Option func(*App)

Option configures an App during construction.

func WithCommits

func WithCommits(commits []vcs.CommitInfo, diffs map[string][]model.DiffFile) Option

WithCommits populates the commit list and per-commit diffs. commits should be newest-first. All commits are enabled by default. NOTE: This option must be applied after the App's diffFiles are set (i.e. it is intended for use with NewApp, not NewAppWithCommits).

func WithHighlighter

func WithHighlighter(hl *syntax.Highlighter) Option

WithHighlighter sets the syntax highlighter.

func WithLogger

func WithLogger(log *slog.Logger) Option

WithLogger sets the logger. Defaults to slog.Default().

func WithProvider

func WithProvider(p provider.Provider, id string) Option

WithProvider sets the remote provider and review request ID.

func WithStore

func WithStore(store persistence.Store) Option

WithStore sets the persistence store.

Jump to

Keyboard shortcuts

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