app

package
v1.11.2 Latest Latest
Warning

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

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

Documentation

Overview

Package app provides the main application UI and logic using Bubble Tea.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandPaletteScreen

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

CommandPaletteScreen lets the user pick a command from a filtered list.

func NewCommandPaletteScreen

func NewCommandPaletteScreen(items []paletteItem, thm *theme.Theme) *CommandPaletteScreen

NewCommandPaletteScreen builds a palette populated with candidate commands.

func (*CommandPaletteScreen) Init

func (s *CommandPaletteScreen) Init() tea.Cmd

Init configures the palette input before Bubble Tea updates begin.

func (*CommandPaletteScreen) Selected

func (s *CommandPaletteScreen) Selected() (string, bool)

Selected reports the current palette selection if one exists.

func (*CommandPaletteScreen) Update

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

Update handles updates for the command palette

func (*CommandPaletteScreen) View

func (s *CommandPaletteScreen) View() string

View displays the palette items and current filter text.

type CommitScreen

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

CommitScreen displays metadata, stats, and diff details for a single commit.

func NewCommitScreen

func NewCommitScreen(meta commitMeta, stat, diff string, useDelta bool, thm *theme.Theme) *CommitScreen

NewCommitScreen configures the commit detail viewer for the selected SHA.

func (*CommitScreen) Init

func (s *CommitScreen) Init() tea.Cmd

Init satisfies tea.Model.Init for the commit detail view.

func (*CommitScreen) Update

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

Update handles scrolling and closing events for the commit screen.

func (*CommitScreen) View

func (s *CommitScreen) View() string

View renders the commit screen

type ConfirmScreen

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

ConfirmScreen displays a modal confirmation prompt with Accept/Cancel buttons.

func NewConfirmScreen

func NewConfirmScreen(message string, thm *theme.Theme) *ConfirmScreen

NewConfirmScreen creates a confirm screen preloaded with a message.

func (*ConfirmScreen) Init

func (s *ConfirmScreen) Init() tea.Cmd

Init implements the tea.Model Init stage for ConfirmScreen.

func (*ConfirmScreen) Update

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

Update processes keyboard events for the confirmation dialog.

func (*ConfirmScreen) View

func (s *ConfirmScreen) View() string

View renders the confirmation UI box with focused button highlighting.

type DiffScreen

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

DiffScreen renders a full commit diff inside a viewport.

func NewDiffScreen

func NewDiffScreen(title, diff string, thm *theme.Theme) *DiffScreen

NewDiffScreen displays a commit diff title and body inside a viewport.

func (*DiffScreen) Init

func (s *DiffScreen) Init() tea.Cmd

Init sets up the diff viewport state before rendering.

func (*DiffScreen) Update

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

Update processes navigation keys while the diff is visible.

func (*DiffScreen) View

func (s *DiffScreen) View() string

View renders the diff text inside a scrollable viewport.

type HelpScreen

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

HelpScreen renders searchable documentation for the app controls.

func NewHelpScreen

func NewHelpScreen(maxWidth, maxHeight int, customCommands map[string]*config.CustomCommand, thm *theme.Theme) *HelpScreen

NewHelpScreen initializes help content with the available screen size.

func (*HelpScreen) Init

func (s *HelpScreen) Init() tea.Cmd

Init prepares the help screen before it starts handling updates.

func (*HelpScreen) SetSize

func (s *HelpScreen) SetSize(maxWidth, maxHeight int)

SetSize updates the help screen dimensions (useful on terminal resize)

func (*HelpScreen) Update

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

Update handles scrolling and search input for the help screen.

func (*HelpScreen) View

func (s *HelpScreen) View() string

View renders the help content and search input inside the viewport.

type InfoScreen added in v1.7.0

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

InfoScreen displays a modal message with an OK button.

func NewInfoScreen added in v1.7.0

func NewInfoScreen(message string, thm *theme.Theme) *InfoScreen

NewInfoScreen creates an informational modal with an OK button.

func (*InfoScreen) Init added in v1.7.0

func (s *InfoScreen) Init() tea.Cmd

Init implements the tea.Model Init stage for InfoScreen.

func (*InfoScreen) Update added in v1.7.0

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

Update processes keyboard events for the info dialog.

func (*InfoScreen) View added in v1.7.0

func (s *InfoScreen) View() string

View renders the informational UI box with a single OK button.

type InputScreen

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

InputScreen provides a prompt along with a text input and inline validation.

func NewInputScreen

func NewInputScreen(prompt, placeholder, value string, thm *theme.Theme) *InputScreen

NewInputScreen builds an input modal with prompt, placeholder, and initial value.

func (*InputScreen) Init

func (s *InputScreen) Init() tea.Cmd

Init satisfies tea.Model.Init for the input modal.

func (*InputScreen) SetFuzzyFinder added in v1.10.0

func (s *InputScreen) SetFuzzyFinder(enabled bool, suggestions []string)

SetFuzzyFinder enables fuzzy finder with the provided suggestions.

func (*InputScreen) SetValidation

func (s *InputScreen) SetValidation(fn func(string) string)

SetValidation adds an optional validation callback for input submission.

func (*InputScreen) Update

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

Update handles keystrokes for the input modal and returns commands on submit.

func (*InputScreen) View

func (s *InputScreen) View() string

View renders the prompt, input field, and error message inside a styled box.

type ListSelectionScreen added in v1.6.0

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

ListSelectionScreen lets the user pick from a list of options.

func NewListSelectionScreen added in v1.6.0

func NewListSelectionScreen(items []selectionItem, title, placeholder, noResults string, maxWidth, maxHeight int, initialID string, thm *theme.Theme) *ListSelectionScreen

NewListSelectionScreen builds a list selection screen with 80% of screen size.

func (*ListSelectionScreen) Init added in v1.6.0

func (s *ListSelectionScreen) Init() tea.Cmd

Init configures the list selection input before Bubble Tea updates begin.

func (*ListSelectionScreen) Selected added in v1.6.0

func (s *ListSelectionScreen) Selected() (selectionItem, bool)

Selected returns the currently selected item, if any.

func (*ListSelectionScreen) Update added in v1.6.0

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

Update handles updates for the list selection screen.

func (*ListSelectionScreen) View added in v1.6.0

func (s *ListSelectionScreen) View() string

View renders the list selection screen.

type Model

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

Model represents the main application model

func NewModel

func NewModel(cfg *config.AppConfig, initialFilter string) *Model

NewModel creates a new application model with the given configuration. initialFilter is an optional filter string to apply on startup.

func (*Model) Close

func (m *Model) Close()

Close releases background resources including canceling contexts and timers. It also persists the current selection for the next session.

func (*Model) GetSelectedPath

func (m *Model) GetSelectedPath() string

GetSelectedPath returns the selected worktree path for shell integration. This is used when the application exits to allow the shell to cd into the selected worktree.

func (*Model) Init

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

Init satisfies the tea.Model interface and starts with no command.

func (*Model) Update

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

Update processes Bubble Tea messages and routes them through the app model.

func (*Model) View

func (m *Model) View() string

View renders the active screen for the Bubble Tea program.

type PRSelectionScreen added in v1.2.0

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

PRSelectionScreen lets the user pick a PR from a filtered list.

func NewPRSelectionScreen added in v1.2.0

func NewPRSelectionScreen(prs []*models.PRInfo, maxWidth, maxHeight int, thm *theme.Theme) *PRSelectionScreen

NewPRSelectionScreen builds a PR selection screen with 80% of screen size.

func (*PRSelectionScreen) Init added in v1.2.0

func (s *PRSelectionScreen) Init() tea.Cmd

Init configures the PR selection input before Bubble Tea updates begin.

func (*PRSelectionScreen) Selected added in v1.2.0

func (s *PRSelectionScreen) Selected() (*models.PRInfo, bool)

Selected returns the currently selected PR, if any.

func (*PRSelectionScreen) Update added in v1.2.0

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

Update handles updates for the PR selection screen.

func (*PRSelectionScreen) View added in v1.2.0

func (s *PRSelectionScreen) View() string

View renders the PR selection screen.

type TrustScreen

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

TrustScreen surfaces trust warnings and records commands for a path.

func NewTrustScreen

func NewTrustScreen(filePath string, commands []string, thm *theme.Theme) *TrustScreen

NewTrustScreen warns the user when a repo config has changed or is untrusted.

func (*TrustScreen) Init

func (s *TrustScreen) Init() tea.Cmd

Init satisfies tea.Model.Init for the trust confirmation screen.

func (*TrustScreen) Update

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

Update handles trust decisions and delegates viewport input updates.

func (*TrustScreen) View

func (s *TrustScreen) View() string

View renders the trust warning content inside a styled box.

type WelcomeScreen

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

WelcomeScreen shows the initial instructions when no worktrees are open.

func NewWelcomeScreen

func NewWelcomeScreen(currentDir, worktreeDir string, thm *theme.Theme) *WelcomeScreen

NewWelcomeScreen builds the greeting screen shown when no worktrees exist.

func (*WelcomeScreen) Init

func (s *WelcomeScreen) Init() tea.Cmd

Init is part of the tea.Model interface for the welcome screen.

func (*WelcomeScreen) Update

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

Update listens for retry or quit keys on the welcome screen.

func (*WelcomeScreen) View

func (s *WelcomeScreen) View() string

View renders the welcome dialog with guidance and action buttons.

Jump to

Keyboard shortcuts

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