tui

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxVisibleCommands is the maximum number of commands shown in the palette.
	MaxVisibleCommands = 12
	// CommandPaletteWidth is the content width of the command palette modal.
	CommandPaletteWidth = 90
)
View Source
const (
	// AnimationFrameCount is the total number of frames in the fade animation.
	AnimationFrameCount = 12
)

Animation constants.

View Source
const DefaultStatusTemplate = "" /* 394-byte string literal not displayed */

DefaultStatusTemplate is the default Go template for the preview status line. Shows git info with icons and plugin statuses.

View Source
const DefaultTitleTemplate = "{{ .Name }} • #{{ .ShortID }}"

DefaultTitleTemplate is the default Go template for the preview title. Includes session ID in the title line: "SessionName • #abcd"

Variables

This section is empty.

Functions

func BuildTreeItems

func BuildTreeItems(groups []RepoGroup, localRemote string) []list.Item

BuildTreeItems converts repo groups into tree items for the list.

func PadRight

func PadRight(s string, width int) string

PadRight pads a string to the right with spaces to reach the desired width.

func RenderRepoHeader

func RenderRepoHeader(item TreeItem, isSelected bool, styles TreeDelegateStyles) string

RenderRepoHeader renders a repository header line.

func RenderSessionLine

func RenderSessionLine(item TreeItem, isSelected bool, gitBranch string, termStatus *TerminalStatus, styles TreeDelegateStyles, animFrame int) string

RenderSessionLine renders a session entry with tree prefix.

Types

type Action

type Action struct {
	Type        ActionType
	Key         string
	Help        string
	Confirm     string // Non-empty if confirmation required
	ShellCmd    string // For shell actions, the rendered command
	SessionID   string
	SessionPath string
	Silent      bool  // Skip loading popup for fast commands
	Exit        bool  // Exit hive after command completes
	Err         error // Non-nil if action resolution failed (e.g., template error)
}

Action represents a resolved keybinding action ready for execution.

func (Action) NeedsConfirm

func (a Action) NeedsConfirm() bool

NeedsConfirm returns true if the action requires user confirmation.

type ActionType

type ActionType int

ActionType identifies the kind of action a keybinding triggers.

const (
	ActionTypeNone ActionType = iota
	ActionTypeRecycle
	ActionTypeDelete
	ActionTypeShell
	ActionTypeFilterAll
	ActionTypeFilterActive
	ActionTypeFilterApproval
	ActionTypeFilterReady
	ActionTypeDocReview
	ActionTypeNewSession
	ActionTypeSetTheme
	ActionTypeMessages
	ActionTypeRenameSession
	ActionTypeNextActive
	ActionTypePrevActive
	ActionTypeDeleteRecycledBatch // Delete all recycled sessions at once (must stay at end to not shift command.ActionType values)
)

type ColumnWidths

type ColumnWidths struct {
	Name   int
	Branch int
	ID     int
}

ColumnWidths holds the calculated widths for aligned columns.

func CalculateColumnWidths

func CalculateColumnWidths(sessions []session.Session, gitBranches map[string]string) ColumnWidths

CalculateColumnWidths calculates the maximum widths for each column within a repo group.

type CommandEntry

type CommandEntry struct {
	Name    string
	Command config.UserCommand
}

CommandEntry represents an item in the command palette.

type CommandPalette

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

CommandPalette is a vim-style command palette for user commands.

func NewCommandPalette

func NewCommandPalette(cmds map[string]config.UserCommand, sess *session.Session, width, height int, activeView ViewType) *CommandPalette

NewCommandPalette creates a new command palette with the given commands. Commands are filtered by scope - only commands active in the current view are shown.

func (*CommandPalette) Cancelled

func (p *CommandPalette) Cancelled() bool

Cancelled returns true if the user cancelled the palette.

func (*CommandPalette) IsFiltering

func (p *CommandPalette) IsFiltering() bool

IsFiltering returns whether the palette is currently filtering. Always true for the new text input-based palette.

func (*CommandPalette) KeyMap

func (p *CommandPalette) KeyMap() []key.Binding

KeyMap returns keys that the command palette uses (for help integration).

func (*CommandPalette) Overlay

func (p *CommandPalette) Overlay(background string, width, height int) string

Overlay renders the command palette as a layer over the given background.

func (*CommandPalette) SelectedCommand

func (p *CommandPalette) SelectedCommand() (*CommandEntry, []string, bool)

SelectedCommand returns the selected command entry and parsed args, if any.

func (*CommandPalette) Session

func (p *CommandPalette) Session() *session.Session

Session returns the session context for template rendering.

func (*CommandPalette) Update

func (p *CommandPalette) Update(msg tea.Msg) (*CommandPalette, tea.Cmd)

Update handles messages for the command palette.

func (*CommandPalette) View

func (p *CommandPalette) View() string

View renders the command palette.

type DiscoveredRepo

type DiscoveredRepo struct {
	Path   string // absolute path to the repository
	Name   string // directory name
	Remote string // origin remote URL
}

DiscoveredRepo represents a git repository found during scanning.

func ScanRepoDirs

func ScanRepoDirs(ctx context.Context, dirs []string, gitExec git.Git) ([]DiscoveredRepo, error)

ScanRepoDirs scans the given directories for git repositories. Each directory in dirs is expected to contain subdirectories that are git repos. Repositories that fail to scan are silently skipped.

type GitStatus

type GitStatus struct {
	Branch     string
	Additions  int
	Deletions  int
	HasChanges bool
	IsLoading  bool
	Error      error
}

GitStatus holds the git status information for a session.

type HiveDocReviewCmd

type HiveDocReviewCmd struct {
	Arg string // Optional document path argument
}

HiveDocReviewCmd activates the review tab with optional document selection.

func (HiveDocReviewCmd) Execute

func (c HiveDocReviewCmd) Execute(m *Model) tea.Cmd

Execute shows document picker on current view, then switches to review when document selected. When invoked without an argument, it scopes to the selected session's repository context.

type KVView

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

KVView is a two-column KV browser: searchable key list (left) + colorized JSON preview (right).

func NewKVView

func NewKVView() *KVView

NewKVView creates a new KV browser view.

func (*KVView) AddFilterRune

func (v *KVView) AddFilterRune(r rune)

AddFilterRune adds a character to the filter.

func (*KVView) CancelFilter

func (v *KVView) CancelFilter()

CancelFilter clears the filter and exits filtering mode.

func (*KVView) ConfirmFilter

func (v *KVView) ConfirmFilter()

ConfirmFilter exits filtering mode, keeping the filter active.

func (*KVView) DeleteFilterRune

func (v *KVView) DeleteFilterRune()

DeleteFilterRune removes the last character from the filter.

func (*KVView) IsFiltering

func (v *KVView) IsFiltering() bool

IsFiltering returns whether the view is in filter mode.

func (*KVView) MoveDown

func (v *KVView) MoveDown()

MoveDown moves the cursor down in the key list.

func (*KVView) MoveUp

func (v *KVView) MoveUp()

MoveUp moves the cursor up in the key list.

func (*KVView) ScrollPreviewDown

func (v *KVView) ScrollPreviewDown()

ScrollPreviewDown scrolls the JSON preview down.

func (*KVView) ScrollPreviewUp

func (v *KVView) ScrollPreviewUp()

ScrollPreviewUp scrolls the JSON preview up.

func (*KVView) SelectedKey

func (v *KVView) SelectedKey() string

SelectedKey returns the currently selected key, or empty if none.

func (*KVView) SetKeys

func (v *KVView) SetKeys(keys []string)

SetKeys updates the key list and reapplies the filter.

func (*KVView) SetPreview

func (v *KVView) SetPreview(entry *kv.Entry)

SetPreview sets the preview entry for the selected key.

func (*KVView) SetSize

func (v *KVView) SetSize(width, height int)

SetSize sets the viewport dimensions.

func (*KVView) StartFilter

func (v *KVView) StartFilter()

StartFilter begins filtering mode.

func (*KVView) View

func (v *KVView) View() string

View renders the two-column layout.

type KeybindingResolver

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

KeybindingResolver resolves keybindings to actions via UserCommands. It handles resolution only - execution is handled by the command.Service.

func NewKeybindingResolver

func NewKeybindingResolver(keybindings map[string]config.Keybinding, commands map[string]config.UserCommand, renderer *tmpl.Renderer) *KeybindingResolver

NewKeybindingResolver creates a new resolver with the given config. Commands should be the merged user commands (user config + system defaults).

func (*KeybindingResolver) HelpEntries

func (h *KeybindingResolver) HelpEntries() []string

HelpEntries returns all configured keybindings for display, sorted by key. Only returns keybindings that are in scope for the current view.

func (*KeybindingResolver) HelpString

func (h *KeybindingResolver) HelpString() string

HelpString returns a formatted help string for all keybindings.

func (*KeybindingResolver) IsAction

func (h *KeybindingResolver) IsAction(key string, action string) bool

IsAction checks if a key maps to the given built-in action.

func (*KeybindingResolver) IsCommand

func (h *KeybindingResolver) IsCommand(key string, cmdName string) bool

IsCommand checks if a key maps to the given command name.

func (*KeybindingResolver) KeyBindings

func (h *KeybindingResolver) KeyBindings() []key.Binding

KeyBindings returns key.Binding objects for integration with bubbles help system. Only returns keybindings that are in scope for the current view.

func (*KeybindingResolver) RenderWithFormData

func (h *KeybindingResolver) RenderWithFormData(
	name string,
	cmd config.UserCommand,
	sess session.Session,
	args []string,
	formData map[string]any,
) Action

RenderWithFormData resolves a user command with form data injected into the template context under the .Form namespace.

func (*KeybindingResolver) Resolve

func (h *KeybindingResolver) Resolve(key string, sess session.Session) (Action, bool)

Resolve attempts to resolve a key press to an action for the given session. Recycled sessions only allow delete actions to prevent accidental operations.

func (*KeybindingResolver) ResolveFormCommand

func (h *KeybindingResolver) ResolveFormCommand(key string, sess session.Session) (string, config.UserCommand, bool)

ResolveFormCommand checks if a key maps to a user command with form fields. Returns the command name and command if found, after scope and recycle checks.

func (*KeybindingResolver) ResolveUserCommand

func (h *KeybindingResolver) ResolveUserCommand(name string, cmd config.UserCommand, sess session.Session, args []string) Action

ResolveUserCommand converts a user command to an Action ready for execution. The name is used to display the command source (e.g., ":review"). Supports both action-based commands (recycle, delete) and shell commands.

func (*KeybindingResolver) SetActiveView

func (h *KeybindingResolver) SetActiveView(view ViewType)

SetActiveView updates the current active view for scope checking.

func (*KeybindingResolver) SetSelectedWindow

func (h *KeybindingResolver) SetSelectedWindow(windowName string)

SetSelectedWindow overrides the TmuxWindow template value for the next resolve call. The override is consumed (cleared) after each Resolve or ResolveUserCommand call. Pass empty string to clear the override and fall back to the lookup function.

func (*KeybindingResolver) SetTmuxWindowLookup

func (h *KeybindingResolver) SetTmuxWindowLookup(fn func(sessionID string) string)

SetTmuxWindowLookup sets a function that resolves tmux window names for sessions. This enables the TmuxWindow field in shell command templates.

func (*KeybindingResolver) SetToolLookup

func (h *KeybindingResolver) SetToolLookup(fn func(sessionID string) string)

SetToolLookup sets a function that resolves tool names for sessions.

type MessagePreviewModal

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

MessagePreviewModal displays a message with markdown rendering.

func NewMessagePreviewModal

func NewMessagePreviewModal(msg messaging.Message, width, height int) MessagePreviewModal

NewMessagePreviewModal creates a new preview modal for the given message.

func (*MessagePreviewModal) ClearCopyStatus

func (m *MessagePreviewModal) ClearCopyStatus()

ClearCopyStatus clears the copy feedback message.

func (MessagePreviewModal) Overlay

func (m MessagePreviewModal) Overlay(background string, width, height int) string

Overlay renders the preview modal centered over the background.

func (*MessagePreviewModal) Payload

func (m *MessagePreviewModal) Payload() string

Payload returns the raw message payload for copying.

func (*MessagePreviewModal) ScrollDown

func (m *MessagePreviewModal) ScrollDown()

ScrollDown scrolls the viewport down.

func (*MessagePreviewModal) ScrollUp

func (m *MessagePreviewModal) ScrollUp()

ScrollUp scrolls the viewport up.

func (*MessagePreviewModal) SetCopyStatus

func (m *MessagePreviewModal) SetCopyStatus(status string)

SetCopyStatus sets the copy feedback message.

func (*MessagePreviewModal) UpdateViewport

func (m *MessagePreviewModal) UpdateViewport(msg any)

UpdateViewport updates the viewport with a message (for scrolling).

type MessagesView

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

MessagesView is a custom compact renderer for messages. It displays messages in a single-line format: timestamp [topic ] message_preview... sender

func NewMessagesView

func NewMessagesView() *MessagesView

NewMessagesView creates a new messages view.

func (*MessagesView) AddFilterRune

func (v *MessagesView) AddFilterRune(r rune)

AddFilterRune adds a rune to the filter.

func (*MessagesView) CancelFilter

func (v *MessagesView) CancelFilter()

CancelFilter cancels filtering and clears the filter.

func (*MessagesView) ConfirmFilter

func (v *MessagesView) ConfirmFilter()

ConfirmFilter confirms the filter and exits filter mode.

func (*MessagesView) DeleteFilterRune

func (v *MessagesView) DeleteFilterRune()

DeleteFilterRune removes the last rune from the filter.

func (*MessagesView) IsFiltering

func (v *MessagesView) IsFiltering() bool

IsFiltering returns true if filter input is active.

func (*MessagesView) MoveDown

func (v *MessagesView) MoveDown()

MoveDown moves cursor down.

func (*MessagesView) MoveUp

func (v *MessagesView) MoveUp()

MoveUp moves cursor up.

func (*MessagesView) SelectedMessage

func (v *MessagesView) SelectedMessage() *messaging.Message

SelectedMessage returns the currently selected message, or nil if none.

func (*MessagesView) SetMessages

func (v *MessagesView) SetMessages(msgs []messaging.Message)

SetMessages sets the messages to display.

func (*MessagesView) SetSize

func (v *MessagesView) SetSize(width, height int)

SetSize sets the viewport dimensions.

func (*MessagesView) StartFilter

func (v *MessagesView) StartFilter()

StartFilter begins filter input mode.

func (*MessagesView) StopFilter

func (v *MessagesView) StopFilter()

StopFilter ends filter input mode.

func (*MessagesView) View

func (v *MessagesView) View() string

View renders the messages view.

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

Modal represents a confirmation dialog.

func NewModal

func NewModal(title, message string) Modal

NewModal creates a new modal with the given title and message.

func (Modal) ConfirmSelected

func (m Modal) ConfirmSelected() bool

ConfirmSelected returns true if the confirm button is selected.

func (Modal) Overlay

func (m Modal) Overlay(background string, width, height int) string

Overlay renders the modal as a layer over the given background content.

func (*Modal) ToggleSelection

func (m *Modal) ToggleSelection()

ToggleSelection switches the selected button.

func (Modal) Visible

func (m Modal) Visible() bool

Visible returns whether the modal should be displayed.

type Model

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

Model is the main Bubble Tea model for the TUI.

func New

func New(service *hive.SessionService, cfg *config.Config, opts Options) Model

New creates a new TUI model.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model.

func (Model) PendingCreate

func (m Model) PendingCreate() *PendingCreate

PendingCreate returns any pending session creation data.

func (Model) Update

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

Update handles messages.

func (Model) View

func (m Model) View() tea.View

View renders the TUI.

type NewSessionForm

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

NewSessionForm manages the new session creation form.

func NewNewSessionForm

func NewNewSessionForm(repos []DiscoveredRepo, preselectedRemote string, existingNames map[string]bool) *NewSessionForm

NewNewSessionForm creates a new session form with the given repos. If preselectedRemote is non-empty, the matching repo will be pre-selected. existingNames is used to validate that the session name is unique.

func (*NewSessionForm) Cancelled

func (f *NewSessionForm) Cancelled() bool

Cancelled returns true if the form was cancelled.

func (*NewSessionForm) Init

func (f *NewSessionForm) Init() tea.Cmd

Init returns the initial command for the form.

func (*NewSessionForm) Result

Result returns the form result. Only valid if Submitted() is true. Returns zero value if repos slice is empty (should not happen in normal use).

func (*NewSessionForm) Submitted

func (f *NewSessionForm) Submitted() bool

Submitted returns true if the form was submitted.

func (*NewSessionForm) Update

func (f *NewSessionForm) Update(msg tea.Msg) (NewSessionForm, tea.Cmd)

Update handles messages for the form.

func (*NewSessionForm) View

func (f *NewSessionForm) View() string

View renders the form.

type NewSessionFormResult

type NewSessionFormResult struct {
	Repo        DiscoveredRepo
	SessionName string
}

NewSessionFormResult contains the form submission result.

type NotificationModal

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

NotificationModal displays a scrollable history of notifications.

func NewNotificationModal

func NewNotificationModal(bus *tuinotify.Bus, width, height int) *NotificationModal

NewNotificationModal creates a modal showing notification history.

func (*NotificationModal) Clear

func (m *NotificationModal) Clear() error

Clear deletes all notifications and refreshes the view.

func (*NotificationModal) Overlay

func (m *NotificationModal) Overlay(background string, width, height int) string

Overlay renders the notification modal centered over the background.

func (*NotificationModal) ScrollDown

func (m *NotificationModal) ScrollDown()

ScrollDown scrolls the viewport down.

func (*NotificationModal) ScrollUp

func (m *NotificationModal) ScrollUp()

ScrollUp scrolls the viewport up.

type Options

type Options struct {
	LocalRemote     string               // Remote URL of current directory (empty if not in git repo)
	MsgStore        *hive.MessageService // Message service for pub/sub events (optional)
	TerminalManager *terminal.Manager    // Terminal integration manager (optional)
	PluginManager   *plugins.Manager     // Plugin manager (optional)
	DB              *db.DB               // Database connection for stores
	KVStore         corekv.KV            // Persistent KV store (optional)
	Renderer        *tmpl.Renderer       // Template renderer for shell commands
	Warnings        []string             // Startup warnings to display as toasts
}

Options configures the TUI behavior.

type OutputModal

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

OutputModal displays streaming command output in a modal dialog.

func NewOutputModal

func NewOutputModal(title string) OutputModal

NewOutputModal creates a new output modal with the given title.

func (*OutputModal) AddLine

func (m *OutputModal) AddLine(line string)

AddLine appends a line of output to the modal.

func (*OutputModal) IsRunning

func (m *OutputModal) IsRunning() bool

IsRunning returns true if the command is still running.

func (OutputModal) Overlay

func (m OutputModal) Overlay(background string, width, height int) string

Overlay renders the output modal centered over the background.

func (*OutputModal) SetComplete

func (m *OutputModal) SetComplete(err error)

SetComplete marks the modal as complete with optional error.

func (*OutputModal) SetSpinner

func (m *OutputModal) SetSpinner(s spinner.Model)

SetSpinner updates the spinner model.

func (*OutputModal) Spinner

func (m *OutputModal) Spinner() spinner.Model

Spinner returns the spinner model for tick updates.

type ParsedCommand

type ParsedCommand struct {
	Name string
	Args []string
}

ParsedCommand represents a parsed command input.

func ParseCommandInput

func ParseCommandInput(input string) ParsedCommand

ParseCommandInput parses a command string like ":command arg1 arg2" into name and args. The input should start with ':' but it's optional. Arguments are split by whitespace.

type PendingCreate

type PendingCreate struct {
	Remote string
	Name   string
}

PendingCreate holds data for a session to create after TUI exits.

type PreviewGitData

type PreviewGitData struct {
	Branch     string
	Additions  int
	Deletions  int
	HasChanges bool
}

PreviewGitData holds git status data for templates.

type PreviewIcons

type PreviewIcons struct {
	Git       string
	GitBranch string
	Github    string
	CheckList string
	Bee       string
	Hive      string
	Claude    string
}

PreviewIcons holds nerd font icons for templates.

func DefaultPreviewIcons

func DefaultPreviewIcons() PreviewIcons

DefaultPreviewIcons returns the default nerd font icons from styles package.

func EmptyPreviewIcons

func EmptyPreviewIcons() PreviewIcons

EmptyPreviewIcons returns empty strings for all icons (when icons disabled).

type PreviewPluginData

type PreviewPluginData struct {
	Github string // e.g., "open", "draft", "merged"
	Beads  string // e.g., "0/3"
	Claude string // e.g., "65%" (context usage percentage)
}

PreviewPluginData holds plugin status data for templates.

type PreviewTemplateData

type PreviewTemplateData struct {
	// Session data
	Name    string
	ID      string
	ShortID string
	Path    string
	Branch  string // shortcut to GitStatus.Branch

	// Git status
	GitStatus PreviewGitData

	// Plugin data
	Plugin PreviewPluginData

	// Terminal status
	TerminalStatus string

	// Icons
	Icon PreviewIcons
}

PreviewTemplateData holds all data available to preview templates.

func BuildPreviewTemplateData

func BuildPreviewTemplateData(
	sess *session.Session,
	gitStatuses *kv.Store[string, GitStatus],
	pluginStatuses map[string]*kv.Store[string, plugins.Status],
	terminalStatuses *kv.Store[string, TerminalStatus],
	iconsEnabled bool,
) PreviewTemplateData

BuildPreviewTemplateData constructs template data from session and status stores.

type PreviewTemplates

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

PreviewTemplates holds parsed templates for preview rendering.

func ParsePreviewTemplates

func ParsePreviewTemplates(titleTmpl, statusTmpl string) *PreviewTemplates

ParsePreviewTemplates parses the title and status templates. Falls back to defaults if templates are empty or invalid.

func (*PreviewTemplates) RenderStatus

func (pt *PreviewTemplates) RenderStatus(data PreviewTemplateData) string

RenderStatus executes the status template with the given data.

func (*PreviewTemplates) RenderTitle

func (pt *PreviewTemplates) RenderTitle(data PreviewTemplateData) string

RenderTitle executes the title template with the given data.

type RepoGroup

type RepoGroup struct {
	Remote           string            // Git remote URL (used for matching/comparison)
	Name             string            // Display name extracted from remote
	Sessions         []session.Session // Active sessions belonging to this repository
	RecycledSessions []session.Session // Recycled sessions (stored for deletion support)
	RecycledCount    int               // Number of recycled sessions (displayed as collapsed)
}

RepoGroup represents a repository with its associated sessions.

func GroupSessionsByRepo

func GroupSessionsByRepo(sessions []session.Session, localRemote string) []RepoGroup

GroupSessionsByRepo groups sessions by their repository remote URL. Sessions are grouped by their Remote field. Returns groups sorted with: - Current repository (matching localRemote) first - Other repositories sorted alphabetically by name

Within each group, sessions are sorted by name.

type ReviewOnlyModel

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

ReviewOnlyModel is a minimal TUI for reviewing context documents.

func NewReviewOnly

func NewReviewOnly(opts ReviewOnlyOptions) ReviewOnlyModel

NewReviewOnly creates a new review-only TUI model.

func (ReviewOnlyModel) Init

func (m ReviewOnlyModel) Init() tea.Cmd

Init implements tea.Model.

func (ReviewOnlyModel) Update

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

Update implements tea.Model.

func (ReviewOnlyModel) View

func (m ReviewOnlyModel) View() tea.View

View implements tea.Model.

type ReviewOnlyOptions

type ReviewOnlyOptions struct {
	Documents        []review.Document
	InitialDoc       *review.Document
	ContextDir       string // Directory for saving feedback files (e.g., context directory)
	DB               *db.DB
	CommentLineWidth int
	CopyCommand      string // Shell command for copying to clipboard (e.g., "pbcopy" on macOS)
}

ReviewOnlyOptions configures the review-only TUI.

type SelectField

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

SelectField is a select input component wrapping list.Model.

func NewSelectField

func NewSelectField(title string, items []SelectItem, selected int) SelectField

NewSelectField creates a new select field with the given items. selected is the index to pre-select (-1 for none).

func (*SelectField) Blur

func (s *SelectField) Blur()

Blur removes focus from the select field.

func (*SelectField) Focus

func (s *SelectField) Focus() tea.Cmd

Focus sets focus state on the select field.

func (*SelectField) Focused

func (s *SelectField) Focused() bool

Focused returns whether the field is focused.

func (*SelectField) IsFiltering

func (s *SelectField) IsFiltering() bool

IsFiltering returns whether the list is currently filtering.

func (*SelectField) KeyMap

func (s *SelectField) KeyMap() []key.Binding

KeyMap returns keys that the select field uses (for help integration).

func (*SelectField) SelectedIndex

func (s *SelectField) SelectedIndex() int

SelectedIndex returns the index of the selected item.

func (*SelectField) SetSize

func (s *SelectField) SetSize(width, height int)

SetSize sets the dimensions of the select field.

func (SelectField) Update

func (s SelectField) Update(msg tea.Msg) (SelectField, tea.Cmd)

Update handles messages for the select field.

func (SelectField) View

func (s SelectField) View() string

View renders the select field.

type SelectItem

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

SelectItem represents an item in a SelectField.

func (SelectItem) FilterValue

func (i SelectItem) FilterValue() string

FilterValue implements list.Item.

type TerminalStatus

type TerminalStatus struct {
	Status      terminal.Status
	Tool        string
	WindowName  string
	PaneContent string
	IsLoading   bool
	Error       error
	Windows     []WindowStatus // per-window statuses (populated only for multi-window sessions)
}

TerminalStatus holds the terminal integration status for a session.

type ToastController

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

ToastController manages the lifecycle of active toast notifications. It handles push, eviction, TTL countdown, and dismissal.

func NewToastController

func NewToastController() *ToastController

func (*ToastController) Dismiss

func (c *ToastController) Dismiss()

Dismiss removes the newest (bottom-most) toast.

func (*ToastController) DismissAll

func (c *ToastController) DismissAll()

DismissAll removes all active toasts.

func (*ToastController) HasToasts

func (c *ToastController) HasToasts() bool

HasToasts returns true if there are any active toasts.

func (*ToastController) Push

func (c *ToastController) Push(n notify.Notification)

Push adds a notification to the toast stack. If the stack exceeds defaultMaxToasts, the oldest toast is evicted.

func (*ToastController) Tick

func (c *ToastController) Tick()

Tick removes any toasts whose expiration time has passed.

func (*ToastController) Toasts

func (c *ToastController) Toasts() []toast

Toasts returns the current active toast slice.

type ToastView

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

ToastView renders toast notifications and composites them as an overlay.

func NewToastView

func NewToastView(controller *ToastController) *ToastView

func (*ToastView) Overlay

func (v *ToastView) Overlay(background string, width, height int) string

Overlay composites the toast stack over background in the lower-right corner.

func (*ToastView) View

func (v *ToastView) View() string

View renders the toast stack as a single string with toasts stacked vertically (oldest at top, newest at bottom).

type TreeDelegate

type TreeDelegate struct {
	Styles           TreeDelegateStyles
	GitStatuses      *kv.Store[string, GitStatus]
	TerminalStatuses *kv.Store[string, TerminalStatus]
	PluginStatuses   map[string]*kv.Store[string, plugins.Status] // plugin name -> session ID -> status
	ColumnWidths     *ColumnWidths
	AnimationFrame   int  // Current frame for status animations
	PreviewMode      bool // When true, show minimal info (session names only)
	IconsEnabled     bool // When true, show nerd font icons
}

TreeDelegate handles rendering of tree items in the list.

func NewTreeDelegate

func NewTreeDelegate() TreeDelegate

NewTreeDelegate creates a new tree delegate with default styles.

func (TreeDelegate) Height

func (d TreeDelegate) Height() int

Height returns the height of each item. Headers are 1 line, sessions are 1 line.

func (TreeDelegate) Render

func (d TreeDelegate) Render(w io.Writer, m list.Model, index int, item list.Item)

Render renders a single tree item.

func (TreeDelegate) Spacing

func (d TreeDelegate) Spacing() int

Spacing returns the spacing between items.

func (TreeDelegate) Update

func (d TreeDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd

Update handles item updates.

type TreeDelegateStyles

type TreeDelegateStyles struct {
	// Header styles
	HeaderNormal   lipgloss.Style
	HeaderSelected lipgloss.Style
	HeaderStar     lipgloss.Style

	// Session styles
	TreeLine       lipgloss.Style
	SessionName    lipgloss.Style
	SessionBranch  lipgloss.Style
	SessionID      lipgloss.Style
	StatusActive   lipgloss.Style
	StatusApproval lipgloss.Style
	StatusReady    lipgloss.Style
	StatusUnknown  lipgloss.Style
	StatusRecycled lipgloss.Style

	// Selection styles
	Selected       lipgloss.Style
	SelectedBorder lipgloss.Style
	FilterMatch    lipgloss.Style
	SelectedMatch  lipgloss.Style
}

TreeDelegateStyles defines the styles for the tree delegate.

func DefaultTreeDelegateStyles

func DefaultTreeDelegateStyles() TreeDelegateStyles

DefaultTreeDelegateStyles returns the default styles for tree rendering.

type TreeItem

type TreeItem struct {
	// IsHeader indicates this is a repo header, not a session.
	IsHeader bool

	// Header fields (only used when IsHeader is true)
	RepoName      string
	RepoRemote    string // Git remote URL for the repo group
	IsCurrentRepo bool

	// Session fields (only used when IsHeader is false and IsRecycledPlaceholder is false)
	Session      session.Session
	IsLastInRepo bool   // Used to render └─ vs ├─
	RepoPrefix   string // The repo name for filtering purposes

	// Recycled placeholder fields (only used when IsRecycledPlaceholder is true)
	IsRecycledPlaceholder bool
	RecycledCount         int
	RecycledSessions      []session.Session // Actual recycled sessions for deletion support

	// Window sub-item fields (only used when IsWindowItem is true)
	IsWindowItem  bool
	WindowIndex   string
	WindowName    string
	ParentSession session.Session // Session this window belongs to
	IsLastWindow  bool            // For └─ vs ├─ rendering within the window group
}

TreeItem represents an item in the tree view. It can be either a repo header, a session entry, or a recycled placeholder.

func (TreeItem) FilterValue

func (i TreeItem) FilterValue() string

FilterValue returns the value used for filtering. Headers are not filterable (return empty). Sessions return "repoName sessionName" to allow searching by either. Recycled placeholders return "repoName recycled" to allow filtering.

type UIState

type UIState int

UIState represents the current state of the TUI.

type ViewType

type ViewType int

ViewType represents which view is active.

const (
	ViewSessions ViewType = iota
	ViewMessages
	ViewReview
	ViewStore
)

func (ViewType) String

func (v ViewType) String() string

String returns the lowercase name of the view type for scope matching.

type WindowStatus

type WindowStatus struct {
	WindowIndex string
	WindowName  string
	Status      terminal.Status
	Tool        string
	PaneContent string
}

WindowStatus holds per-window terminal status for multi-window sessions.

Directories

Path Synopsis
Package components provides reusable TUI components.
Package components provides reusable TUI components.
views
review
Package review implements a TUI for reviewing and commenting on markdown documents.
Package review implements a TUI for reviewing and commenting on markdown documents.

Jump to

Keyboard shortcuts

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