app

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 34 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 ChecklistItem added in v1.22.0

type ChecklistItem struct {
	ID          string
	Label       string
	Description string
	Checked     bool
}

ChecklistItem represents a single item with a checkbox state.

type ChecklistScreen added in v1.22.0

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

ChecklistScreen lets the user select multiple items from a list via checkboxes.

func NewChecklistScreen added in v1.22.0

func NewChecklistScreen(items []ChecklistItem, title, placeholder, noResults string, maxWidth, maxHeight int, thm *theme.Theme) *ChecklistScreen

NewChecklistScreen creates a multi-select checklist screen.

func (*ChecklistScreen) Init added in v1.22.0

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

Init configures the checklist input before Bubble Tea updates begin.

func (*ChecklistScreen) SelectedItems added in v1.22.0

func (s *ChecklistScreen) SelectedItems() []ChecklistItem

SelectedItems returns all checked items.

func (*ChecklistScreen) Update added in v1.22.0

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

Update handles keyboard events for the checklist screen.

func (*ChecklistScreen) View added in v1.22.0

func (s *ChecklistScreen) View() string

View renders the checklist screen.

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, maxWidth, maxHeight int, 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 CommitFileTreeNode added in v1.17.0

type CommitFileTreeNode struct {
	Path        string
	File        *models.CommitFile // nil for directories
	Children    []*CommitFileTreeNode
	Compression int // Number of compressed path segments
	// contains filtered or unexported fields
}

CommitFileTreeNode represents a node in the commit file tree.

func (*CommitFileTreeNode) IsDir added in v1.17.0

func (n *CommitFileTreeNode) IsDir() bool

IsDir returns true if this node is a directory.

type CommitFilesScreen added in v1.17.0

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

CommitFilesScreen displays files changed in a commit as a collapsible tree.

func NewCommitFilesScreen added in v1.17.0

func NewCommitFilesScreen(sha, wtPath string, files []models.CommitFile, meta commitMeta, maxWidth, maxHeight int, thm *theme.Theme, showIcons bool) *CommitFilesScreen

NewCommitFilesScreen creates a commit files tree screen.

func (*CommitFilesScreen) GetSelectedNode added in v1.17.0

func (s *CommitFilesScreen) GetSelectedNode() *CommitFileTreeNode

GetSelectedNode returns the currently selected node.

func (*CommitFilesScreen) Init added in v1.17.0

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

Init implements tea.Model.

func (*CommitFilesScreen) ToggleCollapse added in v1.17.0

func (s *CommitFilesScreen) ToggleCollapse(path string)

ToggleCollapse toggles the collapse state of a directory.

func (*CommitFilesScreen) Update added in v1.17.0

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

Update handles key events for the commit files screen.

func (*CommitFilesScreen) View added in v1.17.0

func (s *CommitFilesScreen) View() string

View renders the commit files screen.

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 NewConfirmScreenWithDefault added in v1.22.0

func NewConfirmScreenWithDefault(message string, defaultButton int, thm *theme.Theme) *ConfirmScreen

NewConfirmScreenWithDefault creates a confirmation modal with a specified default button.

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 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) SetCheckbox added in v1.22.0

func (s *InputScreen) SetCheckbox(label string, defaultChecked bool)

SetCheckbox enables a checkbox in the input screen with the given label and default state.

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) SetHistory added in v1.13.0

func (s *InputScreen) SetHistory(history []string)

SetHistory enables bash-style history navigation with up/down arrows.

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 IssueSelectionScreen added in v1.20.0

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

IssueSelectionScreen lets the user pick an issue from a filtered list.

func NewIssueSelectionScreen added in v1.20.0

func NewIssueSelectionScreen(issues []*models.IssueInfo, maxWidth, maxHeight int, thm *theme.Theme, showIcons bool) *IssueSelectionScreen

NewIssueSelectionScreen builds an issue selection screen with 80% of screen size.

func (*IssueSelectionScreen) Init added in v1.20.0

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

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

func (*IssueSelectionScreen) Selected added in v1.20.0

func (s *IssueSelectionScreen) Selected() (*models.IssueInfo, bool)

Selected returns the currently selected issue, if any.

func (*IssueSelectionScreen) Update added in v1.20.0

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

Update handles updates for the issue selection screen.

func (*IssueSelectionScreen) View added in v1.20.0

func (s *IssueSelectionScreen) View() string

View renders the issue selection screen.

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 LoadingScreen added in v1.15.0

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

LoadingScreen displays a modal with a spinner and a random tip.

func NewLoadingScreen added in v1.15.0

func NewLoadingScreen(message string, thm *theme.Theme) *LoadingScreen

NewLoadingScreen creates a loading modal with the given message.

func (*LoadingScreen) Tick added in v1.15.0

func (s *LoadingScreen) Tick()

Tick advances the loading animation (spinner frame and border colour).

func (*LoadingScreen) View added in v1.15.0

func (s *LoadingScreen) View() string

View renders the loading modal with spinner, message, and a random tip.

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) UpdateTheme added in v1.22.0

func (m *Model) UpdateTheme(themeName string)

UpdateTheme updates the application theme and refreshes component styles.

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, showIcons bool) *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 StatusFile added in v1.15.0

type StatusFile struct {
	Filename    string
	Status      string // XY status code (e.g., ".M", "M.", " ?")
	IsUntracked bool
}

StatusFile represents a file entry from git status.

type StatusTreeNode added in v1.17.0

type StatusTreeNode struct {
	Path        string            // Full path (e.g., "internal/app" or "internal/app/app.go")
	File        *StatusFile       // nil for directories
	Children    []*StatusTreeNode // nil for files
	Compression int               // Number of compressed path segments (e.g., "a/b" = 1)
	// contains filtered or unexported fields
}

StatusTreeNode represents a node in the status file tree (directory or file).

func (*StatusTreeNode) CollectFiles added in v1.19.0

func (n *StatusTreeNode) CollectFiles() []*StatusFile

CollectFiles recursively collects all StatusFile pointers from this node and its children.

func (*StatusTreeNode) IsDir added in v1.17.0

func (n *StatusTreeNode) IsDir() bool

IsDir returns true if this node is a directory.

func (*StatusTreeNode) Name added in v1.17.0

func (n *StatusTreeNode) Name() string

Name returns the display name for this node.

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 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