[terminal-stylist] Terminal Stylist Report: Console Output Analysis #40995
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-06-24T10:01:32.928Z.
|
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
Analyzed 944 Go source files in
pkg/(excluding test files) for console output consistency, Lipgloss styling patterns, and Huh form implementations.Key Metrics
console.*packageWithTheme+WithAccessiblefmt.Fprintf(os.Stderr)without console formatting✅ What Works Well
Adaptive Color System —
pkg/styles/theme.gousescompat.AdaptiveColorfor all colors, automatically selecting light/dark variants based on terminal background. The Dracula-inspired dark palette pairs with muted light variants for strong accessibility.TTY Detection —
applyStyle()inconsole.goconsistently gates all styling viatty.IsStdoutTerminal()/tty.IsStderrTerminal(). Interactive components always check TTY before rendering forms.Huh Theme Coverage — All 16
huh.NewForm()calls inpkg/cli/apply.WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode()). TheHuhThememaps all field states (focused, blurred, option, button, text input) to the Dracula palette. Accessibility mode checksACCESSIBLE,TERM=dumb, andNO_COLORenvironment variables.Format/Render Naming Convention — The package doc clearly defines:
Format*→ pure string transformations, no side effectsRender*→ structured/multi-element layout outputThis convention is followed consistently throughout.
Rust-like Error Rendering —
FormatError()renders compiler errors withfile:line:col: error:prefix, source code context lines, column pointer arrows (^^^), and optional hints. This is well-implemented and IDE-parseable.Output Routing — Diagnostic output consistently goes to
stderr; structured data (JSON, hashes) goes tostdout. The doc comment enforces this explicitly.Logger Colors —
pkg/logger/logger.gouseslipgloss.Fprintfwith the sharedstyles.*adaptive color palette for namespace coloring.Non-interactive Fallbacks — Interactive components (
ConfirmAction,ShowInteractiveList,PromptSecretInput) gracefully fall back to plain-text alternatives when not in a TTY.Lipgloss Direct Import Analysis
Four files outside
pkg/stylesandpkg/consoleimport Lipgloss directly:pkg/cli/compile_schedule_calendar.golipgloss.Style{}(empty style for non-TTY path) +styles.ScheduleCalendar*stylespkg/cli/mcp_inspect.gocharm.land/lipgloss/v2/treefor tree renderingpkg/cli/status_command.gocharm.land/lipgloss/v2/treefor tree renderingpkg/logger/logger.golipgloss.Fprintfand inline style palettepkg/stylesfor centralizationHuh Form Implementation Review
huh.NewSelect,huh.NewInput,huh.NewConfirm,huh.NewMultiSelectPromptSecretInputvalidates for non-empty; engine/git forms validate option selectionsFiltering(true)andHeight(15)console.IsAccessibleMode()is called uniformly across all formsstyles.HuhThememaps all huh style slots (Focused, Blurred, Group, TextInput) to the Dracula paletteStandalone wrappers in
pkg/console:ConfirmAction()— wrapshuh.NewConfirmwith TTY fallbackPromptSecretInput()— wrapshuh.NewInputwith EchoModePasswordShowInteractiveList()— wrapshuh.NewSelectwith text fallbackAll three apply
styles.HuhThemeandIsAccessibleMode().1. Raw
fmt.Fprintf(os.Stderr)Without Console FormattingSeveral files write directly to stderr with plain string prefixes (
"Warning: ","ERROR: ","WARNING: ") instead of using theconsole.FormatWarningMessage()/console.FormatErrorMessage()helpers:pkg/workflow/claude_logs.gopkg/workflow/cache.go"Warning: "string prefix instead ofFormatWarningMessagepkg/workflow/mcp_renderer.go"Error generating..."withoutFormatErrorMessagepkg/workflow/compiler_orchestrator_engine.go"WARNING: "all-caps prefixpkg/workflow/push_to_pull_request_branch.go"Warning: "string prefixpkg/workflow/side_repo_maintenance.gopkg/workflow/lock_validation.gopkg/cli/vscode_config.gopkg/cli/trial_confirmation.gofmt.Fprintln(os.Stderr, "")Example anti-pattern:
2. Mixed Formatting in
pkg/cli/compile_stats.goThis file mixes
console.Format*calls with rawfmt.Fprintf(os.Stderr, ...)in adjacent lines, creating inconsistent visual output:The list items (
✗ %s) should useconsole.FormatListItem(). The verbose detail lines could useconsole.FormatVerboseMessage().3. Verbose Diagnostics in
pkg/workflow/claude_logs.goThe
verboseflag paths bypass console formatting entirely:console.LogVerbose(verbose, message)already exists for exactly this purpose.Recommendations
Replace raw
"Warning:"/"ERROR:"prefixes withconsole.FormatWarningMessage()/console.FormatErrorMessage()in the 9 files listed above.Migrate verbose diagnostic paths in
pkg/workflow/claude_logs.goto useconsole.LogVerbose(verbose, msg)instead of barefmt.Fprintf(os.Stderr, ...)calls.Standardize list items in
compile_stats.go— useconsole.FormatListItem()for" ✗ %s"entries andconsole.FormatVerboseMessage()for suppressed-count and show-all guidance lines.Consider moving logger palette to
pkg/styles— thecolorPaletteslice inpkg/logger/logger.goduplicates whatpkg/stylesalready exposes. Moving it centralizes all color definitions.No action needed on Huh forms — theme and accessibility coverage is 100% consistent.
References:
Beta Was this translation helpful? Give feedback.
All reactions