[terminal-stylist] Console Output Audit: Patterns & Recommendations #29302
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-05-01T12:11:00.190Z.
|
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 console output patterns across
pkg/Go source files (excluding test files), covering Lipgloss styling, Huh forms, TTY detection, and adherence to style guidelines.Summary
console.Format*/Render*correctlyfmt.Fprintf/Fprintln(os.Stderr)fmt.Println/Printfto stdoutThe codebase has a strong foundation: well-designed
pkg/consoleandpkg/stylespackages, consistent Huh theming, and proper TTY detection. The main gap is a significant number of rawfmt.Fprintf(os.Stderr, ...)calls bypassing the console formatting layer.✅ Strengths
Lipgloss — Excellent Architecture
pkg/styles/theme.gois a model implementation:compat.AdaptiveColor— all colors automatically adjust for light/dark terminal backgroundsRoundedBorder,NormalBorder,ThickBorder)Error,Warning,Success,Info,FilePath,Command,Progress,TableHeader, etc.pkg/console/console.gowraps all Lipgloss usage behind TTY-aware helpers:RenderTableuseslipgloss/tablewith zebra-striping, header/total row differentiation, and graceful TTY-off degradation.RenderComposedSections,RenderTitleBox,RenderErrorBox, andRenderInfoSectionall provide consistent layout primitives with TTY detection.Huh Forms — Consistent and Accessible
All 10 Huh form usages follow best practices:
HuhThemeinpkg/styles/huh_theme.gocorrectly maps the Dracula palette to every field state (focused, blurred, selected, error)WithAccessible(console.IsAccessibleMode())is applied universally — screen reader support is not an afterthoughtEchoMode(huh.EchoModePassword)pkg/console/confirm.go,list.go, andinput.goprovide convenient wrappers for common form patternsStructured Output Routing
Structured data correctly goes to stdout:
fmt.Println(string(jsonBytes))✅audit_cross_run_render.go):fmt.Printf("| ... |")✅fmt.Println(hash)✅1. Raw
fmt.Fprintf(os.Stderr)without console formatting~139 files write to stderr bypassing the console formatting package. Messages lose color, icons (✓ ✗ ⚠ i), and styling context. Examples:
Fix pattern:
Priority files (most impactful):
pkg/cli/enable.go— ~15 raw stderr calls for workflow enable/disable statuspkg/cli/deps_security.go— ~8 raw stderr calls for vulnerability advisoriespkg/cli/deps_outdated.go— raw blank-line spacing to stderrpkg/cli/audit.go— file path listings withoutFormatLocationMessagepkg/cli/compile_file_operations.go— watch mode messages2. Missing
FormatLocationMessagewrapperpkg/styles/theme.godefines aLocationstyle (bold orange) butpkg/console/console.godoesn't expose aFormatLocationMessagehelper. File path listings inaudit.gouse rawfmt.Fprintf:3. Blank-line spacing via raw
fmt.Fprintln(os.Stderr, "")deps_outdated.go,deps_security.go, andupdate_container_pins.gousefmt.Fprintln(os.Stderr, "")for vertical spacing rather than a spacing utility. This is minor but adds inconsistency.Recommendations
Recommendation 1: Sweep raw stderr calls in high-traffic commands
Prioritize
enable.goanddeps_security.gofor a formatting pass. Each call should map to the most semantically appropriate helper:FormatSuccessMessageFormatInfoMessageFormatInfoMessage+FormatListItemFormatLocationMessage(to be added)FormatProgressMessageFormatErrorMessageRecommendation 2: Add FormatLocationMessage to pkg/console
The
Locationstyle exists inpkg/stylesbut has no correspondingFormatLocationMessageinpkg/console/console.go. Add:This would clean up file-path listing patterns in
audit.goand similar commands.Recommendation 3: Consider a spacing helper for vertical whitespace
Replace scattered
fmt.Fprintln(os.Stderr, "")with a simple helper:This is low-priority but would make spacing intent explicit.
Recommendation 4: Evaluate Huh forms for remaining interactive prompts
run_interactive.goand someadd_wizard_command.gopaths may still usebufio.Scanneror raw terminal reads. Given the existing Huh infrastructure andHuhTheme, these could be upgraded to proper form fields for consistent styling and accessibility.Overall Assessment
The console output architecture is well-designed and modern. The
pkg/styles+pkg/console+pkg/ttylayered approach correctly separates concerns. Lipgloss adaptive colors are properly implemented for both light and dark terminals. Huh form integration is exemplary — themed, accessible, and consistently applied.The primary gap is adoption coverage: ~139 files still bypass the console layer for stderr writes. A targeted sweep of the highest-traffic commands (
enable.go,deps_security.go,compile_file_operations.go) would meaningfully improve output consistency.References:
Beta Was this translation helpful? Give feedback.
All reactions