Documentation
¶
Index ¶
- Constants
- Variables
- func Banner(version string) string
- func Blank()
- func BrandIcon() string
- func Code(text string)
- func ConfirmAction(prompt string, defaultYes bool) bool
- func Error(msg string)
- func ErrorIcon() string
- func Header(title string)
- func Indent(s string) string
- func IndentBy(s string, n int) string
- func InfoIcon() string
- func Line(text string)
- func MaskValue(v string) string
- func NoColor() bool
- func PrintTable(titles []string, rows [][]string)
- func PromptAcceptAll() bool
- func RenderDiff(diff *envfile.DiffResult) string
- func RenderDiffSummary(diff *envfile.DiffResult) string
- func RenderError(e StructuredError)
- func SetNoColor(enabled bool)
- func SetQuiet(enabled bool)
- func Status(msg string)
- func Success(msg string)
- func SuccessIcon() string
- func TerminalWidth() int
- func Warning(msg string)
- func WarningIcon() string
- func WithSpinner(message string, fn func() error) error
- type Column
- type ConflictItem
- type ErrorCategory
- type MergeChoice
- type MergeDecision
- type MergeTUIResult
- type Spinner
- type StructuredError
- type Table
Constants ¶
const ( IconSuccess = "✓" IconError = "✗" IconWarning = "⚠" IconInfo = "▸" IconBrand = "✦" IconArrow = "→" IconDot = "·" )
Icon constants
Variables ¶
var ( ColorBrand = lipgloss.Color("#7C3AED") // Purple ColorSuccess = lipgloss.Color("#10B981") // Green ColorWarning = lipgloss.Color("#F59E0B") // Amber ColorError = lipgloss.Color("#EF4444") // Red ColorMuted = lipgloss.Color("#6B7280") // Gray ColorInfo = lipgloss.Color("#3B82F6") // Blue ColorWhite = lipgloss.Color("#F9FAFB") // Off-white ColorDim = lipgloss.Color("#4B5563") // Dark gray )
Brand colors
var ( StyleTitle = lipgloss.NewStyle(). Foreground(ColorBrand). Bold(true) StyleSubtitle = lipgloss.NewStyle(). Foreground(ColorWhite). Bold(true) StyleBody = lipgloss.NewStyle(). Foreground(ColorWhite) StyleCode = lipgloss.NewStyle(). Foreground(ColorInfo) StyleDim = lipgloss.NewStyle(). Foreground(ColorMuted) StyleBold = lipgloss.NewStyle(). Foreground(ColorWhite). Bold(true) StyleSuccess = lipgloss.NewStyle(). Foreground(ColorSuccess) StyleWarning = lipgloss.NewStyle(). Foreground(ColorWarning) StyleError = lipgloss.NewStyle(). Foreground(ColorError) StyleBrand = lipgloss.NewStyle(). Foreground(ColorBrand). Bold(true) )
Text styles
var ( BoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorMuted). Padding(0, 1) ErrorBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorError). Padding(0, 1) SuccessBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorSuccess). Padding(0, 1) )
Box styles
Functions ¶
func ConfirmAction ¶
ConfirmAction asks the user for a yes/no confirmation using bubbletea.
func PrintTable ¶
PrintTable is a convenience function.
func PromptAcceptAll ¶
func PromptAcceptAll() bool
PromptAcceptAll asks if the user wants to accept all remaining changes.
func RenderDiff ¶
func RenderDiff(diff *envfile.DiffResult) string
RenderDiff displays a color-coded diff between two env files.
func RenderDiffSummary ¶
func RenderDiffSummary(diff *envfile.DiffResult) string
RenderDiffSummary returns a one-line summary of changes.
func RenderError ¶
func RenderError(e StructuredError)
RenderError displays a structured error with full context.
func SetNoColor ¶
func SetNoColor(enabled bool)
SetNoColor configures process-wide no-color behavior for lipgloss rendering.
func SetQuiet ¶
func SetQuiet(enabled bool)
SetQuiet configures whether non-error UI output should be suppressed.
func SuccessIcon ¶
func SuccessIcon() string
func TerminalWidth ¶
func TerminalWidth() int
TerminalWidth returns the current terminal width, defaulting to 80.
func WarningIcon ¶
func WarningIcon() string
func WithSpinner ¶
WithSpinner runs a function with an animated spinner.
Types ¶
type ConflictItem ¶
type ConflictItem struct {
Key string
BaseValue string
OurValue string
TheirValue string
Resolved bool
Decision MergeChoice
EditValue string
}
ConflictItem represents a single merge conflict for the TUI.
type ErrorCategory ¶
type ErrorCategory string
ErrorCategory classifies an error for UX purposes.
const ( ErrNetwork ErrorCategory = "network" ErrAuth ErrorCategory = "auth" ErrConfig ErrorCategory = "config" ErrFile ErrorCategory = "file" ErrCrypto ErrorCategory = "crypto" ErrRelay ErrorCategory = "relay" ErrSync ErrorCategory = "sync" )
type MergeChoice ¶
type MergeChoice int
MergeChoice represents the user's decision for a single variable.
const ( MergeAccept MergeChoice = iota MergeReject MergeEdit MergeSkip )
type MergeDecision ¶
type MergeDecision struct {
Key string
Choice MergeChoice
EditValue string
}
MergeDecision is the result of a per-variable merge prompt.
func PromptMerge ¶
func PromptMerge(key, oldValue, newValue string) MergeDecision
PromptMerge displays a per-variable merge prompt with bubbletea navigation.
type MergeTUIResult ¶
type MergeTUIResult struct {
Conflicts []ConflictItem
Aborted bool
}
MergeTUIResult is the output of the interactive merge TUI.
func RunMergeTUI ¶
func RunMergeTUI(conflicts []ConflictItem) MergeTUIResult
RunMergeTUI launches the full-screen interactive merge conflict resolver.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner displays an animated bubbletea spinner.
func NewSpinner ¶
NewSpinner creates a new bubbletea-powered spinner.
func (*Spinner) StopSuccess ¶
StopSuccess shows a success message.
func (*Spinner) StopWithMessage ¶
StopWithMessage halts the spinner and shows a message.
func (*Spinner) UpdateMessage ¶
UpdateMessage changes the displayed message.
type StructuredError ¶
type StructuredError struct {
Category ErrorCategory
Message string
Cause string
Suggestion string
DocsURL string
}
StructuredError is a user-facing error with context.
func ErrEnvFileNotFound ¶
func ErrEnvFileNotFound(path string) StructuredError
ErrEnvFileNotFound returns a structured error for missing .env file.
func ErrFingerprintMismatch ¶
func ErrFingerprintMismatch(expected, got string) StructuredError
ErrFingerprintMismatch returns a structured error for key mismatch.
func ErrNoPeers ¶
func ErrNoPeers() StructuredError
ErrNoPeers returns a structured error when no peers are found.
func ErrNoSSHKey ¶
func ErrNoSSHKey(path string) StructuredError
ErrNoSSHKey returns a structured error for missing SSH key.
func ErrNotInitialized ¶
func ErrNotInitialized() StructuredError
ErrNotInitialized returns a structured error for uninitialized project.
func ErrRelayUnavailable ¶
func ErrRelayUnavailable(cause string) StructuredError
ErrRelayUnavailable returns a structured error for relay failure.