[terminal-stylist] Terminal Stylist Audit — Console Output Analysis #28590
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #28712. |
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 in the
github/gh-awcodebase for consistency, formatting correctness, and alignment with Charmbracelet ecosystem best practices.Overview
The codebase has a well-established console output architecture built on two layers:
pkg/styles— Lipgloss-based style definitions with adaptive colors (light/dark terminal support)pkg/console— Higher-level formatting helpers (FormatInfoMessage,FormatWarningMessage, etc.) that wrap stylesOverall compliance is high. The vast majority of output (~1,600+ calls) correctly uses the console package. However, there are specific areas needing attention.
Summary Statistics
console.FormatInfoMessagecallsconsole.FormatWarningMessagecallsconsole.FormatSuccessMessagecallsconsole.FormatErrorMessagecallsfmt.Println/fmt.Printfto stdoutfmt.Fprintln/Fprintfto stderr without console formatting✅ What's Working Well
Lipgloss Usage (pkg/styles)
compat.AdaptiveColorwith bothLight/Darkvariants — correctly handles dark and light terminal themesRoundedBorder,NormalBorder,ThickBorderavailable for layout flexibilityErrorBoxwith rounded borders and padding — good pattern for critical errorscharm.land/lipgloss/v2(v2 API with adaptive color built-in) ✅Console Package
console.RenderTable,console.TableConfigused consistently (~83 usages total)console.RenderStructfor structured data renderingconsole.ConfirmActionfor interactive confirmationsconsole.NewSpinner/console.SpinnerWrapperfor progress feedbackStructured Output to stdout (Correct Pattern)
The following files correctly send structured/piped data to stdout:
hash_command.go→ hash stringtool_graph.go→ Mermaid graphstatus_command.go,list_workflows_command.go,deps_report.go→ JSONaudit_cross_run_render.go,audit_diff_render.go→ Markdown reports (piped output)1. Raw stderr output without console formatting
These files write to
os.Stderrdirectly without usingconsole.Format*helpers:pkg/cli/enable.go (~12 raw stderr calls)
pkg/cli/deps_security.go (~4 raw stderr calls)
Security advisory output is printed as plain text. This is a high-visibility area that would benefit from styled output:
pkg/cli/audit.go (~3 raw stderr calls)
Log file paths written without formatting:
pkg/workflow/cache.go (~2 raw stderr calls)
pkg/workflow/push_to_pull_request_branch.go (~1 raw stderr call)
2. No Huh Forms Library
The codebase does not use
charmbracelet/huhfor interactive prompts. Instead, interactive flows are implemented manually (e.g.,add_interactive_*.gofiles).Recommendation: Evaluate
charmbracelet/huhfor future interactive wizards (add_wizard_command.go). It would provide:This is not urgent — the current implementation works — but it's worth considering for
gh aw addwizard UX improvements.3. Minor: audit_cross_run_render.go uses Markdown headers to stdout
audit_cross_run_render.gooutputs# Audit Reportand## Executive Summaryas raw Markdown headers to stdout. This is intentional for report piping, but worth noting that it bypasses the styled rendering system entirely. This is acceptable for piped/redirected report output.Recommendations (Prioritized)
fmt.Fprintf(os.Stderr, ...)withconsole.Format*callsenable.go,deps_security.gocache.go,push_to_pull_request_branch.goaudit.gocharmbracelet/huhforaddwizard UXadd_wizard_command.goConclusion
The codebase demonstrates strong adherence to terminal styling best practices:
pkg/stylespkg/consolepackage provides rich, consistent formatting helpersThe main gap is ~30 raw stderr writes in
enable.goanddeps_security.gothat bypass the formatting system. Addressing those two files would bring compliance to near 100%.References:
Beta Was this translation helpful? Give feedback.
All reactions