tui

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package tui provides the terminal user interface for Chief. It includes the main Bubble Tea application, dashboard views, log viewer, PRD picker, help overlay, and consistent styling.

Index

Constants

View Source
const (
	IconPassed     = "✓"
	IconInProgress = "●"
	IconPending    = "○"
	IconFailed     = "✗"
	IconPaused     = "◐"
)

Status icons

Variables

View Source
var (
	// Primary colors
	PrimaryColor = lipgloss.Color("#00D7FF") // Cyan - primary brand, in-progress states
	SuccessColor = lipgloss.Color("#5AF78E") // Green - passed, complete states
	WarningColor = lipgloss.Color("#F3F99D") // Yellow - paused, warning states
	ErrorColor   = lipgloss.Color("#FF5C57") // Red - failed, error states
	MutedColor   = lipgloss.Color("#6C7086") // Gray - pending, muted text
	BorderColor  = lipgloss.Color("#45475A") // Dark gray - borders, dividers

	// Text colors
	TextColor       = lipgloss.Color("#CDD6F4") // Light gray - primary text
	TextMutedColor  = lipgloss.Color("#6C7086") // Muted text
	TextBrightColor = lipgloss.Color("#FFFFFF") // Bright white - emphasis

	// Background colors
	BgColor          = lipgloss.Color("#1E1E2E") // Dark background
	BgSelectedColor  = lipgloss.Color("#313244") // Selected item background
	BgHighlightColor = lipgloss.Color("#45475A") // Highlight background
)

Color palette - consistent colors used throughout the TUI

View Source
var (

	// Shortcut key style
	ShortcutKeyStyle = lipgloss.NewStyle().
						Foreground(PrimaryColor).
						Bold(true)

	// Shortcut description style
	ShortcutDescStyle = lipgloss.NewStyle().
						Foreground(MutedColor)
)

Footer styles

View Source
var (

	// Panel with focus/active state
	PanelActiveStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(PrimaryColor).
						Padding(0, 1)

	// Panel title style
	PanelTitleStyle = lipgloss.NewStyle().
					Bold(true).
					Foreground(PrimaryColor)
)

Panel styles

View Source
var (

	// State badge styles (with bold for headers)
	StateReadyStyle    = lipgloss.NewStyle().Bold(true).Foreground(MutedColor)
	StateRunningStyle  = lipgloss.NewStyle().Bold(true).Foreground(PrimaryColor)
	StatePausedStyle   = lipgloss.NewStyle().Bold(true).Foreground(WarningColor)
	StateStoppedStyle  = lipgloss.NewStyle().Bold(true).Foreground(MutedColor)
	StateCompleteStyle = lipgloss.NewStyle().Bold(true).Foreground(SuccessColor)
	StateErrorStyle    = lipgloss.NewStyle().Bold(true).Foreground(ErrorColor)
)

Status badge styles - colored badges for state indicators

View Source
var (

	// Subtitle style
	SubtitleStyle = lipgloss.NewStyle().
					Foreground(MutedColor)

	// Description text style
	DescriptionStyle = lipgloss.NewStyle().
						Foreground(TextColor)
)

Title and label styles

View Source
var (
	ActivityRunningStyle  = lipgloss.NewStyle().Foreground(PrimaryColor).Padding(0, 1)
	ActivityErrorStyle    = lipgloss.NewStyle().Foreground(ErrorColor).Padding(0, 1)
	ActivityCompleteStyle = lipgloss.NewStyle().Foreground(SuccessColor).Padding(0, 1)
	ActivityMutedStyle    = lipgloss.NewStyle().Foreground(MutedColor).Padding(0, 1)
)

Activity line styles

View Source
var (
	DividerStyle = lipgloss.NewStyle().
					Foreground(BorderColor)

	// Thick divider (for section separators)
	ThickDividerStyle = lipgloss.NewStyle().
						Foreground(BorderColor).
						Bold(true)
)

Divider styles

View Source
var (
	// TabStyle - inactive tab with rounded border
	TabStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(BorderColor).
				Padding(0, 1)

	// TabActiveStyle - active/viewed tab with primary color border and background
	TabActiveStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(PrimaryColor).
					Background(BgSelectedColor).
					Bold(true).
					Padding(0, 1)

	// TabRunningStyle - running state with primary color border
	TabRunningStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(PrimaryColor).
					Padding(0, 1)

	// TabErrorStyle - error state with error color border
	TabErrorStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(ErrorColor).
					Padding(0, 1)

	// TabNewStyle - "+ New" button with muted styling
	TabNewStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(MutedColor).
				Foreground(MutedColor).
				Padding(0, 1)
)

Tab bar styles

View Source
var (

	// Header border/divider
	HeaderBorderStyle = lipgloss.NewStyle().
		Foreground(BorderColor)
)

Header styles

View Source
var (

	// Progress percentage style
	ProgressPercentStyle = lipgloss.NewStyle().
		Foreground(MutedColor)
)

Progress bar styles

View Source
var (

	// Unselected/normal item style
	UnselectedStyle = lipgloss.NewStyle().
		Foreground(TextColor)
)

Selection styles

Functions

func GetActivityStyle

func GetActivityStyle(state AppState) lipgloss.Style

GetActivityStyle returns the appropriate style for activity line based on state.

func GetStateStyle

func GetStateStyle(state AppState) lipgloss.Style

GetStateStyle returns the appropriate style for an app state.

func GetStatusIcon

func GetStatusIcon(passed, inProgress bool) string

GetStatusIcon returns the appropriate icon for a story's status.

Types

type App

type App struct {

	// Post-exit action - what to do after TUI exits
	PostExitAction PostExitAction
	PostExitPRD    string // PRD name for post-exit action
	// contains filtered or unexported fields
}

App is the main Bubble Tea model for the Chief TUI.

func NewApp

func NewApp(prdPath string, provider loop.Provider) (*App, error)

NewApp creates a new App with the given PRD.

func NewAppWithOptions

func NewAppWithOptions(prdPath string, maxIter int, provider loop.Provider) (*App, error)

NewAppWithOptions creates a new App with the given PRD and options. If maxIter <= 0, it will be calculated dynamically based on remaining stories.

func (*App) DisableRetry

func (a *App) DisableRetry()

DisableRetry disables automatic retry on Claude crashes.

func (*App) GetCompletionPercentage

func (a *App) GetCompletionPercentage() float64

GetCompletionPercentage returns the percentage of completed stories.

func (*App) GetElapsedTime

func (a *App) GetElapsedTime() time.Duration

GetElapsedTime returns the elapsed time since the loop started.

func (*App) GetIteration

func (a *App) GetIteration() int

GetIteration returns the current iteration count.

func (*App) GetLastActivity

func (a *App) GetLastActivity() string

GetLastActivity returns the last activity message.

func (*App) GetPRD

func (a *App) GetPRD() *prd.PRD

GetPRD returns the current PRD.

func (*App) GetSelectedStory

func (a *App) GetSelectedStory() *prd.UserStory

GetSelectedStory returns the currently selected story.

func (*App) GetState

func (a *App) GetState() AppState

GetState returns the current app state.

func (App) Init

func (a App) Init() tea.Cmd

Init initializes the App.

func (*App) SetCompletionCallback

func (a *App) SetCompletionCallback(fn func(prdName string))

SetCompletionCallback sets a callback that is called when any PRD completes.

func (*App) SetVerbose

func (a *App) SetVerbose(v bool)

SetVerbose enables or disables verbose mode (raw Claude output in log).

func (App) Update

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

Update handles messages and updates the model.

func (App) View

func (a App) View() string

View renders the TUI.

type AppState

type AppState int

AppState represents the current state of the application.

const (
	StateReady AppState = iota
	StateRunning
	StatePaused
	StateStopped
	StateComplete
	StateError
)

func (AppState) String

func (s AppState) String() string

type AutoActionState

type AutoActionState int

AutoActionState represents the progress of an auto-action (push or PR).

const (
	AutoActionIdle       AutoActionState = iota // Not configured or not started
	AutoActionInProgress                        // Currently running
	AutoActionSuccess                           // Completed successfully
	AutoActionError                             // Failed with error
)

type BranchWarning

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

BranchWarning manages the branch warning dialog state.

func NewBranchWarning

func NewBranchWarning() *BranchWarning

NewBranchWarning creates a new branch warning dialog.

func (*BranchWarning) AddInputChar

func (b *BranchWarning) AddInputChar(ch rune)

AddInputChar adds a character to the branch name.

func (*BranchWarning) CancelEditMode

func (b *BranchWarning) CancelEditMode()

CancelEditMode exits edit mode.

func (*BranchWarning) DeleteInputChar

func (b *BranchWarning) DeleteInputChar()

DeleteInputChar removes the last character from the branch name.

func (*BranchWarning) GetDialogContext

func (b *BranchWarning) GetDialogContext() DialogContext

GetDialogContext returns the current dialog context.

func (*BranchWarning) GetSelectedOption

func (b *BranchWarning) GetSelectedOption() BranchWarningOption

GetSelectedOption returns the currently selected option.

func (*BranchWarning) GetSuggestedBranch

func (b *BranchWarning) GetSuggestedBranch() string

GetSuggestedBranch returns the branch name (may be edited by user).

func (*BranchWarning) IsEditMode

func (b *BranchWarning) IsEditMode() bool

IsEditMode returns true if the branch name is being edited.

func (*BranchWarning) MoveDown

func (b *BranchWarning) MoveDown()

MoveDown moves selection down.

func (*BranchWarning) MoveUp

func (b *BranchWarning) MoveUp()

MoveUp moves selection up.

func (*BranchWarning) Render

func (b *BranchWarning) Render() string

Render renders the branch warning dialog.

func (*BranchWarning) Reset

func (b *BranchWarning) Reset()

Reset resets the dialog state.

func (*BranchWarning) SetContext

func (b *BranchWarning) SetContext(currentBranch, prdName, worktreePath string)

SetContext sets the branch, PRD context, and worktree path for the warning.

func (*BranchWarning) SetDialogContext

func (b *BranchWarning) SetDialogContext(ctx DialogContext)

SetDialogContext sets which context mode the dialog should display.

func (*BranchWarning) SetSize

func (b *BranchWarning) SetSize(width, height int)

SetSize sets the dialog dimensions.

func (*BranchWarning) StartEditMode

func (b *BranchWarning) StartEditMode()

StartEditMode enters edit mode for the branch name.

type BranchWarningOption

type BranchWarningOption int

BranchWarningOption represents the user's choice in the branch warning dialog.

const (
	BranchOptionCreateWorktree BranchWarningOption = iota // Create worktree + branch
	BranchOptionCreateBranch                              // Create branch only (no worktree)
	BranchOptionContinue                                  // Continue on current branch / run in same directory
	BranchOptionCancel                                    // Cancel
)

type CleanConfirmation

type CleanConfirmation struct {
	EntryName   string // Name of the PRD being cleaned
	Branch      string // Branch name to display
	WorktreeDir string // Worktree path to display
	SelectedIdx int    // Selected option index (0-2)
}

CleanConfirmation holds the state of the clean confirmation dialog.

type CleanOption

type CleanOption int

CleanOption represents the user's choice in the clean confirmation dialog.

const (
	CleanOptionRemoveAll    CleanOption = iota // Remove worktree + delete branch
	CleanOptionWorktreeOnly                    // Remove worktree only (keep branch)
	CleanOptionCancel                          // Cancel
)

type CleanResult

type CleanResult struct {
	Success bool   // Whether the clean succeeded
	Message string // Success or error message
}

CleanResult holds the result of a clean operation for display.

type CompletionScreen

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

CompletionScreen manages the completion screen state shown when a PRD finishes.

func NewCompletionScreen

func NewCompletionScreen() *CompletionScreen

NewCompletionScreen creates a new completion screen.

func (*CompletionScreen) Branch

func (c *CompletionScreen) Branch() string

Branch returns the branch shown on the completion screen.

func (*CompletionScreen) Configure

func (c *CompletionScreen) Configure(prdName string, completed, total int, branch string, commitCount int, hasAutoActions bool, totalDuration time.Duration, storyTimings []StoryTiming)

Configure sets up the completion screen with PRD completion data.

func (*CompletionScreen) HasBranch

func (c *CompletionScreen) HasBranch() bool

HasBranch returns true if the completion screen has a branch set.

func (*CompletionScreen) HasConfetti

func (c *CompletionScreen) HasConfetti() bool

HasConfetti returns true if confetti is still animating.

func (*CompletionScreen) IsAutoActionRunning

func (c *CompletionScreen) IsAutoActionRunning() bool

IsAutoActionRunning returns true if any auto-action is currently in progress.

func (*CompletionScreen) PRDName

func (c *CompletionScreen) PRDName() string

PRDName returns the PRD name shown on the completion screen.

func (*CompletionScreen) Render

func (c *CompletionScreen) Render() string

Render renders the completion screen with confetti background.

func (*CompletionScreen) SetPRError

func (c *CompletionScreen) SetPRError(errMsg string)

SetPRError marks the PR creation as failed with an error message.

func (*CompletionScreen) SetPRInProgress

func (c *CompletionScreen) SetPRInProgress()

SetPRInProgress marks the PR creation as in progress.

func (*CompletionScreen) SetPRSuccess

func (c *CompletionScreen) SetPRSuccess(url, title string)

SetPRSuccess marks the PR creation as successful.

func (*CompletionScreen) SetPushError

func (c *CompletionScreen) SetPushError(errMsg string)

SetPushError marks the push as failed with an error message.

func (*CompletionScreen) SetPushInProgress

func (c *CompletionScreen) SetPushInProgress()

SetPushInProgress marks the push as in progress.

func (*CompletionScreen) SetPushSuccess

func (c *CompletionScreen) SetPushSuccess()

SetPushSuccess marks the push as successful.

func (*CompletionScreen) SetSize

func (c *CompletionScreen) SetSize(width, height int)

SetSize sets the screen dimensions.

func (*CompletionScreen) Tick

func (c *CompletionScreen) Tick()

Tick advances the spinner animation frame.

func (*CompletionScreen) TickConfetti

func (c *CompletionScreen) TickConfetti()

TickConfetti advances the confetti animation by one frame.

type Confetti

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

Confetti manages a collection of animated confetti particles.

func NewConfetti

func NewConfetti(width, height int) *Confetti

NewConfetti creates a new confetti system with particles spread across the screen.

func (*Confetti) HasParticles

func (c *Confetti) HasParticles() bool

HasParticles returns true if there are still active particles.

func (*Confetti) Render

func (c *Confetti) Render(width, height int) string

Render draws all particles onto a character grid and returns it as a string.

func (*Confetti) SetSize

func (c *Confetti) SetSize(width, height int)

SetSize updates the confetti bounds to match the current screen size.

func (*Confetti) Tick

func (c *Confetti) Tick()

Tick advances all particles by one frame, respawning expired ones at the top.

type DialogContext

type DialogContext int

DialogContext determines which set of options to show.

const (
	// DialogProtectedBranch: on a protected branch (main/master)
	DialogProtectedBranch DialogContext = iota
	// DialogAnotherPRDRunning: another PRD is already running in the same directory
	DialogAnotherPRDRunning
	// DialogNoConflicts: not protected, nothing else running in same dir
	DialogNoConflicts
)

type DiffViewer

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

DiffViewer displays git diffs with syntax highlighting and scrolling.

func NewDiffViewer

func NewDiffViewer(baseDir string) *DiffViewer

NewDiffViewer creates a new diff viewer.

func (*DiffViewer) Load

func (d *DiffViewer) Load()

Load fetches the latest git diff for the full branch.

func (*DiffViewer) LoadForStory

func (d *DiffViewer) LoadForStory(storyID, title string)

LoadForStory fetches the git diff for a specific story's commit. If no commit is found, it shows a "not committed yet" message.

func (*DiffViewer) PageDown

func (d *DiffViewer) PageDown()

PageDown scrolls down half a page.

func (*DiffViewer) PageUp

func (d *DiffViewer) PageUp()

PageUp scrolls up half a page.

func (*DiffViewer) Render

func (d *DiffViewer) Render() string

Render renders the diff view.

func (*DiffViewer) ScrollDown

func (d *DiffViewer) ScrollDown()

ScrollDown scrolls down one line.

func (*DiffViewer) ScrollToBottom

func (d *DiffViewer) ScrollToBottom()

ScrollToBottom scrolls to the bottom.

func (*DiffViewer) ScrollToTop

func (d *DiffViewer) ScrollToTop()

ScrollToTop scrolls to the top.

func (*DiffViewer) ScrollUp

func (d *DiffViewer) ScrollUp()

ScrollUp scrolls up one line.

func (*DiffViewer) SetBaseDir

func (d *DiffViewer) SetBaseDir(dir string)

SetBaseDir updates the base directory used for loading diffs.

func (*DiffViewer) SetSize

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

SetSize sets the viewport dimensions.

type FirstTimeSetup

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

FirstTimeSetup is a TUI for first-time project setup.

func NewFirstTimeSetup

func NewFirstTimeSetup(baseDir string, showGitignore bool) *FirstTimeSetup

NewFirstTimeSetup creates a new first-time setup TUI.

func (FirstTimeSetup) GetResult

func (f FirstTimeSetup) GetResult() FirstTimeSetupResult

GetResult returns the setup result.

func (FirstTimeSetup) Init

func (f FirstTimeSetup) Init() tea.Cmd

Init initializes the model.

func (FirstTimeSetup) Update

func (f FirstTimeSetup) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages.

func (FirstTimeSetup) View

func (f FirstTimeSetup) View() string

View renders the TUI.

type FirstTimeSetupResult

type FirstTimeSetupResult struct {
	PRDName            string
	AddedGitignore     bool
	Cancelled          bool
	PushOnComplete     bool
	CreatePROnComplete bool
}

FirstTimeSetupResult contains the result of the first-time setup flow.

func RunFirstTimeSetup

func RunFirstTimeSetup(baseDir string, showGitignore bool) (FirstTimeSetupResult, error)

RunFirstTimeSetup runs the first-time setup TUI and returns the result.

type FirstTimeSetupStep

type FirstTimeSetupStep int

FirstTimeSetupStep represents the current step in the setup flow.

const (
	StepGitignore FirstTimeSetupStep = iota
	StepPRDName
	StepPostCompletion
	StepGHError
)

type HelpOverlay

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

HelpOverlay manages the help overlay state.

func NewHelpOverlay

func NewHelpOverlay() *HelpOverlay

NewHelpOverlay creates a new help overlay.

func (*HelpOverlay) GetCategories

func (h *HelpOverlay) GetCategories() []ShortcutCategory

GetCategories returns the shortcut categories for the current view.

func (*HelpOverlay) Render

func (h *HelpOverlay) Render() string

Render renders the help overlay.

func (*HelpOverlay) SetSize

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

SetSize sets the overlay dimensions.

func (*HelpOverlay) SetViewMode

func (h *HelpOverlay) SetViewMode(mode ViewMode)

SetViewMode sets the current view mode for context-aware shortcuts.

type LaunchEditMsg

type LaunchEditMsg struct {
	Name string
}

LaunchEditMsg signals the TUI should exit to launch the edit flow.

type LaunchInitMsg

type LaunchInitMsg struct {
	Name string
}

LaunchInitMsg signals the TUI should exit to launch the init flow.

type LogEntry

type LogEntry struct {
	Type      loop.EventType
	Text      string
	Tool      string
	ToolInput map[string]interface{}
	StoryID   string
	FilePath  string // For Read tool results, stores the file path for syntax highlighting
	// contains filtered or unexported fields
}

LogEntry represents a single entry in the log viewer.

type LogViewer

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

LogViewer manages the log viewport state.

func NewLogViewer

func NewLogViewer() *LogViewer

NewLogViewer creates a new log viewer.

func (*LogViewer) AddEvent

func (l *LogViewer) AddEvent(event loop.Event)

AddEvent adds a loop event to the log.

func (*LogViewer) Clear

func (l *LogViewer) Clear()

Clear clears all log entries.

func (*LogViewer) IsAutoScrolling

func (l *LogViewer) IsAutoScrolling() bool

IsAutoScrolling returns whether auto-scroll is enabled.

func (*LogViewer) PageDown

func (l *LogViewer) PageDown()

PageDown scrolls down by half a page.

func (*LogViewer) PageUp

func (l *LogViewer) PageUp()

PageUp scrolls up by half a page.

func (*LogViewer) Render

func (l *LogViewer) Render() string

Render renders only the visible portion of the log viewer.

func (*LogViewer) ScrollDown

func (l *LogViewer) ScrollDown()

ScrollDown scrolls down by one line.

func (*LogViewer) ScrollToBottom

func (l *LogViewer) ScrollToBottom()

ScrollToBottom (exported) scrolls to the bottom.

func (*LogViewer) ScrollToTop

func (l *LogViewer) ScrollToTop()

ScrollToTop scrolls to the top.

func (*LogViewer) ScrollUp

func (l *LogViewer) ScrollUp()

ScrollUp scrolls up by one line.

func (*LogViewer) SetSize

func (l *LogViewer) SetSize(width, height int)

SetSize sets the viewport dimensions. Rebuilds the line cache if width changed.

type LoopEventMsg

type LoopEventMsg struct {
	PRDName string
	Event   loop.Event
}

LoopEventMsg wraps a loop event for the Bubble Tea model.

type LoopFinishedMsg

type LoopFinishedMsg struct {
	PRDName string
	Err     error
}

LoopFinishedMsg is sent when the loop finishes (complete, paused, stopped, or error).

type MergeResult

type MergeResult struct {
	Success   bool     // Whether the merge succeeded
	Message   string   // Success message or error summary
	Conflicts []string // Conflicting file list (empty on success)
	Branch    string   // The branch that was merged
}

MergeResult holds the result of a merge operation for display.

type PRDCompletedMsg

type PRDCompletedMsg struct {
	PRDName string
}

PRDCompletedMsg is sent when any PRD completes all stories.

type PRDEntry

type PRDEntry struct {
	Name        string         // Directory name (e.g., "main", "feature-x")
	Path        string         // Full path to prd.json
	PRD         *prd.PRD       // Loaded PRD data
	LoadError   error          // Error if PRD couldn't be loaded
	Completed   int            // Number of completed stories
	Total       int            // Total number of stories
	InProgress  bool           // Whether any story is in progress
	LoopState   loop.LoopState // Current loop state from manager
	Iteration   int            // Current iteration if running
	Branch      string         // Git branch for this PRD (empty = no branch)
	WorktreeDir string         // Worktree directory (empty = current directory)
	Orphaned    bool           // True if worktree exists on disk but no running PRD tracks it
}

PRDEntry represents a PRD in the picker list.

type PRDPicker

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

PRDPicker manages the PRD picker modal state.

func NewPRDPicker

func NewPRDPicker(basePath string, currentPRDName string, manager *loop.Manager) *PRDPicker

NewPRDPicker creates a new PRD picker.

func (*PRDPicker) AddInputChar

func (p *PRDPicker) AddInputChar(ch rune)

AddInputChar adds a character to the input.

func (*PRDPicker) CanClean

func (p *PRDPicker) CanClean() bool

CanClean returns true if the selected entry is a non-running PRD with a worktree.

func (*PRDPicker) CanMerge

func (p *PRDPicker) CanMerge() bool

CanMerge returns true if the selected entry is a completed PRD with a branch set.

func (*PRDPicker) CancelCleanConfirmation

func (p *PRDPicker) CancelCleanConfirmation()

CancelCleanConfirmation closes the clean confirmation dialog.

func (*PRDPicker) CancelInputMode

func (p *PRDPicker) CancelInputMode()

CancelInputMode exits input mode without creating a PRD.

func (*PRDPicker) CleanConfirmMoveDown

func (p *PRDPicker) CleanConfirmMoveDown()

CleanConfirmMoveDown moves the selection down in the clean confirmation dialog.

func (*PRDPicker) CleanConfirmMoveUp

func (p *PRDPicker) CleanConfirmMoveUp()

CleanConfirmMoveUp moves the selection up in the clean confirmation dialog.

func (*PRDPicker) ClearCleanResult

func (p *PRDPicker) ClearCleanResult()

ClearCleanResult clears any displayed clean result.

func (*PRDPicker) ClearMergeResult

func (p *PRDPicker) ClearMergeResult()

ClearMergeResult clears any displayed merge result.

func (*PRDPicker) DeleteInputChar

func (p *PRDPicker) DeleteInputChar()

DeleteInputChar removes the last character from the input.

func (*PRDPicker) GetCleanConfirmation

func (p *PRDPicker) GetCleanConfirmation() *CleanConfirmation

GetCleanConfirmation returns the current clean confirmation state.

func (*PRDPicker) GetCleanOption

func (p *PRDPicker) GetCleanOption() CleanOption

GetCleanOption returns the selected clean option.

func (*PRDPicker) GetInputValue

func (p *PRDPicker) GetInputValue() string

GetInputValue returns the current input value.

func (*PRDPicker) GetSelectedEntry

func (p *PRDPicker) GetSelectedEntry() *PRDEntry

GetSelectedEntry returns the currently selected PRD entry.

func (*PRDPicker) HasCleanConfirmation

func (p *PRDPicker) HasCleanConfirmation() bool

HasCleanConfirmation returns true if the clean confirmation dialog is active.

func (*PRDPicker) HasCleanResult

func (p *PRDPicker) HasCleanResult() bool

HasCleanResult returns true if there is a clean result to display.

func (*PRDPicker) HasMergeResult

func (p *PRDPicker) HasMergeResult() bool

HasMergeResult returns true if there is a merge result to display.

func (*PRDPicker) IsEmpty

func (p *PRDPicker) IsEmpty() bool

IsEmpty returns true if there are no PRDs.

func (*PRDPicker) IsInputMode

func (p *PRDPicker) IsInputMode() bool

IsInputMode returns true if the picker is in input mode for new PRD name.

func (*PRDPicker) MoveDown

func (p *PRDPicker) MoveDown()

MoveDown moves the selection down.

func (*PRDPicker) MoveUp

func (p *PRDPicker) MoveUp()

MoveUp moves the selection up.

func (*PRDPicker) Refresh

func (p *PRDPicker) Refresh()

Refresh reloads the list of PRDs from the .chief/prds/ directory.

func (*PRDPicker) Render

func (p *PRDPicker) Render() string

Render renders the PRD picker modal.

func (*PRDPicker) SetCleanResult

func (p *PRDPicker) SetCleanResult(result *CleanResult)

SetCleanResult sets the clean result for display.

func (*PRDPicker) SetCurrentPRD

func (p *PRDPicker) SetCurrentPRD(name string)

SetCurrentPRD sets the current PRD name for highlighting.

func (*PRDPicker) SetManager

func (p *PRDPicker) SetManager(manager *loop.Manager)

SetManager sets the loop manager reference.

func (*PRDPicker) SetMergeResult

func (p *PRDPicker) SetMergeResult(result *MergeResult)

SetMergeResult sets the merge result for display.

func (*PRDPicker) SetSize

func (p *PRDPicker) SetSize(width, height int)

SetSize sets the modal dimensions.

func (*PRDPicker) StartCleanConfirmation

func (p *PRDPicker) StartCleanConfirmation()

StartCleanConfirmation opens the clean confirmation dialog for the selected entry.

func (*PRDPicker) StartInputMode

func (p *PRDPicker) StartInputMode()

StartInputMode enters input mode for creating a new PRD.

type PRDUpdateMsg

type PRDUpdateMsg struct {
	PRD   *prd.PRD
	Error error
}

PRDUpdateMsg is sent when the PRD file changes.

type Particle

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

Particle represents a single confetti particle.

type PostExitAction

type PostExitAction int

PostExitAction represents an action to take after the TUI exits.

const (
	PostExitNone PostExitAction = iota
	PostExitInit
	PostExitEdit
)

type ProgressUpdateMsg

type ProgressUpdateMsg struct {
	Entries map[string][]prd.ProgressEntry
}

ProgressUpdateMsg is sent when progress.md changes.

type QuitConfirmOption

type QuitConfirmOption int

QuitConfirmOption represents the user's choice in the quit confirmation dialog.

const (
	QuitOptionQuit   QuitConfirmOption = iota // Quit and stop loop
	QuitOptionCancel                          // Cancel
)

type QuitConfirmation

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

QuitConfirmation manages the quit confirmation dialog state.

func NewQuitConfirmation

func NewQuitConfirmation() *QuitConfirmation

NewQuitConfirmation creates a new quit confirmation dialog.

func (*QuitConfirmation) GetSelected

func (q *QuitConfirmation) GetSelected() QuitConfirmOption

GetSelected returns the currently selected option.

func (*QuitConfirmation) MoveDown

func (q *QuitConfirmation) MoveDown()

MoveDown moves selection down.

func (*QuitConfirmation) MoveUp

func (q *QuitConfirmation) MoveUp()

MoveUp moves selection up.

func (*QuitConfirmation) Render

func (q *QuitConfirmation) Render() string

Render renders the quit confirmation dialog.

func (*QuitConfirmation) Reset

func (q *QuitConfirmation) Reset()

Reset resets the dialog state to defaults.

func (*QuitConfirmation) SetSize

func (q *QuitConfirmation) SetSize(width, height int)

SetSize sets the dialog dimensions.

type SettingsItem

type SettingsItem struct {
	Section   string
	Label     string
	Key       string // config key for identification
	Type      SettingsItemType
	BoolVal   bool
	StringVal string
}

SettingsItem represents a single editable setting.

type SettingsItemType

type SettingsItemType int

SettingsItemType represents the type of a settings item.

const (
	SettingsItemBool SettingsItemType = iota
	SettingsItemString
)

type SettingsOverlay

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

SettingsOverlay manages the settings modal overlay state.

func NewSettingsOverlay

func NewSettingsOverlay() *SettingsOverlay

NewSettingsOverlay creates a new settings overlay.

func (*SettingsOverlay) AddEditChar

func (s *SettingsOverlay) AddEditChar(ch rune)

AddEditChar adds a character to the edit buffer.

func (*SettingsOverlay) ApplyToConfig

func (s *SettingsOverlay) ApplyToConfig(cfg *config.Config)

ApplyToConfig writes the current settings values back to a config.

func (*SettingsOverlay) CancelEdit

func (s *SettingsOverlay) CancelEdit()

CancelEdit discards the edit buffer.

func (*SettingsOverlay) ConfirmEdit

func (s *SettingsOverlay) ConfirmEdit()

ConfirmEdit saves the edit buffer to the selected item.

func (*SettingsOverlay) DeleteEditChar

func (s *SettingsOverlay) DeleteEditChar()

DeleteEditChar removes the last character from the edit buffer.

func (*SettingsOverlay) DismissGHError

func (s *SettingsOverlay) DismissGHError()

DismissGHError clears the GH CLI error.

func (*SettingsOverlay) GetSelectedItem

func (s *SettingsOverlay) GetSelectedItem() *SettingsItem

GetSelectedItem returns the currently selected settings item.

func (*SettingsOverlay) HasGHError

func (s *SettingsOverlay) HasGHError() bool

HasGHError returns true if a GH CLI error is being displayed.

func (*SettingsOverlay) IsEditing

func (s *SettingsOverlay) IsEditing() bool

IsEditing returns true if a string value is being edited.

func (*SettingsOverlay) LoadFromConfig

func (s *SettingsOverlay) LoadFromConfig(cfg *config.Config)

LoadFromConfig populates settings items from a config.

func (*SettingsOverlay) MoveDown

func (s *SettingsOverlay) MoveDown()

MoveDown moves the selection down.

func (*SettingsOverlay) MoveUp

func (s *SettingsOverlay) MoveUp()

MoveUp moves the selection up.

func (*SettingsOverlay) Render

func (s *SettingsOverlay) Render() string

Render renders the settings overlay.

func (*SettingsOverlay) RevertToggle

func (s *SettingsOverlay) RevertToggle()

RevertToggle reverts the last toggle (used when validation fails).

func (*SettingsOverlay) SetGHError

func (s *SettingsOverlay) SetGHError(msg string)

SetGHError sets the GH CLI error message.

func (*SettingsOverlay) SetSize

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

SetSize sets the overlay dimensions.

func (*SettingsOverlay) StartEditing

func (s *SettingsOverlay) StartEditing()

StartEditing begins inline editing of the selected string value.

func (*SettingsOverlay) ToggleBool

func (s *SettingsOverlay) ToggleBool() (key string, newVal bool)

ToggleBool toggles the selected boolean value. Returns the key and new value for the caller to act on.

type Shortcut

type Shortcut struct {
	Key         string
	Description string
}

Shortcut represents a single keyboard shortcut.

type ShortcutCategory

type ShortcutCategory struct {
	Name      string
	Shortcuts []Shortcut
}

ShortcutCategory represents a category of keyboard shortcuts.

type StoryTiming

type StoryTiming struct {
	StoryID  string
	Title    string
	Duration time.Duration
}

StoryTiming records the duration of a completed story.

type TabBar

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

TabBar manages the always-visible PRD tab bar.

func NewTabBar

func NewTabBar(baseDir, currentPRD string, manager *loop.Manager) *TabBar

NewTabBar creates a new tab bar.

func (*TabBar) Count

func (t *TabBar) Count() int

Count returns the number of PRD tabs (excludes "+ New").

func (*TabBar) GetEntry

func (t *TabBar) GetEntry(index int) *TabEntry

GetEntry returns the entry at the given 0-based index.

func (*TabBar) Refresh

func (t *TabBar) Refresh()

Refresh reloads the list of PRDs from the .chief/prds/ directory.

func (*TabBar) Render

func (t *TabBar) Render() string

Render renders the tab bar.

func (*TabBar) RenderCompact

func (t *TabBar) RenderCompact() string

RenderCompact renders a compact version of the tab bar for narrow terminals.

func (*TabBar) SetActiveByName

func (t *TabBar) SetActiveByName(name string)

SetActiveByName sets the active tab by PRD name.

func (*TabBar) SetSize

func (t *TabBar) SetSize(width int)

SetSize sets the available width for the tab bar.

type TabEntry

type TabEntry struct {
	Name      string         // Directory name (e.g., "main", "feature-x")
	Path      string         // Full path to prd.json
	Branch    string         // Git branch name (e.g., "chief/auth"), empty if none
	LoopState loop.LoopState // Current loop state from manager
	Completed int            // Number of completed stories
	Total     int            // Total number of stories
	Iteration int            // Current iteration if running
	IsActive  bool           // Whether this is the currently viewed PRD
}

TabEntry represents a PRD tab in the tab bar.

type ViewMode

type ViewMode int

ViewMode represents which view is currently active.

const (
	ViewDashboard ViewMode = iota
	ViewLog
	ViewDiff
	ViewPicker
	ViewHelp
	ViewBranchWarning
	ViewWorktreeSpinner
	ViewCompletion
	ViewSettings
	ViewQuitConfirm
)

type WorktreeSpinner

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

WorktreeSpinner manages the worktree setup spinner overlay state.

func NewWorktreeSpinner

func NewWorktreeSpinner() *WorktreeSpinner

NewWorktreeSpinner creates a new worktree setup spinner.

func (*WorktreeSpinner) AdvanceStep

func (w *WorktreeSpinner) AdvanceStep()

AdvanceStep marks the current step as complete and moves to the next.

func (*WorktreeSpinner) Cancel

func (w *WorktreeSpinner) Cancel()

Cancel marks the spinner as cancelled.

func (*WorktreeSpinner) Configure

func (w *WorktreeSpinner) Configure(prdName, branchName, defaultBranch, worktreePath, setupCommand string)

Configure sets up the spinner with the given parameters.

func (*WorktreeSpinner) GetCurrentStep

func (w *WorktreeSpinner) GetCurrentStep() WorktreeSpinnerStep

GetCurrentStep returns the current step.

func (*WorktreeSpinner) HasError

func (w *WorktreeSpinner) HasError() bool

HasError returns true if there is an error.

func (*WorktreeSpinner) HasSetupCommand

func (w *WorktreeSpinner) HasSetupCommand() bool

HasSetupCommand returns true if a setup command is configured.

func (*WorktreeSpinner) IsCancelled

func (w *WorktreeSpinner) IsCancelled() bool

IsCancelled returns true if the user cancelled.

func (*WorktreeSpinner) IsDone

func (w *WorktreeSpinner) IsDone() bool

IsDone returns true if all steps are complete.

func (*WorktreeSpinner) Render

func (w *WorktreeSpinner) Render() string

Render renders the spinner overlay.

func (*WorktreeSpinner) SetError

func (w *WorktreeSpinner) SetError(err string)

SetError sets an error on the current step.

func (*WorktreeSpinner) SetSize

func (w *WorktreeSpinner) SetSize(width, height int)

SetSize sets the spinner dimensions.

func (*WorktreeSpinner) Tick

func (w *WorktreeSpinner) Tick()

Tick advances the spinner animation frame.

type WorktreeSpinnerStep

type WorktreeSpinnerStep int

WorktreeSpinnerStep represents a step in the worktree setup process.

const (
	SpinnerStepCreateBranch WorktreeSpinnerStep = iota
	SpinnerStepCreateWorktree
	SpinnerStepRunSetup
	SpinnerStepDone
)

Jump to

Keyboard shortcuts

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