[terminal-stylist] Terminal Stylist Report: Console Output Analysis #44695
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #44921. |
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.
-
Summary
This report analyzes console output patterns across the
pkg/directory ofgithub/gh-aw(1,048 non-test Go files scanned). The codebase has a strong, centralized console formatting system with good discipline, though a few areas could benefit from more consistent use of shared helpers.Key Metrics
console.*helperslipgloss.*stylingpkg/styles/huh.*forms/promptspkg/console/fmt.Print*pkg/console/needs reviewpkg/console/internalsConsole Package Patterns
pkg/console/console.gois the main normalization layer providing:Good patterns:
FormatSuccessMessageStderr,FormatInfoMessageStderr, etc.)applyStyleWithTTYprevents ANSI in non-interactive outputpkg/console/render.goprovides reflection-based table/section rendering — a strong reusable patternMessage Rendering Patterns
Consistent message helpers used broadly across CLI/workflow code:
These are the right default for all user-facing stderr output. Good examples of correct usage:
pkg/envutil/envutil.gopkg/actionpins/actionpins.goRaw `fmt` Usage — Appropriate Cases
Raw
fmt.*is appropriate and expected in:pkg/console/*internalspkg/cli/forecast_render.go)pkg/console/render.go)pkg/console/terminal.go,pkg/console/spinner.go)Raw `fmt` Usage — Candidates for Cleanup
Several files mix raw
fmt.Fprintln/Fprintfwith console helpers for user-facing stderr output:pkg/cli/update_display.gofmt.Fprintfinstead of error/list helperspkg/cli/run_interactive.gopkg/cli/forecast_render.gopkg/cli/trial_helpers.goFormatInfoMessagepkg/console/confirm.gopkg/console/list.goLipgloss Usage Analysis
Centralization: Styles are well-centralized in
pkg/styles/theme.go.Adaptive colors: ✅ Custom
adaptiveColorsystem inpkg/styles/— good practice.TTY gating: ✅
pkg/cli/compile_schedule_calendar.gocorrectly gates lipgloss styling before rendering ANSI.LightDark usage: ✅
pkg/styles/huh_theme.gouseslipgloss.LightDark(...)for per-render adaptive form theming.Logger:
pkg/logger/logger.gouses adaptive palette-derived styles — consistent with the theme.Overall: lipgloss usage is disciplined. Adaptive color support is solid.
Huh Forms and Prompts
Central abstraction:
pkg/console/prompt_form.gowrapshuh.NewForm(...)with:styles.HuhThemeExported helpers:
console.NewInputForm,NewSelectForm,NewConfirmFormGood patterns found:
pkg/cli/run_interactive.gopkg/console/input.gopkg/cli/interactive.go,pkg/cli/add_interactive_*,pkg/cli/engine_secrets.goManual ANSI Escapes
Manual ANSI usage is intentional, minimal, and confined to console internals:
pkg/console/terminal.go\033[H\033[2J(clear screen),\033[K(clear line)pkg/console/spinner.goThis is acceptable low-level terminal control. It should remain confined here.
Recommendations
pkg/consolehelpers for all user-facing stderr messages outsidepkg/console— avoid rawfmt.Fprintf(os.Stderr, ...)for user messages.pkg/cli/update_display.go,pkg/cli/run_interactive.go,pkg/cli/forecast_render.goare the highest-priority candidates.pkg/console/confirm.goandpkg/console/list.goto align with the console helper style.pkg/styles/— the current pattern is strong.console.NewForm(...)for new interactive flows to keep theme and accessibility consistent.References: §29084337300
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgSee Network Configuration for more information.
Beta Was this translation helpful? Give feedback.
All reactions