[terminal-stylist] Terminal Stylist Audit: Console Output Patterns Analysis #29103
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #29302. |
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 audit covers all 729 non-test Go source files in
pkg/, analyzing console output consistency, Lipgloss styling patterns, and Huh form usage.Executive Summary
The codebase has a well-architected terminal output system (
pkg/console+pkg/styles) that the majority of CLI commands use correctly. The Lipgloss and Huh integrations follow ecosystem best practices. A small number of files bypass the console formatters and write unformatted strings toos.Stderr— these represent the primary improvement opportunity.console.Format*err.Error()to stderr (anti-pattern)✅ Strengths
Lipgloss — Well-Integrated
pkg/styles/theme.goandpkg/console/console.goform a strong foundation:compat.AdaptiveColor— every color hasLight/Darkhex variants that auto-select based on terminal background. The dark palette is Dracula-inspired; light palette is high-contrast for readability.applyStyle()returns plain text whenstdoutis not a TTY, preventing ANSI escape codes in pipes/redirects.Error,Warning,Success,Info,FilePath,Command,Progress, etc.) are defined once inpkg/styles/theme.go.RenderTable()useslipgloss/tablewith zebra striping,RoundedBorder, and TTY-conditional styling.RenderComposedSections()useslipgloss.JoinVerticalin TTY mode, plain line output otherwise.RoundedBorder,NormalBorder, andThickBorderare centrally defined with documented use cases.Huh Forms — Consistent UX
pkg/styles/huh_theme.gomaps the same color palette to Huh field styles, giving interactive forms the same visual identity as static output. Notable patterns found across 9 form files:HuhThemeapplied universally — focused/blurred/error states all use the established paletteSpinnerWrappercorrectly setstea.WithInput(nil)to avoid consuming stdin before subsequent Huh formsACCESSIBLEenvironment variable (disables spinner animation)Spinner — Production-Ready
pkg/console/spinner.gofollows idiomatic Bubble Tea patterns:sync.Mutex+sync.WaitGroupMiniDotstyle withstyles.InfocolorStopWithMessageprints the final message to stderr even when spinner is disabled1. Bare
fmt.Fprintln(os.Stderr, ...)Without Console Formatting~648 call sites across the CLI write plain strings to
os.Stderrwithout usingconsole.Format*helpers. This produces uncolored, unstyled output inconsistent with the surrounding UI.Key files with this pattern:
pkg/cli/enable.gopkg/cli/engine_secrets.gopkg/cli/deps_security.gopkg/cli/deps_outdated.gopkg/cli/copilot_setup.gopkg/cli/add_interactive_git.gopkg/cli/compile_file_operations.gopkg/cli/update_container_pins.goExamples of bare stderr anti-patterns
2. Raw
err.Error()toos.StderrInstead ofFormatErrorMessage9 files pass raw
err.Error()strings to stderr withoutconsole.FormatErrorMessage()orconsole.FormatErrorChain():3.
audit_cross_run_render.go— Markdown Tables to Stdoutpkg/cli/audit_cross_run_render.gowrites raw Markdown table syntax to stdout viafmt.Printf. This is intentional structured output (designed to be piped/redirected), but lacks a comment explaining the design intent. Adding a comment would prevent future reviewers from treating these as styling regressions.Recommendations
Priority 1 — High impact, low effort:
console.FormatInfoMessage/console.FormatProgressMessageto plain informationalfmt.Fprintln(os.Stderr, ...)calls inenable.go,compile_file_operations.go, andadd_interactive_git.gofmt.Fprintln(os.Stderr, err.Error())withconsole.FormatErrorMessage(err.Error())in the 9 affected filesPriority 2 — Medium impact:
engine_secrets.goandcopilot_setup.gousingconsole.RenderInfoSection()for the multi-line instructional content — this would add the left-border emphasis style that's already availablePriority 3 — Documentation:
audit_cross_run_render.go(and similar render files) noting thatfmt.Printfis intentional for structured stdout outputNo action needed on:
domains_command.go,status_command.go,trial_helpers.go,hash_command.go) —fmt.Println(jsonBytes)to stdout is correct per the codebase style guideReferences:
Beta Was this translation helpful? Give feedback.
All reactions