tui

package
v1.0.51 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmPrompt

func ConfirmPrompt(prompt string) (bool, error)

ConfirmPrompt prompts for a yes/no confirmation

func InputPrompt

func InputPrompt(prompt, placeholder string) (string, error)

InputPrompt prompts for user input

func SelectPrompt

func SelectPrompt(prompt string, options []string) (int, error)

SelectPrompt presents options and prompts for selection

Types

type ConstitutionPrinciple added in v1.0.17

type ConstitutionPrinciple struct {
	Name        string
	Description string
	Selected    bool
}

ConstitutionPrinciple represents a toggleable principle in the TUI.

func DefaultPrinciples added in v1.0.17

func DefaultPrinciples() []ConstitutionPrinciple

DefaultPrinciples returns the default set of constitution principles.

type InitModel added in v1.0.17

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

InitModel is the Bubble Tea model for sl init.

func NewInitModel added in v1.0.17

func NewInitModel(config MissingConfig, projectName string) InitModel

NewInitModel creates an InitModel that presents only the missing configuration steps.

func (InitModel) Init added in v1.0.17

func (m InitModel) Init() tea.Cmd

Init initializes the model.

func (InitModel) Update added in v1.0.17

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

Update handles messages.

func (InitModel) View added in v1.0.17

func (m InitModel) View() string

View renders the TUI.

type InitProgram added in v1.0.17

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

InitProgram wraps the init TUI execution.

func NewInitProgram added in v1.0.17

func NewInitProgram(config MissingConfig, projectName string) *InitProgram

NewInitProgram creates a new sl init TUI program.

func (*InitProgram) Run added in v1.0.17

func (p *InitProgram) Run() (map[string]string, error)

Run runs the init program to completion.

type InitStep added in v1.0.17

type InitStep struct {
	Key      string // "short_code", "playbook", "agent_preference"
	StepType InitStepType
}

InitStep describes a single step in the sl init TUI.

type InitStepType added in v1.0.17

type InitStepType int

InitStepType identifies the kind of input a step requires.

type MissingConfig added in v1.0.17

type MissingConfig struct {
	NeedsShortCode       bool
	NeedsPlaybook        bool
	NeedsAgentPreference bool
	ExistingAgentPref    string // Pre-select this agent if set
}

MissingConfig describes which configuration steps are still needed.

type ModeDetector

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

ModeDetector detects the terminal mode

func NewModeDetector

func NewModeDetector() *ModeDetector

NewModeDetector creates a new mode detector

func (*ModeDetector) IsInteractive

func (d *ModeDetector) IsInteractive() bool

IsInteractive returns true if in interactive mode

func (*ModeDetector) IsNonInteractive

func (d *ModeDetector) IsNonInteractive() bool

IsNonInteractive returns true if in non-interactive mode

func (*ModeDetector) IsPlainCLI

func (d *ModeDetector) IsPlainCLI() bool

IsPlainCLI returns true if in plain CLI mode

type Model

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

TUI model for sl new command

func InitialModel

func InitialModel(defaultDir string) Model

InitialModel creates initial model with default directory

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) Update

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

Update handles messages

func (Model) View

func (m Model) View() string

View renders the TUI

type Program

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

Program wraps Bubble Tea program execution

func NewProgram

func NewProgram(defaultDir string) *Program

NewProgram creates a new interactive Bubble Tea program

func (*Program) Run

func (p *Program) Run() (map[string]string, error)

Run runs the program to completion

type TerminalMode

type TerminalMode int

TerminalMode represents the current terminal mode

const (
	ModeInteractive TerminalMode = iota
	ModeNonInteractive
	ModePlainCLI
)

func DetectMode

func DetectMode() TerminalMode

DetectMode detects the current terminal mode

Jump to

Keyboard shortcuts

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