tui

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveMilestoneTemplate

func ResolveMilestoneTemplate() (string, error)

ResolveMilestoneTemplate resolves the template for milestone spec markdown.

Types

type AgentGroupsModel

type AgentGroupsModel struct {
	Groups                []config.AgentGroup // Merged agent groups lists
	AvailableAgents       []config.Agent      // Discovered dynamic agents list
	SelectedGroupIdx      int
	SelectedAgentIdx      int
	AvailableAgentIdx     int
	FocusCol              int // 0: Groups List, 1: Pipeline Agents list, 2: Available Agents list, 3: Naming Group
	NewGroupName          string
	SavePrompt            bool
	Width                 int
	Height                int
	Styles                Styles
	ErrorMsg              string
	SuccessMsg            string
	HasChanges            bool
	GroupScrollOffset     int
	PipelineScrollOffset  int
	AvailableScrollOffset int
}

AgentGroupsModel manages viewing, editing, and sorting agent pipeline groups.

func NewAgentGroupsModel

func NewAgentGroupsModel(styles Styles) AgentGroupsModel

NewAgentGroupsModel instantiates a new AgentGroupsModel.

func (*AgentGroupsModel) ClampScrollOffsets

func (m *AgentGroupsModel) ClampScrollOffsets()

func (AgentGroupsModel) Init

func (m AgentGroupsModel) Init() tea.Cmd

func (AgentGroupsModel) Update

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

func (AgentGroupsModel) View

func (m AgentGroupsModel) View() string

type ChangeScreenMsg

type ChangeScreenMsg struct {
	Screen Screen
	Data   interface{}
}

ChangeScreenMsg is sent to switch views.

type CreateMilestoneModel

type CreateMilestoneModel struct {
	Mode          CreateScreenMode
	RunMilestone  config.Milestone
	RunRunnerLLM  string
	RunRunnerMode string
	RunNoBranch   bool
	RunGroup      config.AgentGroup
	RunSingleID   string
	NextID        string
	TitleInput    textinput.Model
	GoalInput     textarea.Model
	Spinner       spinner.Model
	RunnerType    string
	DefaultLLM    string
	CreateBranch  bool
	Loading       bool
	Logs          []string
	FocusIndex    int
	Width         int
	Height        int
	Styles        Styles
	ErrorMsg      string
}

CreateMilestoneModel handles the form for creating a new milestone.

func NewCreateMilestoneModel

func NewCreateMilestoneModel(styles Styles) CreateMilestoneModel

NewCreateMilestoneModel instantiates the creation form model.

func (CreateMilestoneModel) Init

func (m CreateMilestoneModel) Init() tea.Cmd

Init triggers cursor blink.

func (CreateMilestoneModel) Update

Update handles input fields, tab navigation and form submission/cancellation.

func (CreateMilestoneModel) View

func (m CreateMilestoneModel) View() string

View draws the creation form layout.

type CreateMilestoneMsg

type CreateMilestoneMsg struct {
	ID                 string
	Title              string
	Goal               string
	AcceptanceCriteria []string
	Checks             []string
	RunnerType         string
	CreateBranch       bool
}

CreateMilestoneMsg is sent when submitting the form to create a new milestone.

type CreateScreenMode

type CreateScreenMode int
const (
	ModeCreateMilestone CreateScreenMode = iota
	ModeCycleNote
)

type DashboardModel

type DashboardModel struct {
	Table  table.Model
	Config *config.Config
	State  *config.State
	Width  int
	Height int
	Styles Styles
}

DashboardModel manages the main dashboard table displaying all milestones.

func NewDashboardModel

func NewDashboardModel(cfg *config.Config, state *config.State, styles Styles) DashboardModel

NewDashboardModel creates and returns a new DashboardModel with initial columns.

func (DashboardModel) Init

func (m DashboardModel) Init() tea.Cmd

Init initializes the sub-model.

func (*DashboardModel) SelectMilestone

func (m *DashboardModel) SelectMilestone(id string)

SelectMilestone selects the row in the table matching the given milestone ID.

func (DashboardModel) Update

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

Update handles resizing, navigation and milestone status updates/logging.

func (DashboardModel) View

func (m DashboardModel) View() string

View outputs the rendered table string with a help/commands guide.

type DeleteCycleMsg

type DeleteCycleMsg struct {
	MilestoneID string
	CycleNumber int
}

type DeleteMilestoneMsg

type DeleteMilestoneMsg struct {
	MilestoneID string
}

type DetailsModel

type DetailsModel struct {
	Milestone              config.Milestone
	History                []config.MilestoneCycleLog
	Width                  int
	Height                 int
	Styles                 Styles
	ShowAgentSelector      bool
	SelectedAgentIdx       int
	Agents                 []config.Agent
	ShowHistoryTab         bool
	LLM                    string
	Mode                   string
	BranchChange           bool
	Groups                 []config.AgentGroup
	SelectedGroupIdx       int
	ScrollOffset           int // Details scroll offset
	HistoryScrollOffset    int // History scroll offset
	AgentScrollOffset      int // Agent Selector scroll offset
	RecommendationScore    int
	HistorySelectedIdx     int
	ConfirmDeleteMilestone bool
	ConfirmDeleteCycle     bool
}

DetailsModel handles rendering the detail specs and historical log timeline for a milestone.

func NewDetailsModel

func NewDetailsModel(styles Styles) DetailsModel

NewDetailsModel creates a DetailsModel instance.

func (DetailsModel) Init

func (m DetailsModel) Init() tea.Cmd

Init initializes the details sub-model.

func (DetailsModel) Update

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

Update handles screen adjustments and quick actions like toggling status and work logging.

func (DetailsModel) View

func (m DetailsModel) View() string

View structures a responsive split-screen displaying details and chronological cycle history.

type LogCycleResultMsg

type LogCycleResultMsg struct {
	MilestoneID string
	Branch      string
	CommitHash  string
	Timestamp   string
}

LogCycleResultMsg is sent asynchronously when a work cycle is completed and Git info is fetched.

type PreflightModel

type PreflightModel struct {
	Request       StartCycleMsg
	Milestone     config.Milestone
	State         *config.State
	ConfigPath    string
	StatePath     string
	Width         int
	Height        int
	FocusIndex    int
	ScrollOffset  int
	Styles        Styles
	Settings      config.Settings
	Pipeline      []config.Agent
	MissingAgents []string
	Repos         []git.RepoStatusSummary
	Issues        []preflightIssue
}

PreflightModel renders the non-mutating cycle review that must be confirmed before RootModel receives StartCycleMsg for executor startup.

func NewPreflightModel

func NewPreflightModel(styles Styles) PreflightModel

func (PreflightModel) HasBlockers

func (m PreflightModel) HasBlockers() bool

func (PreflightModel) Init

func (m PreflightModel) Init() tea.Cmd

func (*PreflightModel) Load

func (m *PreflightModel) Load(req StartCycleMsg, state *config.State, configPath, statePath string)

func (PreflightModel) Update

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

func (PreflightModel) View

func (m PreflightModel) View() string

type RootModel

type RootModel struct {
	ActiveScreen    Screen
	Dashboard       DashboardModel
	Details         DetailsModel
	Runner          RunnerModel
	CreateMilestone CreateMilestoneModel
	Preflight       PreflightModel
	Settings        SettingsModel
	AgentGroups     AgentGroupsModel
	Setup           SetupWizardModel
	Width           int
	Height          int
	Config          *config.Config
	State           *config.State
	ConfigPath      string
	StatePath       string
	NoBranchChange  bool
	Unrestricted    bool
	MsgChan         chan tea.Msg
	Styles          Styles
	StatusMsg       string
	StatusTime      time.Time
	MissingConfig   bool
	InitConfigError string
}

RootModel is the top-level Bubble Tea model containing application state.

func NewRootModel

func NewRootModel(cfg *config.Config, state *config.State, configPath, statePath string, noBranchChange, unrestricted, disableBold, disableRoundedBorders bool) RootModel

NewRootModel constructs the RootModel and initializes its sub-models.

func (RootModel) Init

func (m RootModel) Init() tea.Cmd

Init initializes the Bubble Tea program.

func (RootModel) ListenForExecutorMessages

func (m RootModel) ListenForExecutorMessages() tea.Cmd

ListenForExecutorMessages returns a tea.Cmd that blocks until an executor event is ready.

func (RootModel) Update

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

Update routes messages to the active sub-model and processes global/async actions.

func (RootModel) View

func (m RootModel) View() string

View constructs the overall user interface layout.

type RunnerModel

type RunnerModel struct {
	Milestone           config.Milestone
	Pipeline            []config.Agent
	AgentStates         map[string]string // agent.ID -> status: "pending", "running", "success", "failed"
	AgentStartedAt      map[string]time.Time
	AgentElapsed        map[string]time.Duration
	Logs                []string
	StatusEvents        []string
	Spinner             spinner.Model
	Width               int
	Height              int
	Styles              Styles
	Ctx                 context.Context
	CancelFunc          context.CancelFunc
	Status              string
	CycleStatus         string
	CycleNumber         int
	ActiveAgentID       string
	ActivePhase         string
	Runner              string
	Model               string
	Mode                string
	OutputFile          string
	LatestCommand       string
	LatestToolCall      string
	ModelCalls          int
	ToolCalls           int
	EstimatedTokens     int
	PromptTokens        int
	CompletionTokens    int
	MaxModelCalls       int
	MaxTokenBudget      int
	StopOrDoneReason    string
	LastError           string
	NextSuggestedAction string
	FinalVerdict        string
	StartedAt           time.Time
	FinishedAt          time.Time
	Error               error
	Finished            bool
	ReportFile          string
	ActiveTab           RunnerTab
}

RunnerModel manages the run status screen.

func NewRunnerModel

func NewRunnerModel(styles Styles) RunnerModel

NewRunnerModel instantiates a new RunnerModel.

func (RunnerModel) Init

func (m RunnerModel) Init() tea.Cmd

Init triggers the spinner animation.

func (RunnerModel) Update

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

Update processes execution messages, windows resize, and key cancellations.

func (RunnerModel) View

func (m RunnerModel) View() string

View draws the spinner, agent status lists, and console log output tail.

type RunnerTab

type RunnerTab int

RunnerTab represents a tab in the runner view when resolution is small.

const (
	RunnerTabLog  RunnerTab = 0
	RunnerTabPlan RunnerTab = 1
)

type Screen

type Screen int

Screen identifies the currently active UI view.

const (
	ScreenDashboard Screen = iota
	ScreenDetails
	ScreenRunner
	ScreenCreateMilestone
	ScreenPreflight
	ScreenSettings
	ScreenAgentGroups
	ScreenSetup
)

type SettingsModel

type SettingsModel struct {
	Scope              string // "global" or "project"
	GlobalDraft        config.Settings
	ProjectDraft       config.Settings
	GlobalOriginal     config.Settings
	ProjectOriginal    config.Settings
	ShowDiscardPrompt  bool
	DiscardQuit        bool
	FocusIndex         int
	ActiveGroup        int
	SelectedGroup      int
	GroupScrollOffset  int
	DetailScrollOffset int
	Width              int
	Height             int
	Styles             Styles
	ErrorMsg           string
	SuccessMsg         string

	CacheTTLInput                   textinput.Model
	MaxHandoffInput                 textinput.Model
	MaxCallsInput                   textinput.Model
	TokenBudgetInput                textinput.Model
	LLMInputInput                   textinput.Model
	MaxRetainedConversationMsgInput textinput.Model

	OllamaCodexModelInput       textinput.Model
	DefaultGitBranchPrefixInput textinput.Model
}

SettingsModel handles editing and saving configurations.

func NewSettingsModel

func NewSettingsModel(styles Styles) SettingsModel

NewSettingsModel instantiates the settings model.

func (SettingsModel) HasUnsavedChanges

func (m SettingsModel) HasUnsavedChanges() bool

func (SettingsModel) Init

func (m SettingsModel) Init() tea.Cmd

func (SettingsModel) IsTextInputFocused

func (m SettingsModel) IsTextInputFocused() bool

func (SettingsModel) Update

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

func (SettingsModel) View

func (m SettingsModel) View() string

type SettingsSavedMsg

type SettingsSavedMsg struct {
	Scope string
}

SettingsSavedMsg is sent when settings are saved successfully.

type SetupCompletedMsg

type SetupCompletedMsg struct {
	ConfigPath  string
	StatePath   string
	MilestoneID string
}

type SetupWizardModel

type SetupWizardModel struct {
	// ConfigPath and StatePath are startup-owned paths displayed as read-only setup details.
	ConfigPath string
	StatePath  string
	// GlobalSettings holds the resolved global settings used to preview the
	// effective value of any field set to "inherit" on the init screen.
	GlobalSettings      config.Settings
	MilestoneIDInput    textinput.Model
	MilestoneTitleInput textinput.Model
	MilestoneGoalInput  textarea.Model
	MilestoneCriteria   textarea.Model
	Runners             []runnerAvailability
	Runner              string
	// RunnerInherit, SafetyInherit, and BranchesInherit mirror the settings
	// screen "inherit" option: when true the corresponding project setting is
	// saved empty/nil so it resolves from the global settings at merge time.
	RunnerInherit   bool
	Unrestricted    bool
	SafetyInherit   bool
	UnrestrictedAck bool
	AutoBranches    bool
	BranchesInherit bool
	CreateFirst     bool
	IsGitWorktree   bool
	FocusIndex      int
	Width           int
	Height          int
	Styles          Styles
	ErrorMsg        string
}

func NewSetupWizardModel

func NewSetupWizardModel(configPath, statePath string, styles Styles) SetupWizardModel

func (SetupWizardModel) Init

func (m SetupWizardModel) Init() tea.Cmd

func (SetupWizardModel) Update

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

func (SetupWizardModel) View

func (m SetupWizardModel) View() string

type ShowDeleteMilestoneMsg

type ShowDeleteMilestoneMsg struct {
	Milestone config.Milestone
}

type StartCycleMsg

type StartCycleMsg struct {
	Milestone      config.Milestone
	SingleAgentID  string
	RunnerLLM      string
	RunnerMode     string
	NoBranchChange bool
	Group          config.AgentGroup
	Note           string
}

StartCycleMsg is sent when triggering a run.

type Styles

type Styles struct {
	NoBold           bool
	AppTitle         lipgloss.Style
	AppSubtitle      lipgloss.Style
	ActiveBorder     lipgloss.Style
	InactiveBorder   lipgloss.Style
	SuccessText      lipgloss.Style
	WarningText      lipgloss.Style
	ErrorText        lipgloss.Style
	AccentText       lipgloss.Style
	SubtleText       lipgloss.Style
	TableHeader      lipgloss.Style
	TableSelectedRow lipgloss.Style
	ListSelectedRow  lipgloss.Style

	// Layout and Card styles
	Box          lipgloss.Style
	Surface      lipgloss.Style
	Hero         lipgloss.Style
	InfoCard     lipgloss.Style
	StatCard     lipgloss.Style
	DetailHeader lipgloss.Style
	DetailLabel  lipgloss.Style
	DetailValue  lipgloss.Style
	SectionTitle lipgloss.Style
	CommandKey   lipgloss.Style
	HelpStyle    lipgloss.Style
	Spinner      lipgloss.Style

	// Custom status tags
	TodoTag       lipgloss.Style
	InProgressTag lipgloss.Style
	DoneTag       lipgloss.Style
	Footer        lipgloss.Style
	FocusedInput  lipgloss.Style
	BlurredInput  lipgloss.Style

	// Glyphs
	GlyphPointer      string
	GlyphBullet       string
	GlyphCheck        string
	GlyphCross        string
	GlyphWarning      string
	GlyphInfo         string
	GlyphSuccess      string
	GlyphDiamond      string
	GlyphBulletSubtle string
}

Styles defines all the lipgloss styles used across the TUI components.

func DefaultStyles

func DefaultStyles(disableBold bool, disableRoundedBorders bool) Styles

DefaultStyles returns a pre-configured set of styles with a modern developer UI palette.

func (Styles) RenderError

func (s Styles) RenderError(msg string) string

RenderError returns error text with standard glyph and consistent formatting

func (Styles) RenderInfo

func (s Styles) RenderInfo(msg string) string

RenderInfo returns info/accent text with standard glyph and consistent formatting

func (Styles) RenderSuccess

func (s Styles) RenderSuccess(msg string) string

RenderSuccess returns success text with standard glyph and consistent formatting

func (Styles) RenderWarning

func (s Styles) RenderWarning(msg string) string

RenderWarning returns warning text with standard glyph and consistent formatting

type UpdateMilestoneMsg

type UpdateMilestoneMsg struct {
	MilestoneID string
	Action      string // e.g., "cycle_logged", "status_changed"
	Status      string // optional
}

UpdateMilestoneMsg is sent to log actions or transitions on milestones.

Jump to

Keyboard shortcuts

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