[terminal-stylist] Terminal Stylist Analysis — Console Output Patterns #29905
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-05-04T09:12:58.755Z.
|
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.
-
Overview
This report analyzes console output patterns across 752 Go source files in the
github/gh-awcodebase. The project has a well-structured terminal output system built on Lipgloss v2 (charm.land/lipgloss/v2) and Huh v2 (charm.land/huh/v2), with a centralizedpkg/consolepackage providing format helpers.Key numbers:
fmt.Fprintln(os.Stderr, ...)calls inpkg/cli/console.Format*calls (72% of stderr calls properly formatted)huhforms inpkg/cli/, all consistently themedLipgloss Usage
✅ What is Working Well
Adaptive colors throughout —
pkg/styles/theme.godefines all colors ascompat.AdaptiveColor{Light: ..., Dark: ...}using the Dracula-inspired palette. Every color constant has both a light and dark variant, ensuring readability on any terminal background.TTY detection before applying styles —
pkg/console/console.gogates all styling viaapplyStyle(), which checkstty.IsStdoutTerminal()before rendering Lipgloss styles. This prevents ANSI codes from leaking into pipes and redirects.Diverse layout primitives in
pkg/console/console.go:RenderTable()— usescharm.land/lipgloss/v2/tablewith alternating row colors, a styled header, and a total rowRenderTitleBox()— double-border box with centered bold title (falls back to━separators)RenderErrorBox()— rounded border with error foreground colorRenderInfoSection()— left-border emphasis blockRenderComposedSections()—lipgloss.JoinVerticalcomposition for stderr outputRich set of message formatters —
FormatSuccessMessage,FormatErrorMessage,FormatWarningMessage,FormatInfoMessage,FormatCommandMessage,FormatProgressMessage,FormatPromptMessage,FormatVerboseMessage,FormatListItem,FormatErrorChain— all consistently prefixed with semantic icons (✓, ✗, ⚠, i, ⚡, 🔨, ❓, 🔍).Calendar heatmap with intensity styles —
pkg/cli/compile_schedule_calendar.gouses per-cell Lipgloss styles scaling fromColorComment→ColorInfo→ColorSuccess→ColorWarning→ColorErrorto visualize density.367 raw
fmt.Fprintln(os.Stderr, ...)without console formatting, mostly in:pkg/cli/deps_security.go(lines 97, 99, 121, 128) — blank lines and rawlinevariable outputpkg/cli/compile_file_operations.go:113—fmt.Fprintln(os.Stderr, err.Error())should useconsole.FormatErrorMessagepkg/cli/compile_file_operations.go:213— raw"Watching for file changes"stringpkg/cli/copilot_setup.go:269–285— multi-line YAML code block (could useconsole.RenderInfoSection)audit_cross_run_render.gouses Markdown h1/h2 headers to stdout — correct for piped output per Unix conventions, but header levels should use###+ per the project's report structure guidelines.FormatLocationMessageandFormatCountMessageonly exist in the WASM stub —pkg/console/console_wasm.godefines these two functions but there is no corresponding implementation inpkg/console/console.gofor native builds. If ever called from CLI code, a build failure would result.Huh Forms Usage
✅ What is Working Well
Consistent theming — All 9 files using
huh.NewForm()call.WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()). The customHuhThemeinpkg/styles/huh_theme.gomaps the Dracula palette to all field states (focused, blurred, selected, error indicators, buttons, text inputs).Accessibility mode —
pkg/console/accessibility.gocorrectly detectsACCESSIBLE,TERM=dumb, andNO_COLORand passes results to every form.Proper field types — password inputs use
EchoMode(huh.EchoModePassword), confirmations usehuh.NewConfirm(), selections usehuh.NewSelect[T](), free-form inputs usehuh.NewInput().Validation on inputs — interactive fields include
.Validate()with descriptive error messages.Centralized wrappers —
pkg/console/confirm.go,list.go, andinput.goprovide single-field helpers that apply theme and accessibility, reducing boilerplate.Some fields lack
.Description()text — inpkg/cli/interactive.go(lines 95, 170) some fields don't have explicit.Description(), reducing context for accessibility mode users.RunWithContextinconsistency — some forms use.Run()and others.RunWithContext(ctx). Prefer.RunWithContextuniformly to respect cancellation signals.Summary Table
compat.AdaptiveColorwith light/dark variantsapplyStyle()gates all Lipgloss renderinglipgloss/tablewith styled headers, alternating rowsFormatErrorChainhandles wrapped errors with indentationHuhTheme+IsAccessibleMode()NO_COLOR,TERM=dumb,ACCESSIBLEall detectedFormatCountMessage/FormatLocationMessagemissing from native.Description()for accessibility contextaudit_cross_run_renderheadersTop Recommendations
Fix
compile_file_operations.go:113— replacefmt.Fprintln(os.Stderr, err.Error())withfmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error())).Add
FormatCountMessage/FormatLocationMessagetopkg/console/console.goso these functions exist for native builds and match the WASM stub signatures.Standardize blank-line output — replace
fmt.Fprintln(os.Stderr, "")withfmt.Fprintln(os.Stderr)(no string arg) for clarity.Prefer
.RunWithContext(ctx)over bare.Run()in all huh forms.Add
.Description()to form fields inpkg/cli/interactive.gofor better accessibility mode experience.References:
Beta Was this translation helpful? Give feedback.
All reactions