tui

package
v0.0.0-...-a981527 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DarkTheme = TermTheme{
	Name:         "dark",
	Accent:       lipgloss.Color("#f97316"),
	AccentDim:    lipgloss.Color("#c2410c"),
	Success:      lipgloss.Color("#22c55e"),
	Warning:      lipgloss.Color("#eab308"),
	Error:        lipgloss.Color("#ef4444"),
	Primary:      lipgloss.Color("#e0e0e8"),
	Secondary:    lipgloss.Color("#888888"),
	Dim:          lipgloss.Color("#5a5a70"),
	Surface:      lipgloss.Color("#1a1a24"),
	Border:       lipgloss.Color("#2a2a3a"),
	ActiveBorder: lipgloss.Color("#f97316"),
	ActiveBg:     lipgloss.Color("#1c1408"),
}

DarkTheme is the default dark terminal theme.

View Source
var LightTheme = TermTheme{
	Name:         "light",
	Accent:       lipgloss.Color("#c2410c"),
	AccentDim:    lipgloss.Color("#7c2d12"),
	Success:      lipgloss.Color("#15803d"),
	Warning:      lipgloss.Color("#a16207"),
	Error:        lipgloss.Color("#b91c1c"),
	Primary:      lipgloss.Color("#0f172a"),
	Secondary:    lipgloss.Color("#374151"),
	Dim:          lipgloss.Color("#4b5563"),
	Surface:      lipgloss.Color("#ffffff"),
	Border:       lipgloss.Color("#d1d5db"),
	ActiveBorder: lipgloss.Color("#c2410c"),
	ActiveBg:     lipgloss.Color("#fff7ed"),
}

LightTheme is the light terminal theme.

Functions

func RenderBanner

func RenderBanner(styles *StyleSet, version string, width int) string

RenderBanner returns the branded header for the wizard.

func RenderProgress

func RenderProgress(steps []Step, current int, styles *StyleSet, width int) string

RenderProgress renders the step progress sidebar showing completed and active steps.

Types

type FallbackProvider

type FallbackProvider struct {
	Provider string
	APIKey   string
}

FallbackProvider holds a fallback provider selection from the wizard.

type FileTickMsg

type FileTickMsg struct{}

FileTickMsg triggers the next file generation display.

type GenerationDoneMsg

type GenerationDoneMsg struct {
	Err error
}

GenerationDoneMsg signals that all file generation is complete.

type GenerationProgressMsg

type GenerationProgressMsg struct {
	File   string
	Status string // "writing", "done", "error"
}

GenerationProgressMsg reports file generation progress.

type Step

type Step interface {
	// Title returns the step's display title.
	Title() string
	// Icon returns the step's icon/emoji.
	Icon() string
	// Init returns the initial command for this step.
	Init() tea.Cmd
	// Update handles messages and returns the updated step and command.
	Update(msg tea.Msg) (Step, tea.Cmd)
	// View renders the step content.
	View(width int) string
	// Complete returns true when the step has finished.
	Complete() bool
	// Summary returns a one-line summary for the collapsed view.
	Summary() string
	// Apply writes collected data to the wizard context.
	Apply(ctx *WizardContext)
}

Step is the interface that all wizard steps must implement.

type StepBackMsg

type StepBackMsg struct{}

StepBackMsg is emitted by a step when the user presses backspace at the first sub-phase.

type StepCompleteMsg

type StepCompleteMsg struct{}

StepCompleteMsg is emitted by a step when it finishes.

type StyleSet

type StyleSet struct {
	Theme TermTheme

	// Text styles
	Title        lipgloss.Style
	Subtitle     lipgloss.Style
	AccentTxt    lipgloss.Style
	DimTxt       lipgloss.Style
	SuccessTxt   lipgloss.Style
	WarningTxt   lipgloss.Style
	ErrorTxt     lipgloss.Style
	PrimaryTxt   lipgloss.Style
	SecondaryTxt lipgloss.Style

	// Border styles
	ActiveBorder   lipgloss.Style
	InactiveBorder lipgloss.Style

	// Item styles
	SelectedItem   lipgloss.Style
	UnselectedItem lipgloss.Style
	Cursor         lipgloss.Style

	// Kbd hint
	KbdKey  lipgloss.Style
	KbdDesc lipgloss.Style

	// Banner
	Banner lipgloss.Style

	// Summary
	SummaryKey   lipgloss.Style
	SummaryValue lipgloss.Style

	// Bordered box
	BorderedBox lipgloss.Style

	// Badge styles (filled background with contrasting text)
	StepBadgeComplete lipgloss.Style
	StepBadgeActive   lipgloss.Style
	StepBadgePending  lipgloss.Style

	// Version pill
	VersionPill lipgloss.Style
}

StyleSet contains pre-computed lipgloss styles derived from a theme.

func NewStyleSet

func NewStyleSet(theme TermTheme) *StyleSet

NewStyleSet creates a StyleSet from a theme.

type TermTheme

type TermTheme struct {
	Name string

	// Brand
	Accent    lipgloss.Color
	AccentDim lipgloss.Color

	// Semantic
	Success lipgloss.Color
	Warning lipgloss.Color
	Error   lipgloss.Color

	// Text
	Primary   lipgloss.Color
	Secondary lipgloss.Color
	Dim       lipgloss.Color

	// Surfaces
	Surface      lipgloss.Color
	Border       lipgloss.Color
	ActiveBorder lipgloss.Color
	ActiveBg     lipgloss.Color
}

TermTheme holds all color values for a TUI theme.

func DetectTheme

func DetectTheme(flagVal string) TermTheme

DetectTheme returns the appropriate theme based on flag, env, or detection.

type ValidationResultMsg

type ValidationResultMsg struct {
	Err error
}

ValidationResultMsg carries the result of an async validation.

type WizardContext

type WizardContext struct {
	Name           string
	Provider       string
	APIKey         string
	AuthMethod     string // "apikey" or "oauth" — how the user authenticated
	ModelName      string // selected model ID (e.g. "gpt-5.4")
	OrganizationID string // OpenAI enterprise organization ID
	AWSRegion      string // AWS region for provider "bedrock" (model.aws_region, #205)
	Fallbacks      []FallbackProvider
	Channel        string
	ChannelTokens  map[string]string
	BuiltinTools   []string
	Skills         []string
	EgressDomains  []string
	CustomBaseURL  string
	CustomModel    string
	CustomAPIKey   string
	// CustomShape selects which wire format the custom-URL endpoint
	// speaks — "openai" (default; OpenAI Chat Completions, used by
	// litellm / vLLM / OpenRouter / self-hosted Llama proxies) or
	// "anthropic" (Anthropic Messages format, used by Bedrock's
	// Anthropic passthrough and by Anthropic-compatible proxies).
	// Drives whether normalizeCustomProvider sets ModelProvider to
	// "openai" or "anthropic" and which BASE_URL / API_KEY env names
	// are emitted to .env. See issue #202 Phase 1.
	CustomShape string
	EnvVars     map[string]string

	// Compression enables reversible context compression (ctxzip): bulky
	// tool outputs are compressed before reaching the LLM and stay
	// retrievable via the context_expand tool. Written to forge.yaml as
	// compression.enabled.
	Compression bool

	// AuthMode is the user's selection from the auth step:
	//   ""             — wizard step did not run
	//   "none"         — anonymous access (no auth: block written)
	//   "oidc"         — OIDC provider
	//   "http_verifier" — legacy external verifier
	//   "custom"       — write a commented stub; user edits manually
	AuthMode string

	// AuthSettings is the type-specific settings block for the chosen
	// provider, ready to plug into `auth.providers[0].settings` in
	// forge.yaml. Keys: "issuer", "audience", "url", "default_org",
	// "claim_map" (a nested map), etc.
	AuthSettings map[string]any

	// AuthEgressHosts is the list of bare hosts (no port) that should be
	// auto-added to the egress allowlist because the auth step requires
	// them — e.g. an OIDC issuer or http_verifier URL. The init scaffold
	// merges these into the rendered forge.yaml egress.allowed_domains.
	AuthEgressHosts []string
}

WizardContext accumulates all data across wizard steps.

func NewWizardContext

func NewWizardContext() *WizardContext

NewWizardContext creates an initialized WizardContext.

type WizardModel

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

WizardModel is the top-level bubbletea model that orchestrates the wizard.

func NewWizardModel

func NewWizardModel(theme TermTheme, steps []Step, version string) WizardModel

NewWizardModel creates a new wizard with the given steps.

func (WizardModel) Context

func (w WizardModel) Context() *WizardContext

Context returns the accumulated wizard context.

func (WizardModel) Done

func (w WizardModel) Done() bool

Done returns true if the wizard completed successfully.

func (WizardModel) Err

func (w WizardModel) Err() error

Err returns any error that occurred during the wizard.

func (WizardModel) Init

func (w WizardModel) Init() tea.Cmd

Init initializes the first step.

func (WizardModel) Update

func (w WizardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the wizard.

func (WizardModel) View

func (w WizardModel) View() string

View renders the entire wizard UI.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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