Terminal Stylist: Console Output Analysis Report #21658
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #21868. |
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 the gh-aw codebase (
pkg/andcmd/), evaluating consistency, Lipgloss usage, and Huh form implementations.Summary
console.*formattingconsole.Format*/console.Render*callsOverall, the codebase has a mature, consistent console output system. The
pkg/consoleandpkg/stylespackages provide a robust, Lipgloss-backed formatting layer that is widely and correctly adopted. A small set of files diverge from the pattern and are called out below.✅ What's Working Well
Console Formatting Adoption
The
pkg/consolepackage is well-designed and heavily used. Top formatting functions by usage:console.FormatInfoMessageconsole.FormatWarningMessageconsole.FormatSuccessMessageconsole.FormatVerboseMessageconsole.FormatErrorMessageconsole.FormatSectionHeaderconsole.RenderTableconsole.FormatCommandMessageStdout vs Stderr Routing
The codebase correctly routes output following Unix conventions:
stdout✅stderrviaconsole.*✅fmt.Fprintf(os.Stdout, ...)for diagnostics found ✅Lipgloss Integration
pkg/styles/theme.goprovides a comprehensive, production-quality Lipgloss setup:charm.land/lipgloss/v2withcompat.AdaptiveColorfor automatic light/dark terminal adaptation (Dracula theme for dark, high-contrast for light) ✅pkg/ttyusinggolang.org/x/term, withapplyStyle()inconsole.gothat skips ANSI codes when not in a TTY ✅Error,Warning,Success,Info,FilePath,Command,Progress,TableHeader,TableCell,ServerName, etc. ✅RoundedBorder,NormalBorder,ThickBordercentralized for consistency ✅TableHeader,TableCell,TreeEnumerator,TreeNodefor structured output ✅ErrorBox(rounded border + padding) used in MCP inspection output ✅Huh Interactive Forms
All 12 files using
huhforms apply the custom theme and accessibility mode consistently:pkg/styles/huh_theme.go: CustomHuhTheme()maps the entire Dracula-inspired palette to huh's field styles (focused/blurred borders, selectors, buttons, text input cursors) ✅pkg/console/accessibility.go:IsAccessibleMode()checksACCESSIBLE,TERM=dumb,NO_COLORenv vars ✅add_interactive_*.go,run_interactive.go,engine_secrets.go,interactive.go) apply the theme ✅huh.Group/ field organization across all wizards ✅1. Raw
fmt.Fprintf(os.Stderr)Warning/Error Messages inpkg/workflow/These files have logger vars (
logger.New(...)) but still use rawfmt.Fprintffor user-visible warning/error messages instead ofconsole.FormatWarningMessageor the logger:View affected files and lines
pkg/workflow/cache.go— 2 instances:Should use:
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(...))pkg/workflow/mcp_renderer.go— 1 instance:Should use:
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(...))pkg/workflow/push_to_pull_request_branch.go— 1 instance:Should use:
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(...))pkg/workflow/compiler_orchestrator_engine.go— 2 instances:Both have adjacent
console.FormatWarningMessage(...)calls in the same file — these two are inconsistent with the file's own style.pkg/workflow/claude_logs.go— 6 instances:These are debug-level messages — the file already has
var claudeLogsLog = logger.New("workflow:claude_logs"). These should useclaudeLogsLog.Printf(...)to make them conditional onDEBUG=workflow:claude_logs.pkg/workflow/action_sha_checker.go— 2 instances:Already has
var actionSHACheckerLog = logger.New(...). Should use the logger orconsole.FormatVerboseMessage.2. Mixed Console Usage in
pkg/cli/mcp_list_tools.goThe file correctly uses
console.FormatInfoMessageandconsole.FormatWarningMessagein most places, but falls back to rawfmt.Fprintffor two user-visible messages:The second block is a user-facing instruction that should use
console.FormatInfoMessageandconsole.FormatCommandMessage.3. Raw
fmt.Fprintln(os.Stderr)inpkg/cli/copilot_setup.goandpkg/cli/mcp_config_file.goThese files output YAML code block instructions to stderr using many raw
fmt.Fprintlncalls. While the YAML content itself is intentionally unformatted, the surrounding instructional text (e.g., "To enable GitHub Copilot Agent integration...") skipsconsole.FormatInfoMessage.Consider wrapping the instructional header and footer in
console.FormatInfoMessage, and usingconsole.RenderInfoSectionfor the YAML code block content.4. Debug Messages Not Using Logger in
pkg/workflow/claude_logs.goSix
fmt.Fprintf(os.Stderr, ...)calls output parser diagnostic info unconditionally. SinceclaudeLogsLogis already defined, these should beclaudeLogsLog.Printf(...)so they're hidden unlessDEBUG=workflow:claude_logsis set.💡 Recommendations
pkg/workflow/cache.gofmt.Fprintfwithconsole.FormatWarningMessagepkg/workflow/mcp_renderer.gofmt.Fprintfwithconsole.FormatErrorMessagepkg/workflow/compiler_orchestrator_engine.goWARNING:lines withconsole.FormatWarningMessage(matches rest of file)pkg/workflow/claude_logs.gofmt.FprintftoclaudeLogsLog.Printf(conditional debug output)pkg/workflow/action_sha_checker.goconsole.FormatVerboseMessagepkg/cli/mcp_list_tools.gofmt.Fprintf(os.Stderr)with console-formatted equivalentspkg/cli/copilot_setup.goconsole.FormatInfoMessage; keep YAML code as-is or inconsole.RenderInfoSectionpkg/cli/mcp_config_file.gocopilot_setup.gopkg/workflow/push_to_pull_request_branch.gofmt.Fprintfwithconsole.FormatWarningMessage🏆 Exemplary Files
These files demonstrate the gold standard for console output:
pkg/cli/audit_report_render.go— Consistent use ofconsole.FormatSectionHeader,console.FormatErrorMessage,console.FormatWarningMessagethroughout a complex multi-section rendererpkg/cli/mcp_inspect_mcp.go— Good mix of console formatting for diagnostics and structured table output to stdoutpkg/cli/interactive.go— Huh forms withWithTheme(styles.HuhTheme()).WithAccessible(console.IsAccessibleMode())applied consistentlypkg/styles/theme.go— Well-documented adaptive color system with semantic variables and consistent namingpkg/styles/huh_theme.go— Complete Huh theme mapping all field states (focused/blurred, selected/unselected, error/success)References:
Beta Was this translation helpful? Give feedback.
All reactions