Terminal Stylist Audit: Console Output Analysis for gh-aw #23227
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #23341. |
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
gh-awcodebase (pkg/andcmd/), covering Lipgloss styling, Huh form usage, and output routing consistency.Scope: 624 non-test Go source files analyzed | Run §23645025366
Summary
compat.AdaptiveColorwith light/dark variantsapplyStyle()gates all ANSI codes behindisTTY()WithTheme()+WithAccessible()console.Format*calls but 228 barefmt.Fprintln(os.Stderr, "...")in 36 filesLipgloss Usage
✅ Strengths
Adaptive color system (
pkg/styles/theme.go): Every color constant usescompat.AdaptiveColorwith explicitLight/Darkhex values, automatically adapting to terminal background:Consistent style catalogue: 25+ pre-configured styles (
Error,Warning,Success,Info,FilePath,TableHeader,TreeEnumerator, etc.) using the palette uniformly.Border variety: Three border types (
RoundedBorder,NormalBorder,ThickBorder) defined centrally inpkg/styles/theme.go.TTY-gated rendering:
applyStyle()inpkg/console/console.gocorrectly skips ANSI codes when piped:Lipgloss table (
charm.land/lipgloss/v2/table): Used inpkg/console/console.gofor structured table rendering with alternating row styles.Lipgloss usage breakdown (85 total calls):
NewStyle()Color()AdaptiveColorℹ️ Intentional Dual Import (huh_theme.go)
pkg/styles/huh_theme.goimports"github.com/charmbracelet/lipgloss"(v1) alongside the rest of the codebase using"charm.land/lipgloss/v2". This is intentional and correctly documented —huh v0.8.0depends on Lipgloss v1 types, so the theme file must use that version for type compatibility:No action needed here.
pkg/console/list.goimplements an interactive list selector usingcharm.land/bubbles/v2/listand Bubble Tea. This is appropriate for the interactive selection use case.For non-interactive hierarchical output (tree structures),
pkg/styles/theme.godefinesTreeEnumerator/TreeNodestyles but there's no central tree-rendering utility. Files that output tree-like output manually format it. This is a low-priority gap — Lipgloss'slipgloss/listrenderer could provide a consistent tree rendering utility if needed in the future.Huh Form Usage
✅ Comprehensive Accessibility Support
All 18
huh.NewForm()instances across 11 files consistently apply:WithTheme(styles.HuhTheme())— Dracula-inspired palette matching CLI outputWithAccessible(console.IsAccessibleMode())— respectsGH_AW_ACCESSIBLE=1orNO_COLORFiles correctly using the full pattern:
pkg/console/confirm.go,pkg/console/input.gopkg/cli/add_interactive_auth.go,add_interactive_engine.go,add_interactive_git.gopkg/cli/add_interactive_orchestrator.go,add_interactive_schedule.go,add_interactive_workflow.gopkg/cli/engine_secrets.go,pkg/cli/interactive.go,pkg/cli/run_interactive.go✅ Good Field Variety and Validation
The forms make good use of Huh's field types:
huh.NewConfirm()— for boolean choices (confirm actions)huh.NewInput()withEchoMode(huh.EchoModePassword)— for secrets/tokenshuh.NewSelect()— for engine/option selectionhuh.NewText()— for multi-line prompt entryValidation is implemented on user-facing inputs (e.g., empty value checks on secrets).
TTY checking before showing forms:
Output Routing
✅ Structured Output Correctly Routed to stdout
The following patterns correctly use stdout for pipeable data:
pkg/cli/tool_graph.go:188— Mermaid graph outputpkg/cli/deps_report.go:265— JSON datapkg/cli/list_workflows_command.go:122,226— JSON workflow listspkg/cli/health_command.go:275,320— JSON health datapkg/cli/audit_report_render.go:22— JSON viajson.NewEncoder(os.Stdout)pkg/cli/audit_cross_run_render.go— Markdown report (intentional, namedrenderCrossRunReportMarkdown)pkg/cli/audit_diff_render.go— Markdown diff (intentional, namedrenderAuditDiffMarkdown)✅ Diagnostic Output Mostly Uses stderr
2,064
fmt.Fprintln/Fprintf(os.Stderr, ...)calls; 1,459 of those useconsole.Format*helpers. The major CLI commands (compile,audit,run, etc.) correctly route all diagnostic messages to stderr.Issues: Bare Unformatted stderr Messages
228 bare
fmt.Fprintln(os.Stderr, "...")calls in 36 files bypass the console formatting system. These messages appear unstyled even in TTY contexts. Top offenders:engine_secrets.go"GitHub Copilot requires a fine-grained Personal Access Token..."preconditions.go"Please run the following command to authenticate:"shell_completion.goadd_interactive_git.goadd_interactive_orchestrator.goaudit_report_render.goadd_interactive_workflow.goinit.gofix_command.godeps_report.gocopilot_setup.gorun_push.gocompile_watch.goSpecific Examples Needing Fixes
compile_watch.go— Watch mode messages should useconsole.FormatInfoMessage:preconditions.go— Multi-line instructional messages:engine_secrets.go— PAT setup instructions (29 unformatted lines):console/terminal.go— Welcome message:Recommendations
Priority 1 — High impact, easy fixes:
engine_secrets.go(29 bare messages): Replace guidance text withconsole.FormatInfoMessage()/console.FormatWarningMessage()preconditions.go(27 bare messages): Format instructional text with appropriate message typesPriority 2 — Medium impact:
3.
shell_completion.go(18),add_interactive_git.go(16): Apply console formatting to setup/guidance text4.
compile_watch.go(5): UseFormatProgressMessagefor emoji-prefixed watch status messagesPriority 3 — Low impact (spacers):
5.
deps_report.go,audit_report_render.go: Emptyfmt.Fprintln(os.Stderr, "")spacers between sections are acceptable style but could use consistent newline managementNo action needed:
huh_theme.godual lipgloss import is intentional and correctReferences: §23645025366
Beta Was this translation helpful? Give feedback.
All reactions