Terminal Stylist: Console Output Analysis for gh-aw #21292
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #21455. |
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 582 Go source files in
pkg/, evaluating consistency, Lipgloss styling, and Huh form implementations.Summary
console.Format*callsfmt.Fprintf(os.Stderr, …)without console formattingWithAccessible(…)pkg/console/pkg/stylesOverall Health: ✅ Excellent. The codebase has a well-designed, centralized console formatting layer. The Charmbracelet ecosystem is used consistently and correctly in the vast majority of files.
Lipgloss Patterns
✅ Strengths
lipgloss.*calls outsidepkg/console/andpkg/styles/. All color and layout primitives flow through one controlled layer.pkg/styles/theme.gouseslipgloss.AdaptiveColorfor every semantic color (Error, Warning, Success, Info, Purple, Yellow, Comment, Foreground). Both light (high-contrast) and dark (Dracula-inspired) variants are defined with documentation per color.applyStyle()inpkg/console/console.gogates all style application behindtty.IsStdoutTerminal(), preventing ANSI codes from leaking into pipes/redirects.RenderTitleBoxuseslipgloss.DoubleBorder+ centered alignment;RenderErrorBoxuses rounded borders with error foreground;RenderInfoSectionuses a left-border emphasis pattern.RenderComposedSectionsuseslipgloss.JoinVerticalfor correct vertical layout composition.RenderTableinpkg/console/console.gouseslipgloss/tablewith zebra-stripe rows, styled headers, total rows, and aStyleFuncthat is gated behind TTY detection.pkg/console/banner.gouses an embedded ASCII logo withlipglossbold + purple styling and proper TTY fall-through.None — Lipgloss usage is fully correct and well-abstracted.
Huh Form Patterns
✅ Strengths
huh.NewForm(…)instances call.WithAccessible(console.IsAccessibleMode()).IsAccessibleMode()checks three env vars:ACCESSIBLE,TERM=dumb,NO_COLOR— covers screen readers, CI environments, and no-color preferences.pkg/console/confirm.goandpkg/console/input.gowrap common form patterns (confirmation dialogs, secret inputs) so consuming code stays simple.pkg/console/input.go::PromptSecretInputcheckstty.IsStderrTerminal()before running the form, returning a clear error if not in a terminal.Select,MultiSelect,Confirm,Input, andEchoModePasswordappropriately for their context.PromptSecretInputvalidates non-empty value with a clear message.run_interactive.goenablesFiltering(true)withHeight(15), improving UX for large lists.run_interactive.go(lines 182, 345) and severaladd_interactive_*.gofiles don't check for TTY before callingform.Run(). If invoked non-interactively, huh will fail with a less-than-ideal error. Onlypkg/console/input.gohas the TTY guard. Consider adding a TTY pre-check helper shared across all interactive command entrypoints.Notefield orFilePickerfield is used anywhere; these could improve UX in thegh aw addwizard for selecting existing files or displaying rich onboarding text.Raw
fmt.Fprintf(os.Stderr, …)Without Console FormattingThe following files have user-facing messages written directly to stderr without console formatting, inconsistent with the rest of the codebase:
pkg/workflow/cache.go — 2 raw warnings
Recommended:
pkg/workflow/compiler_orchestrator_engine.go — 2 raw warnings
Recommended:
pkg/workflow/mcp_renderer.go — 1 raw error
Recommended:
pkg/cli/copilot_setup.go — info messages without console formatting
Lines 222, 233, 242 emit plain-text status messages (
"No version upgrade needed","Updated %s with new version","Skipping %s") withoutconsole.FormatInfoMessage. Lines 265–292 intentionally output YAML to stderr — this is acceptable structured output for copy-paste use.Recommended for lines 222/233/242:
pkg/cli/mcp_list_tools.go — info messages without console formatting
Recommended: Use
console.FormatInfoMessagefor the status lines andconsole.FormatCommandMessagefor the command suggestion.pkg/workflow/claude_logs.go — debug diagnostics via stderr
Lines 155, 216, 226, 232, 284, 331 write parser diagnostic output directly to stderr (
"Skipping invalid JSON line","No valid JSON entries found","Claude parser extracted %d tool sequences"). These read as internal diagnostics rather than user messages and should use theloggerpackage:pkg/cli/audit_report_render.go — inline list items bypassing FormatListItem
Many list items are manually formatted (
" • %s\n") rather than usingconsole.FormatListItem. While the manual format renders identically in non-TTY mode, it misses the styled list item rendering in TTY mode.Affected sections: Missing Tools, MCP Server Failures, Redacted URL Domains, firewall domain lists (lines 89–392).
Recommendations (Priority Order)
Medium — Convert raw
"WARNING:"/"Error"writes inpkg/workflow/(cache.go, compiler_orchestrator_engine.go, mcp_renderer.go) toconsole.FormatWarningMessage/console.FormatErrorMessage. These are user-visible during compilation and deserve consistent styling.Medium — Migrate diagnostic writes in
pkg/workflow/claude_logs.goto theloggerpackage. These are internal parser diagnostics that should only appear whenDEBUG=workflow:claude_logs, not unconditionally on stderr.Low — Update
pkg/cli/audit_report_render.goinline list items to useconsole.FormatListItemfor TTY-aware formatting consistency.Low — Add a shared TTY pre-check helper for interactive Huh forms in
pkg/cli/entrypoints (currently onlypkg/console/input.goguards this).Low — Update
pkg/cli/copilot_setup.goinfo status messages (lines 222/233/242) toconsole.FormatInfoMessage. The YAML output block (lines 265–292) is intentional structured output and should remain as-is.Enhancement — Consider using Huh
Notefields in thegh aw addwizard to display rich contextual help text instead of pre-formfmt.Fprintlnbanners.References:
Beta Was this translation helpful? Give feedback.
All reactions