common

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Base palette
	ColorBackground    = currentTheme.Colors.Background
	ColorForeground    = currentTheme.Colors.Foreground
	ColorMuted         = currentTheme.Colors.Muted
	ColorBorder        = currentTheme.Colors.Border
	ColorBorderFocused = currentTheme.Colors.BorderFocused

	// Semantic colors
	ColorPrimary   = currentTheme.Colors.Primary
	ColorSecondary = currentTheme.Colors.Secondary
	ColorSuccess   = currentTheme.Colors.Success
	ColorWarning   = currentTheme.Colors.Warning
	ColorError     = currentTheme.Colors.Error
	ColorInfo      = currentTheme.Colors.Info

	// Surface colors for layering
	ColorSurface0 = currentTheme.Colors.Surface0
	ColorSurface1 = currentTheme.Colors.Surface1
	ColorSurface2 = currentTheme.Colors.Surface2
	ColorSurface3 = currentTheme.Colors.Surface3

	// Selection/highlight
	ColorSelection = currentTheme.Colors.Selection
	ColorHighlight = currentTheme.Colors.Highlight
)

Theme-dependent colors (updated by SetCurrentTheme)

View Source
var (
	ColorClaude   = lipgloss.Color("#CC785C")
	ColorCodex    = lipgloss.Color("#FFFFFF")
	ColorGemini   = lipgloss.Color("#4285f4")
	ColorAmp      = lipgloss.Color("#ED4C3D")
	ColorOpencode = lipgloss.Color("#000000")
	ColorDroid    = lipgloss.Color("#EE6018")
	ColorCursor   = lipgloss.Color("#1B1812")
)

Agent colors remain constant across themes for brand recognition.

View Source
var Icons = struct {
	// Status indicators
	Clean   string
	Dirty   string
	Running string
	Idle    string
	Pending string

	// Actions
	Add    string
	Delete string
	Edit   string
	Close  string

	// Navigation
	Cursor      string
	CursorEmpty string
	ArrowRight  string
	ArrowDown   string

	// Objects
	Project  string
	Worktree string
	Agent    string
	Terminal string
	Folder   string
	File     string
	Git      string
	Home     string

	// Tab states
	TabActive   string
	TabInactive string

	// Spinner frames for loading animation
	Spinner []string
}{

	Clean:   "✓",
	Dirty:   "●",
	Running: "●",
	Idle:    "○",
	Pending: "◌",

	Add:    "+",
	Delete: "×",
	Edit:   "~",
	Close:  "×",

	Cursor:      ">",
	CursorEmpty: " ",
	ArrowRight:  "→",
	ArrowDown:   "↓",

	Project:  "□",
	Worktree: "├",
	Agent:    "◇",
	Terminal: "$",
	Folder:   "/",
	File:     "·",
	Git:      "*",
	Home:     "~",

	TabActive:   "●",
	TabInactive: "○",

	Spinner: []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"},
}

Icons used throughout the application Uses Unicode characters with fallbacks for broad terminal support

Functions

func AgentColor

func AgentColor(agent string) color.Color

AgentColor returns the color for a given agent type

func AppendSearchQuery

func AppendSearchQuery(state *CopyState, text string)

AppendSearchQuery appends text to the current search prompt.

func BackspaceSearchQuery

func BackspaceSearchQuery(state *CopyState)

BackspaceSearchQuery removes the last rune from the current search prompt.

func CancelSearch

func CancelSearch(state *CopyState)

CancelSearch exits search prompt without changing state.

func CopySelectionText

func CopySelectionText(term *vterm.VTerm, state *CopyState) string

CopySelectionText returns the selected text for the current copy state.

func CopyToClipboard

func CopyToClipboard(text string) error

CopyToClipboard writes text to the system clipboard with a macOS pbcopy fallback.

func ExecuteSearch

func ExecuteSearch(term *vterm.VTerm, state *CopyState) bool

ExecuteSearch runs the current search prompt and moves the cursor.

func FileStatusIcon

func FileStatusIcon(status string) (icon string, desc string)

FileStatusIcon returns an icon and description for git file status

func HexColor

func HexColor(c color.Color) string

HexColor converts a color.Color into a #RRGGBB string.

func KeyToBytes

func KeyToBytes(msg tea.KeyPressMsg) []byte

KeyToBytes converts a key press message to bytes for the terminal.

func MoveWordBackward

func MoveWordBackward(term *vterm.VTerm, state *CopyState)

MoveWordBackward moves to the start of the previous word.

func MoveWordEnd

func MoveWordEnd(term *vterm.VTerm, state *CopyState)

MoveWordEnd moves to the end of the current or next word.

func MoveWordForward

func MoveWordForward(term *vterm.VTerm, state *CopyState)

MoveWordForward moves to the start of the next word.

func RenderHelpBar

func RenderHelpBar(s Styles, items []struct{ Key, Desc string }, width int) string

RenderHelpBar renders a help bar with the given key-description pairs

func RenderHelpBarItems

func RenderHelpBarItems(styles Styles, items []HelpBinding) string

RenderHelpBarItems renders multiple help items for an inline help bar

func RenderHelpItem

func RenderHelpItem(styles Styles, key, desc string) string

RenderHelpItem renders a single help item for inline help bars

func RepeatSearch

func RepeatSearch(term *vterm.VTerm, state *CopyState, backward bool) bool

RepeatSearch repeats the last search.

func ScrollDeltaForHeight added in v0.0.3

func ScrollDeltaForHeight(height, factor int) int

ScrollDeltaForHeight calculates proportional scroll delta. Returns max(1, height/factor) to ensure minimum 1 line scroll.

func SetCurrentTheme

func SetCurrentTheme(id ThemeID)

SetCurrentTheme applies a new theme and updates all color variables.

func SpinnerFrame

func SpinnerFrame(frame int) string

SpinnerFrame returns the spinner character for a given frame index

func StartSearch

func StartSearch(state *CopyState, backward bool)

StartSearch begins a forward or backward search prompt.

func SyncCopyState

func SyncCopyState(term *vterm.VTerm, state *CopyState)

SyncCopyState clamps, scrolls to keep cursor visible, and updates selection highlight.

func ToggleCopySelection

func ToggleCopySelection(state *CopyState)

ToggleCopySelection starts or cancels selection anchored at the cursor.

func ToggleRectangle

func ToggleRectangle(state *CopyState)

ToggleRectangle toggles rectangle selection mode.

func WrapHelpItems

func WrapHelpItems(items []string, width int) []string

WrapHelpItems wraps pre-rendered help items into multiple lines constrained by width.

Types

type AgentOption

type AgentOption struct {
	ID   string
	Name string
}

AgentOption represents an agent option

func DefaultAgentOptions

func DefaultAgentOptions() []AgentOption

DefaultAgentOptions returns the default agent options

type CopyState

type CopyState struct {
	Initialized        bool
	CursorX            int
	CursorLine         int
	AnchorX            int
	AnchorLine         int
	Selecting          bool
	Rectangular        bool
	SearchActive       bool
	SearchBackward     bool
	SearchQuery        string
	LastSearch         string
	LastSearchBackward bool
}

CopyState tracks cursor and selection while in copy mode.

func InitCopyState

func InitCopyState(term *vterm.VTerm) CopyState

InitCopyState initializes the copy cursor and selection highlight.

type Dialog

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

Dialog is a modal dialog component

func NewAgentPicker

func NewAgentPicker() *Dialog

NewAgentPicker creates a new agent selection dialog with fuzzy filtering

func NewConfirmDialog

func NewConfirmDialog(id, title, message string) *Dialog

NewConfirmDialog creates a new confirmation dialog

func NewInputDialog

func NewInputDialog(id, title, placeholder string) *Dialog

NewInputDialog creates a new input dialog

func NewSelectDialog

func NewSelectDialog(id, title, message string, options []string) *Dialog

NewSelectDialog creates a new selection dialog

func (*Dialog) Cursor

func (d *Dialog) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the dialog view.

func (*Dialog) Hide

func (d *Dialog) Hide()

Hide hides the dialog

func (*Dialog) SetInputTransform

func (d *Dialog) SetInputTransform(fn InputTransformFunc) *Dialog

SetInputTransform sets a transform function that will be applied to input text

func (*Dialog) SetInputValidate

func (d *Dialog) SetInputValidate(fn InputValidateFunc) *Dialog

SetInputValidate sets a validation function that runs on each keystroke

func (*Dialog) SetShowKeymapHints

func (d *Dialog) SetShowKeymapHints(show bool)

SetShowKeymapHints controls whether helper text is rendered.

func (*Dialog) SetSize

func (d *Dialog) SetSize(width, height int)

SetSize sets the dialog size

func (*Dialog) Show

func (d *Dialog) Show()

Show makes the dialog visible

func (*Dialog) Update

func (d *Dialog) Update(msg tea.Msg) (*Dialog, tea.Cmd)

Update handles messages

func (*Dialog) View

func (d *Dialog) View() string

View renders the dialog

func (*Dialog) Visible

func (d *Dialog) Visible() bool

Visible returns whether the dialog is visible

type DialogResult

type DialogResult struct {
	ID        string
	Confirmed bool
	Value     string
	Index     int
}

DialogResult is sent when a dialog is completed

type DialogType

type DialogType int

DialogType identifies the type of dialog

const (
	DialogNone DialogType = iota
	DialogInput
	DialogConfirm
	DialogSelect
)

type FilePicker

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

FilePicker is a file/directory picker dialog

func NewFilePicker

func NewFilePicker(id, startPath string, directoriesOnly bool) *FilePicker

NewFilePicker creates a new file picker starting at the given path

func (*FilePicker) Cursor

func (fp *FilePicker) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the file picker view.

func (*FilePicker) Hide

func (fp *FilePicker) Hide()

Hide hides the picker

func (*FilePicker) SetPrimaryActionLabel added in v0.0.2

func (fp *FilePicker) SetPrimaryActionLabel(label string)

SetPrimaryActionLabel updates the primary action label.

func (*FilePicker) SetShowKeymapHints

func (fp *FilePicker) SetShowKeymapHints(show bool)

SetShowKeymapHints controls whether helper text is rendered.

func (*FilePicker) SetSize

func (fp *FilePicker) SetSize(width, height int)

SetSize sets the picker size

func (*FilePicker) SetStyles

func (fp *FilePicker) SetStyles(styles Styles)

SetStyles updates the file picker styles (for theme changes).

func (*FilePicker) SetTitle added in v0.0.2

func (fp *FilePicker) SetTitle(title string)

SetTitle updates the dialog title.

func (*FilePicker) Show

func (fp *FilePicker) Show()

Show makes the picker visible

func (*FilePicker) Update

func (fp *FilePicker) Update(msg tea.Msg) (*FilePicker, tea.Cmd)

Update handles messages

func (*FilePicker) View

func (fp *FilePicker) View() string

View renders the picker

func (*FilePicker) Visible

func (fp *FilePicker) Visible() bool

Visible returns whether the picker is visible

type HelpBinding

type HelpBinding struct {
	Key  string
	Desc string
}

HelpBinding represents a single keybinding

type HelpOverlay

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

HelpOverlay manages the help overlay display

func NewHelpOverlay

func NewHelpOverlay() *HelpOverlay

NewHelpOverlay creates a new help overlay

func (*HelpOverlay) ContainsClick added in v0.0.3

func (h *HelpOverlay) ContainsClick(x, y int) bool

ContainsClick returns true if the click coordinates are inside the dialog. The x, y coordinates should be absolute screen coordinates.

func (*HelpOverlay) Hide

func (h *HelpOverlay) Hide()

Hide hides the help overlay and resets state

func (*HelpOverlay) SetSize

func (h *HelpOverlay) SetSize(width, height int)

SetSize sets the overlay size

func (*HelpOverlay) SetStyles

func (h *HelpOverlay) SetStyles(styles Styles)

SetStyles updates the help overlay styles (for theme changes).

func (*HelpOverlay) Show

func (h *HelpOverlay) Show()

Show shows the help overlay and resets navigation state

func (*HelpOverlay) Toggle

func (h *HelpOverlay) Toggle()

Toggle toggles the help overlay visibility

func (*HelpOverlay) Update added in v0.0.3

func (h *HelpOverlay) Update(msg tea.Msg) (*HelpOverlay, HelpResult, tea.Cmd)

Update handles keyboard and mouse input for the help overlay. Returns the result and an optional command.

func (*HelpOverlay) View

func (h *HelpOverlay) View() string

View renders the help overlay

func (*HelpOverlay) Visible

func (h *HelpOverlay) Visible() bool

Visible returns whether the help overlay is visible

type HelpResult added in v0.0.3

type HelpResult int

HelpResult indicates what happened after Update

const (
	HelpResultNone   HelpResult = iota // No action needed
	HelpResultClosed                   // Help was closed
)

type HelpSection

type HelpSection struct {
	Title    string
	Bindings []HelpBinding
}

HelpSection represents a group of keybindings

type HitRegion

type HitRegion struct {
	ID     string
	X      int
	Y      int
	Width  int
	Height int
}

HitRegion represents a rectangular hit target in view-local coordinates.

func (HitRegion) Contains

func (h HitRegion) Contains(x, y int) bool

Contains reports whether the point is within the hit region bounds.

type InputTransformFunc

type InputTransformFunc func(string) string

InputTransformFunc transforms input text before it's added to the input field

type InputValidateFunc

type InputValidateFunc func(string) string

InputValidateFunc validates input and returns an error message (empty = valid)

type SettingsDialog

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

SettingsDialog is a modal dialog for application settings.

func NewSettingsDialog

func NewSettingsDialog(currentTheme ThemeID, showKeymapHints bool) *SettingsDialog

NewSettingsDialog creates a new settings dialog with current values.

func (*SettingsDialog) Cursor

func (s *SettingsDialog) Cursor() *tea.Cursor

func (*SettingsDialog) Hide

func (s *SettingsDialog) Hide()

func (*SettingsDialog) SetShowKeymapHints

func (s *SettingsDialog) SetShowKeymapHints(show bool)

func (*SettingsDialog) SetSize

func (s *SettingsDialog) SetSize(w, h int)

func (*SettingsDialog) SetUpdateInfo added in v0.0.3

func (s *SettingsDialog) SetUpdateInfo(current, latest string, available bool)

SetUpdateInfo sets version information for the updates section.

func (*SettingsDialog) Show

func (s *SettingsDialog) Show()

func (*SettingsDialog) Update

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

Update handles input.

func (*SettingsDialog) View

func (s *SettingsDialog) View() string

func (*SettingsDialog) Visible

func (s *SettingsDialog) Visible() bool

type SettingsResult

type SettingsResult struct {
	Confirmed       bool
	Theme           ThemeID
	ShowKeymapHints bool
}

SettingsResult is sent when the settings dialog is closed.

type Styles

type Styles struct {
	// Layout - Pane borders and structure
	Pane        lipgloss.Style
	FocusedPane lipgloss.Style

	// Text hierarchy
	Title    lipgloss.Style // App name, section headers
	Subtitle lipgloss.Style // Secondary headers
	Body     lipgloss.Style // Normal text
	Muted    lipgloss.Style // De-emphasized text
	Bold     lipgloss.Style // Emphasized text

	// Dashboard - Project tree
	ProjectHeader  lipgloss.Style
	WorktreeRow    lipgloss.Style
	ActiveWorktree lipgloss.Style
	SelectedRow    lipgloss.Style
	CreateButton   lipgloss.Style
	HomeRow        lipgloss.Style
	AddProjectRow  lipgloss.Style

	// Status badges
	StatusClean   lipgloss.Style
	StatusDirty   lipgloss.Style
	StatusPending lipgloss.Style
	StatusRunning lipgloss.Style

	// Git status file indicators
	StatusModified  lipgloss.Style
	StatusAdded     lipgloss.Style
	StatusDeleted   lipgloss.Style
	StatusRenamed   lipgloss.Style
	StatusUntracked lipgloss.Style

	// Center pane - Tabs
	Tab       lipgloss.Style
	ActiveTab lipgloss.Style
	TabBar    lipgloss.Style
	TabPlus   lipgloss.Style

	// Center pane - Agent indicators
	AgentClaude   lipgloss.Style
	AgentCodex    lipgloss.Style
	AgentGemini   lipgloss.Style
	AgentAmp      lipgloss.Style
	AgentOpencode lipgloss.Style
	AgentDroid    lipgloss.Style
	AgentCursor   lipgloss.Style
	AgentTerm     lipgloss.Style

	// Sidebar
	SidebarHeader lipgloss.Style
	SidebarRow    lipgloss.Style
	BranchName    lipgloss.Style
	FilePath      lipgloss.Style

	// Help bar
	Help          lipgloss.Style
	HelpKey       lipgloss.Style
	HelpDesc      lipgloss.Style
	HelpSeparator lipgloss.Style

	// Dialogs
	DialogBox     lipgloss.Style
	DialogTitle   lipgloss.Style
	DialogMessage lipgloss.Style
	DialogOption  lipgloss.Style
	DialogActive  lipgloss.Style

	// Feedback
	Error   lipgloss.Style
	Success lipgloss.Style
	Warning lipgloss.Style
	Info    lipgloss.Style

	// Toast notifications
	ToastSuccess lipgloss.Style
	ToastError   lipgloss.Style
	ToastWarning lipgloss.Style
	ToastInfo    lipgloss.Style
}

Styles contains all the application styles

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns the default application styles using the current theme

type Theme

type Theme struct {
	ID     ThemeID
	Name   string
	Colors ThemeColors
}

Theme represents a complete color theme.

func AvailableThemes

func AvailableThemes() []Theme

AvailableThemes returns all predefined themes, grouped by family.

func AyuDarkTheme

func AyuDarkTheme() Theme

AyuDarkTheme - modern minimal with orange accent

func CatppuccinLatteTheme

func CatppuccinLatteTheme() Theme

CatppuccinLatteTheme - light pastel variant

func CatppuccinTheme

func CatppuccinTheme() Theme

CatppuccinTheme - pastel with mauve/lavender accent (distinct from Tokyo Night)

func DraculaTheme

func DraculaTheme() Theme

DraculaTheme - purple/pink accents

func EverforestTheme

func EverforestTheme() Theme

EverforestTheme - warm green forest tones

func GetCurrentTheme

func GetCurrentTheme() Theme

GetCurrentTheme returns the currently active theme.

func GetTheme

func GetTheme(id ThemeID) Theme

GetTheme returns a theme by ID, defaulting to Gruvbox.

func GitHubDarkTheme

func GitHubDarkTheme() Theme

GitHubDarkTheme - GitHub's dark mode

func GitHubLightTheme

func GitHubLightTheme() Theme

GitHubLightTheme - GitHub's light mode

func GruvboxLightTheme

func GruvboxLightTheme() Theme

GruvboxLightTheme - warm retro light variant

func GruvboxTheme

func GruvboxTheme() Theme

GruvboxTheme - warm, retro, earthy tones with orange accent

func KanagawaTheme

func KanagawaTheme() Theme

KanagawaTheme - Japanese ink painting inspired, wave blue

func MonokaiTheme

func MonokaiTheme() Theme

MonokaiTheme - classic vibrant colors

func NordTheme

func NordTheme() Theme

NordTheme - cool, muted arctic colors

func OneDarkTheme

func OneDarkTheme() Theme

OneDarkTheme - Atom's signature theme with cyan accent

func OneLightTheme

func OneLightTheme() Theme

OneLightTheme - Atom's light theme

func RosePineDawnTheme

func RosePineDawnTheme() Theme

RosePineDawnTheme - light rose variant

func RosePineTheme

func RosePineTheme() Theme

RosePineTheme - elegant rose/pink tones

func SolarizedLightTheme

func SolarizedLightTheme() Theme

SolarizedLightTheme - light version of Solarized

func SolarizedTheme

func SolarizedTheme() Theme

SolarizedTheme - precise, scientific color scheme

func TokyoNightTheme

func TokyoNightTheme() Theme

TokyoNightTheme - cool blue tones

type ThemeColors

type ThemeColors struct {
	// Base palette
	Background    color.Color
	Foreground    color.Color
	Muted         color.Color
	Border        color.Color
	BorderFocused color.Color

	// Semantic colors
	Primary   color.Color
	Secondary color.Color
	Success   color.Color
	Warning   color.Color
	Error     color.Color
	Info      color.Color

	// Surface colors for layering
	Surface0 color.Color
	Surface1 color.Color
	Surface2 color.Color
	Surface3 color.Color

	// Selection/highlight
	Selection color.Color
	Highlight color.Color
}

ThemeColors defines all colors used by the application.

type ThemeID

type ThemeID string

ThemeID identifies a color theme.

const (
	// Dark themes
	ThemeTokyoNight ThemeID = "tokyo-night"
	ThemeDracula    ThemeID = "dracula"
	ThemeNord       ThemeID = "nord"
	ThemeCatppuccin ThemeID = "catppuccin"
	ThemeGruvbox    ThemeID = "gruvbox"
	ThemeSolarized  ThemeID = "solarized"
	ThemeMonokai    ThemeID = "monokai"
	ThemeRosePine   ThemeID = "rose-pine"
	ThemeOneDark    ThemeID = "one-dark"
	ThemeKanagawa   ThemeID = "kanagawa"
	ThemeEverforest ThemeID = "everforest"
	ThemeAyuDark    ThemeID = "ayu-dark"
	ThemeGitHubDark ThemeID = "github-dark"

	// Light themes
	ThemeSolarizedLight  ThemeID = "solarized-light"
	ThemeGitHubLight     ThemeID = "github-light"
	ThemeCatppuccinLatte ThemeID = "catppuccin-latte"
	ThemeOneLight        ThemeID = "one-light"
	ThemeGruvboxLight    ThemeID = "gruvbox-light"
	ThemeRosePineDawn    ThemeID = "rose-pine-dawn"
)

type ThemePreview

type ThemePreview struct {
	Theme ThemeID
}

ThemePreview is sent when user navigates through themes for live preview.

type Toast

type Toast struct {
	Message  string
	Type     ToastType
	Duration time.Duration
}

Toast represents a notification message

type ToastDismissed

type ToastDismissed struct{}

ToastDismissed is sent when a toast should be dismissed

type ToastModel

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

ToastModel manages toast notifications

func NewToastModel

func NewToastModel() *ToastModel

NewToastModel creates a new toast model

func (*ToastModel) Dismiss

func (m *ToastModel) Dismiss()

Dismiss immediately hides the toast

func (*ToastModel) SetStyles

func (m *ToastModel) SetStyles(styles Styles)

SetStyles updates the toast styles (for theme changes).

func (*ToastModel) Show

func (m *ToastModel) Show(message string, toastType ToastType, duration time.Duration) tea.Cmd

Show displays a toast notification

func (*ToastModel) ShowError

func (m *ToastModel) ShowError(message string) tea.Cmd

ShowError shows an error toast

func (*ToastModel) ShowInfo

func (m *ToastModel) ShowInfo(message string) tea.Cmd

ShowInfo shows an info toast

func (*ToastModel) ShowSuccess

func (m *ToastModel) ShowSuccess(message string) tea.Cmd

ShowSuccess shows a success toast

func (*ToastModel) ShowWarning

func (m *ToastModel) ShowWarning(message string) tea.Cmd

ShowWarning shows a warning toast

func (*ToastModel) Update

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

Update handles messages

func (*ToastModel) View

func (m *ToastModel) View() string

View renders the toast notification

func (*ToastModel) Visible

func (m *ToastModel) Visible() bool

Visible returns whether the toast is currently visible

type ToastType

type ToastType int

ToastType identifies the type of toast notification

const (
	ToastInfo ToastType = iota
	ToastSuccess
	ToastError
	ToastWarning
)

Jump to

Keyboard shortcuts

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