Terminal Stylist: Console Output Analysis for gh-aw #21455
Closed
Replies: 2 comments 1 reply
-
|
/plan |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #21658. |
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, focusing on Lipgloss styling, Huh form implementations, and output consistency.
Workflow run: §23219177246
Executive Summary
The codebase has a strong foundational architecture for styled terminal output. The
pkg/consoleandpkg/stylespackages are well-designed and widely adopted. However, ~534 raw stderr writes remain outside the console formatting system, and thepkg/workflowpackage contains debug/warning messages that bypass console formatters. Interactive forms (Huh) are consistently accessible. Lipgloss adaptive colors and TTY detection are correctly implemented throughout the core infrastructure.console.Format*/console.Render*console.Format*callsfmt.Fprintf(os.Stderr, …)calls (non-console)WithAccessible()AdaptiveColorapplyStyle()Lipgloss Analysis
✅ Strengths
Adaptive color system (
pkg/styles/theme.go) — All 10 semantic colors uselipgloss.AdaptiveColorwith distinct light/dark variants. The palette is Dracula-inspired for dark mode and uses muted, high-contrast colors for light mode. This is exemplary:TTY-aware rendering (
pkg/console/console.go) — TheapplyStyle()helper correctly gates all Lipgloss rendering:Rich table rendering —
RenderTable()inconsole.gouseslipgloss/tablewith styled headers, zebra-striped rows, rounded borders, and a configurable total row.Bubble Tea interactive list (
pkg/console/list.go) — Full Bubble Tea model with a non-TTY text fallback, custom item delegate using Lipgloss styles for selected/normal/description states, and filter support.Semantic border constants —
RoundedBorder,NormalBorder,ThickBorderare defined centrally inpkg/styles/theme.goensuring consistent use.Logger uses raw ANSI codes (
pkg/logger/logger.go) — The logger uses hardcoded\033[38;5;Xmescape sequences instead of Lipgloss. While it has TTY detection, this diverges from the Lipgloss-based approach used everywhere else:Manual list bullet points — Several files use raw
•bullets infmt.Fprintfcalls instead ofconsole.FormatListItem():RenderTitleBoxandRenderInfoSectioncheckIsStderrTerminalbut the list fallback uses raw formatting — Minor inconsistency:ShowInteractiveListcorrectly checkstty.IsStderrTerminal()for the list but then callsfmt.Fprintf(os.Stderr, ...)directly in the fallback without style helpers.Top files with raw stderr writes (opportunities for improvement)
pkg/cli/audit_report_render.gopkg/cli/mcp_inspect_mcp.gopkg/cli/engine_secrets.gopkg/cli/preconditions.gopkg/cli/shell_completion.gopkg/cli/add_interactive_workflow.gopkg/cli/copilot_setup.gopkg/cli/add_interactive_git.gopkg/cli/add_interactive_orchestrator.gopkg/cli/fix_command.gopkg/workflow/claude_logs.gopkg/workflow/cache.gopkg/workflow/mcp_renderer.goNote: Many of the 90 raw writes in
audit_report_render.goare emptyfmt.Fprintln(os.Stderr)spacers — these are acceptable. The bullet-point writes are the primary improvement opportunity.Huh Forms Analysis
✅ Strengths
100% accessibility compliance — All 11
huh.NewForm()calls across 11 files include.WithAccessible(console.IsAccessibleMode()). This is a standout achievement:Rich field types used — The codebase uses the full range of Huh field types appropriately:
huh.NewInput()— workflow name, single-line text collectionhuh.NewText()— multi-line intent descriptionhuh.NewSelect[string]()— engine selection, trigger selection, network accesshuh.NewMultiSelect[string]()— tool selection, safe output channelshuh.NewConfirm()— destructive action confirmation (pkg/console/confirm.go)huh.EchoModePassword— secrets input (pkg/console/input.go)Well-organized form groups —
interactive.gosplits configuration into 4 logical groups (workflow identity → triggers/engine → tools/outputs → network/intent), providing good UX paging.Centralized primitives —
pkg/console/confirm.goandpkg/console/input.goprovide reusable single-field form wrappers for common prompts.No custom Huh theme — Forms use the default Huh theme. The project has a rich
pkg/stylestheme that could be applied to Huh viahuh.NewTheme()or by customizing field styles, creating a more cohesive visual identity.Missing validation in some forms —
add_interactive_workflow.gousesValidate()on the workflow name input, but other forms (e.g., the intent text ininteractive.go) skip validation. The intent field accepts empty strings without warning.add_interactive_secrets.godoesn't use Huh — While other interactive add-flows usehuhforms,add_interactive_secrets.godoesn't import Huh at all (secrets are handled byengine_secrets.go). This is fine architecturally but worth noting for consistency.Recommendations
High Priority
Apply
FormatListItem()consistently for bullet points — Replace rawfmt.Fprintf(os.Stderr, " • %s\n", ...)calls withconsole.FormatListItem()inaudit_report_render.go,preconditions.go, andmcp_inspect_mcp.go. This ensures bullets get the themedstyles.ListItemstyling and TTY detection.Migrate logger colors to Lipgloss — Replace the 12 hardcoded
\033[38;5;XmANSI sequences inpkg/logger/logger.gowith Lipgloss-derived color strings. This consolidates color management and ensures adaptive light/dark support for debug output.Add console formatting to
pkg/workflowwarnings —claude_logs.go,cache.go, andmcp_renderer.gowrite rawWarning:and error strings directly to stderr without console formatting. These should useconsole.FormatWarningMessage()/console.FormatErrorMessage()for visual consistency.Medium Priority
Implement a custom Huh theme — Create
pkg/styles/huh_theme.gothat maps the existingpkg/stylescolors into ahuh.Theme. This would give forms the same Dracula-inspired palette as the rest of the CLI output.Add
FormatLocationMessageandFormatCountMessagetoconsole.go— These functions exist inconsole_wasm.goas stubs but have no non-wasm implementation. If these are intended for future use, add the Lipgloss-styled implementations toconsole.go.Add intent field validation — The
huh.NewText()field for workflow intent ininteractive.goshould validate non-empty input, consistent with the workflow name field'sValidate()call.Low Priority
Reduce empty-line writes — There are 61
fmt.Fprintln(os.Stderr)calls for spacing. Consider aconsole.PrintSpacer()helper that in non-TTY mode omits extra blank lines (useful for cleaner CI output).Standardize
RenderInfoSectionfallback — The non-TTY fallback inpkg/console/list.go'sshowTextListuses rawfmt.Fprintfwithout theapplyStylewrapper. Minor inconsistency with the TTY-detection pattern used elsewhere in the console package.Good Pattern Examples
✅ Exemplary Lipgloss pattern (pkg/console/console.go)
✅ Exemplary Huh form pattern (pkg/cli/interactive.go)
References:
Beta Was this translation helpful? Give feedback.
All reactions