[terminal-stylist] Terminal Stylist Analysis: Console Output Patterns in gh-aw #36098
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-06-01T09:40:49.035Z.
|
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.
-
Overview
This analysis covers all Go source files in
pkg/(excluding tests) for console output patterns, Lipgloss styling, and Huh form usage. The codebase shows a mature, well-structured approach to terminal output with a dedicatedpkg/consolepackage that centralizes formatting. The overall quality is high, with several specific improvement opportunities identified.Summary Statistics
fmt.Fprintln/Fprintf(total)fmt.Fprintln(os.Stderr, ...)callsconsole.Format*usageslipgloss.*usageshuh.*usagespkg/cli/WithTheme+WithAccessible✅ What's Working Well
Lipgloss — Robust Styling Infrastructure
pkg/styles/theme.godefines every semantic color with both light/dark variants viacompat.AdaptiveColor, automatically adapting to terminal background. Example:ColorError = compat.AdaptiveColor{Light: "#D73737", Dark: "#FF5555"}.applyStyle()inpkg/console/console.goguards all styling behindisTTY(), preventing ANSI escape codes from leaking into pipes/redirects.styles.Error,styles.Success,styles.Warning,styles.Info,styles.FilePathetc. encourage consistent usage.*_wasm.gofiles — clean build-tag separation.console.RenderTableuseslipgloss/tablefor structured data, abstracted behind aTableConfigstruct.console.RenderStructprovides reflection-based rendering withconsole:"header:"andconsole:"title:"tags — a standout feature.Huh — Consistent Interactive Forms
huh.NewFormcalls inpkg/cli/correctly chain.WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()).IsAccessibleMode()checksACCESSIBLE,NO_COLOR, andTERM=dumbenv vars — comprehensive.pkg/console/input.go,list.go, andconfirm.goall checktty.IsStderrTerminal()before launching interactive prompts and fall back gracefully.PromptSecretInputvalidates non-empty input with a proper error message.styles.HuhThemeprovides branded styling, keeping forms visually consistent with the rest of the CLI.1. TTY Stream Inconsistency in
pkg/console/console.goThe module-level
isTTY()helper checks stdout, but all format functions (FormatSuccessMessage,FormatInfoMessage, etc.) are used withos.Stderr. Lines 344–398 calltty.IsStderrTerminal()directly, creating a split:Recommendation: Rename
isTTY()toisStdoutTTY()and introduceisStderrTTY(), or reconsider whetherapplyStyle(used on stderr-bound output) should checktty.IsStderrTerminal()instead.2. Unformatted Messages in User-Facing Code
Several
pkg/cli/files write plain strings directly to stderr instead of using console formatters. These messages lose color, icon prefixes, and consistent styling:Files with unformatted stderr messages (click to expand)
pkg/cli/preconditions.go(lines 26–142) — All precondition guidance messages:pkg/cli/add_interactive_orchestrator.go(lines 233–331) — Post-wizard summary:pkg/cli/add_interactive_git.go(lines 59–189) — merge/secret instructions:pkg/cli/add_interactive_workflow.go(lines 63–139) — status messages during wizard:pkg/cli/fix_command.go(lines 248–249) — hint after fix:3. Direct Lipgloss Usage in
pkg/cli/compile_schedule_calendar.gointensityStyle()createslipgloss.NewStyle()values inline usingstyles.Color*constants, which is fine. However the table rows are manually built with astrings.Builder, and separators/headers are written withfmt.Fprintln(os.Stderr, styles.TableHeader.Render(header)). This bypasses theconsole.RenderTableabstraction.Recommendation: For complex calendar-style output that doesn't map to simple tables, the current approach is acceptable. Consider extracting a
console.FormatCalendarhelper to keep CLI command files free of direct Lipgloss calls.4. Markdown Report to Stdout in
audit_cross_run_render.goLines 29–50 write raw Markdown headings and pipe-separated tables directly to stdout:
This is intentional for machine-readable output, but the hardcoded
# h1heading violates the style guide (which reserves h1 for titles). If this output is meant for human reading in a terminal, consider usingconsole.RenderStructwith struct tags for the table sections, or at minimum downgrade headers to###.📋 Prioritized Recommendations
pkg/console/console.goisTTY()checks stdout while format functions output to stderrpkg/cli/preconditions.gofmt.Fprintln(os.Stderr, ...)strings withconsole.FormatInfoMessage/FormatWarningMessagepkg/cli/add_interactive_orchestrator.goconsole.FormatSectionHeader/FormatWarningMessagepkg/cli/add_interactive_git.goFormatInfoMessagepkg/cli/add_interactive_workflow.goFormatProgressMessagepkg/cli/fix_command.goFormatCommandMessagepkg/cli/audit_cross_run_render.go💡 Charmbracelet Ecosystem Best Practices — Compliance Summary
pkg/styleshave both variantsapplyStyle()guards all Lipgloss callsconsole.Format*Messagefunctions used throughoutWithTheme(styles.HuhTheme)WithAccessible(IsAccessibleMode())IsAccessibleMode()coversACCESSIBLE,NO_COLOR,TERM=dumbShowInteractiveListfalls back to numbered text listisTTY()checks stdout; stderr-bound styles check stderr directlypkg/cli/files bypass formatters for user-facing stringsReferences:
Beta Was this translation helpful? Give feedback.
All reactions