Documentation
¶
Overview ¶
Package ui provides the Bubble Tea TUI layer for solo-provisioner. It replaces the default zerolog console output with a structured, human-friendly display of workflow step progress using spinners, status icons, and a summary table.
Global flags (set from root command):
VerboseLevel – controls output detail: 0=compact, 1=verbose. NonInteractive – disables TUI, outputs raw zerolog for CI/pipelines.
Index ¶
- Variables
- func CaptureOutput() (origStdout *os.File, cleanup func())
- func IsUnformatted() bool
- func NewTUIHandler(program *tea.Program) *notify.Handler
- func RenderSummaryTable(report *automa.Report, totalDuration time.Duration, reportPath string, ...) string
- func RenderVersionHeader() string
- func SuppressConsoleLogging(cfg logx.LoggingConfig, program ...*tea.Program)
- type Model
- type PhaseDoneMsg
- type PhaseFailedMsg
- type PhaseStartedMsg
- type StepDetailMsg
- type StepDoneMsg
- type StepFailedMsg
- type StepStartedMsg
- type WorkflowDoneMsg
Constants ¶
This section is empty.
Variables ¶
var NonInteractive bool
NonInteractive disables the TUI and outputs raw zerolog lines. Set by --non-interactive. Intended for CI pipelines and machine-readable output.
var VerboseLevel int
VerboseLevel controls output verbosity. Set by the -V flag.
0 (default) — collapsed phases with progress bar + current step name 1 (-V) — all steps (start + completion) + transient detail + version info
Functions ¶
func CaptureOutput ¶
CaptureOutput redirects file descriptors 1 (stdout) and 2 (stderr) to discard pipes at the OS level using dup2. This catches ALL output — even from third-party C/Go libraries that captured the fd at init time or write directly to fd 1/2 (e.g. Helm OCI "Pulled:", syspkg "apt manager").
Returns an *os.File backed by the original stdout fd (for the output handler to write to) and a cleanup function that restores both fds.
func IsUnformatted ¶
func IsUnformatted() bool
IsUnformatted returns true when the TUI should be bypassed and zerolog writes directly to the console. This is the case when --non-interactive is set OR when stdout is not a terminal (CI, pipes, redirected output).
func NewTUIHandler ¶
NewTUIHandler creates a notify.Handler that sends messages to the given tea.Program. At VerboseLevel >= 1, completed steps, phases, and detail lines are printed permanently above the TUI via program.Println (which guarantees ordering). The model is then updated via program.Send so View() can skip already-printed content.
func RenderSummaryTable ¶
func RenderSummaryTable(report *automa.Report, totalDuration time.Duration, reportPath string, logPath string) string
RenderSummaryTable produces a compact summary for use after the TUI quits or in line handler mode. reportPath and logPath are included if non-empty.
func RenderVersionHeader ¶
func RenderVersionHeader() string
RenderVersionHeader returns a styled version block for display when VerboseLevel >= 1. Returns an empty string when verbosity is too low.
func SuppressConsoleLogging ¶
func SuppressConsoleLogging(cfg logx.LoggingConfig, program ...*tea.Program)
SuppressConsoleLogging replaces the global logx logger with a file-only writer (no ConsoleWriter) so that raw zerolog lines do not appear on stdout.
When program is non-nil a tuiLogHook is attached so that log messages are forwarded to the TUI as transient "thinking" detail text. When program is nil (called before the program exists) only the console suppression is applied.
This works around the upstream logx.Initialize() unconditionally creating a ConsoleWriter regardless of the ConsoleLogging config field.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubble Tea model for the TUI display.
func NewModel ¶
func NewModel() Model
NewModel creates a new TUI model ready for use with tea.NewProgram.
type PhaseDoneMsg ¶
PhaseDoneMsg is sent when a major workflow phase completes.
type PhaseFailedMsg ¶
PhaseFailedMsg is sent when a major workflow phase fails.
type PhaseStartedMsg ¶
PhaseStartedMsg is sent when a major workflow phase begins. The TUI renders this as a section header with subsequent steps indented below.
type StepDetailMsg ¶
type StepDetailMsg struct {
Detail string
}
StepDetailMsg is a transient sub-status update shown as greyed-out text under the currently running step. Used by child steps to indicate progress without creating a new top-level entry in the TUI.
type StepDoneMsg ¶
StepDoneMsg is sent when a workflow step completes successfully or is skipped.
type StepFailedMsg ¶
StepFailedMsg is sent when a workflow step fails.
type StepStartedMsg ¶
StepStartedMsg is sent when a workflow step begins execution.
type WorkflowDoneMsg ¶
WorkflowDoneMsg is sent when the entire workflow finishes execution.