[terminal-stylist] Console Output Analysis: Patterns, Consistency & Recommendations #38079
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-06-10T10:00:43.298Z.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This report analyzes all Go source files in
pkg/for console output patterns, Lipgloss styling usage, and Huh form implementations.Summary
pkg/console.*formatter functions — broad, consistent adoptionWithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())Key Metrics
console.FormatInfoMessageconsole.FormatWarningMessageconsole.FormatSuccessMessageconsole.FormatErrorMessageconsole.FormatVerboseMessageconsole.FormatCommandMessageconsole.RenderTableconsole.RenderStructArchitecture
The codebase has a well-designed, layered console output architecture:
pkg/styles/— Centralized Dracula-inspired adaptive color palette (11 semantic colors, light/dark variants), pre-built Lipgloss style variables, and a customHuhThemethat maps the same palette to Huh forms.pkg/console/— Formatting layer wrapping Lipgloss and Huh. Every rendering function is gated throughapplyStyle()which checksisTTY()before emitting ANSI sequences.pkg/cli/— Consumer layer usingconsole.*functions almost exclusively for user-facing output.Lipgloss Usage Analysis
Files Using Lipgloss Directly
pkg/console/console.goapplyStyle()pkg/console/banner.goapplyStyle()pkg/console/spinner.gotty.IsStderrTerminal()pkg/styles/theme.gopkg/styles/huh_theme.gopkg/logger/logger.gopkg/cli/compile_schedule_calendar.goisTerminalgatepkg/cli/status_command.gopkg/cli/mcp_inspect.gopkg/cli/gateway_logs_timeline_render.goLipgloss Best Practices — Compliance
✅ Adaptive colors —
pkg/styles/theme.gousescompat.AdaptiveColorfor all 11 semantic colors, with explicit light/dark hex values and a Dracula-inspired dark palette.✅ TTY detection —
applyStyle()inconsole.gois the single TTY gate for all styled output.pkg/styles/theme.gousesinit()to detect dark background and color profile at startup, with a Windows-safe guard.✅ Consistent border styles —
RoundedBorder,NormalBorder,ThickBordercentralized inpkg/styles/.✅ Table rendering —
console.RenderTable()useslipgloss/tablewith per-cell styling, alternating rows, header/total row differentiation.✅ Progressive layout —
RenderTitleBox,RenderErrorBox,RenderInfoSection,RenderComposedSectionsprovide compose-and-render patterns with TTY/non-TTY fallbacks.compile_schedule_calendar.goapplies Lipgloss directly (not throughconsole.*) with a localisTerminalvariable. The pattern is correct and TTY-gated, but diverges from the package-levelapplyStyle()helper. Low impact.compile_stats.go:301-302callsstyles.Error.Render()directly for two fields, while the surrounding code usesconsole.FormatErrorMessage(). Functionally equivalent but inconsistent.Huh Form Usage Analysis
Files Using Huh Directly
pkg/console/confirm.gohuh.NewConfirmpkg/console/input.gohuh.NewInput(password)pkg/console/list.gohuh.NewSelectpkg/cli/add_interactive_engine.gohuh.NewSelectpkg/cli/add_interactive_auth.gohuh.NewSelect,huh.NewInputpkg/cli/add_interactive_git.gohuh.NewSelectpkg/cli/add_interactive_orchestrator.gohuh.NewSelectpkg/cli/add_interactive_schedule.gohuh.NewSelect,huh.NewInputpkg/cli/add_interactive_workflow.gohuh.NewInputpkg/cli/interactive.gopkg/cli/run_interactive.gohuh.NewSelect,huh.NewConfirmpkg/cli/engine_secrets.gohuh.NewInputpkg/styles/huh_theme.goHuh Best Practices — Compliance
✅ Consistent theming — All 16 Huh
NewForm()calls apply.WithTheme(styles.HuhTheme). TheHuhThemefunction maps the full Dracula palette to focused/blurred/group states.✅ Accessibility mode — All forms apply
.WithAccessible(console.IsAccessibleMode()). TheIsAccessibleMode()function checksACCESSIBLE,TERM=dumb, andNO_COLOR.✅ Non-TTY fallbacks —
confirm.goandlist.godetect!tty.IsStderrTerminal()and fall back to plain numbered text prompts, preventing crashes in CI/piped environments.✅ Password masking —
input.gouseshuh.EchoModePasswordwith non-empty validation.✅ Context propagation —
add_interactive_engine.gouses.RunWithContext(c.Ctx)for cancellable forms.✅ Validation — Password input has explicit non-empty validation; select fields use
huh.Optiontyped values.Inconsistencies Found
1. Unstyled Warning Message —
pkg/workflow/push_to_pull_request_branch.go:117This is the only raw
Warning:string emitted to stderr without usingconsole.FormatWarningMessage().2. Bare Bullet Points Without Styling —
pkg/cli/fix_command.go:333,338The parent line uses
console.FormatSuccessMessage/FormatWarningMessagebut the codemod name sub-items use rawfmt.Fprintf.3. Redundant Warning Symbol —
pkg/cli/fix_command.go:336FormatWarningMessagealready prepends⚠— the extra symbol creates duplication.4. Unstyled Failure Detail —
pkg/cli/update_display.go:275.
status_command.go:276Writes to StdoutAll other
RenderStructcalls usefmt.Fprint(os.Stderr, ...). Thestatuscommand explicitly writes the structured output to stdout, which is correct for machine-readable output — but warrants a comment to clarify the intentional stdout vs stderr choice.Recommendations
Priority: Low — The codebase already has a mature, consistent console output system. The following are small polish items:
Fix the unstyled warning in
push_to_pull_request_branch.go:117to useconsole.FormatWarningMessage()— this is the only rawWarning:string bypassing the console formatter.Remove redundant
⚠fromfix_command.go:336—FormatWarningMessage("⚠ "+fileName)produces a double warning symbol in TTY.Extend
FormatListItemto sub-items infix_command.go:333,338andupdate_display.go:27for visual consistency with the rest of the formatted output.Document the stdout intent in
status_command.go:276— a brief comment explaining whyfmt.Print(stdout) is used instead offmt.Fprint(os.Stderr, ...)would prevent future confusion.References: §27198166974
Beta Was this translation helpful? Give feedback.
All reactions