Terminal Stylist: Console Output Analysis Report #22035
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 #22199. |
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 covers a full audit of console output patterns across all non-test Go source files in
pkg/andcmd/. The codebase demonstrates excellent terminal output discipline — a well-layered abstraction stack, proper stream separation, adaptive theming, and thorough accessibility support. Two minor improvement opportunities were identified.Summary
console.Format*call sitesfmt.Fprintf(os.Stderr, ...)call sitesfmt.Println/Printf(stdout structured output)Architecture
The output stack is cleanly layered:
No code outside
pkg/styles/andpkg/console/importslipglossdirectly. This is the correct pattern.✅ Lipgloss Usage — Correct and Well-Structured
Adaptive color system in
pkg/styles/theme.go: All 11 semantic colors (Error, Warning, Success, Info, Purple, Yellow, Comment, Foreground, Background, Border, TableAltRow) are defined ascompat.AdaptiveColor{Light: ..., Dark: ...}with Dracula-inspired dark values and high-contrast light values.TTY-aware rendering in
pkg/console/console.go:Table rendering uses lipgloss
tablewithRoundedBorder, alternating row styles, and aStyleFuncfor per-cell formatting — consistent across all tabular output.Border styles are defined as package-level singletons (
RoundedBorder,NormalBorder,ThickBorder) to avoid repeated allocation.View full lipgloss style inventory (pkg/styles/theme.go)
Error,Warning,Success,Info— semantic message stylesFilePath,LineNumber,ColumnNumber— source location stylesBold,Faint,Italic— text emphasisRoundedBorder,NormalBorder,ThickBorder— border constantsColorError,ColorWarning,ColorSuccess,ColorInfo,ColorPurple,ColorYellow,ColorComment,ColorForeground,ColorBackground,ColorBorder,ColorTableAltRow— rawAdaptiveColorvalues for custom styles✅ Huh Forms — Comprehensive and Accessible
All 15+ files using
huhinteractive forms follow the correct pattern:styles.HuhTheme()maps the full Dracula palette (primary, success, error, warning, comment, fg, bg, border) to all huh field states: focused/blurred, selected/unselected, buttons, text inputs, error indicators.console.IsAccessibleMode()enables plain-text fallback whenACCESSIBLE,NO_COLOR, orTERM=dumbis set — covers screen readers and CI pipelines automatically.Form types in use:
Select,MultiSelect,Input,Confirm(includingEchoModePasswordfor secrets).View huh usage by file
pkg/cli/run_interactive.gopkg/cli/add_interactive_engine.gopkg/cli/add_interactive_auth.gopkg/cli/add_interactive_orchestrator.gopkg/cli/add_interactive_schedule.gopkg/console/input.gopkg/console/confirm.go✅ stdout / stderr Separation — Correct Throughout
All 21
fmt.Println/Printfcalls writing to stdout are structured data outputs appropriate for piping:health_command.go,status_command.go,list_workflows_command.go,domains_command.go,deps_report.go,run_workflow_execution.go,compile_pipeline.go,trial_command.gohash_command.go(hash string),checks_command.go(state string)tool_graph.go(Mermaid graph),logs_report.go/status_command.go(rendered struct)mcp_list_tools.go,mcp_inspect_mcp.goAll diagnostic messages use
fmt.Fprintln(os.Stderr, console.Format*(...)).1. Hardcoded
lipgloss.Colorinpkg/console/progress.goThe progress bar uses hardcoded hex strings instead of the centralized
styles.Color*constants:The hardcoded values happen to match the Dracula dark palette, but they aren't adaptive — they won't adjust for light-background terminals. Low severity since progress bars are typically used interactively where dark defaults are common, but it breaks the adaptive color contract established elsewhere.
2. Dual lipgloss import in
pkg/styles/huh_theme.gohuh_theme.goimportsgithub.com/charmbracelet/lipgloss(v1) while the rest of the styles package usescharm.land/lipgloss/v2. This is necessary becausehuh v0.8.0depends on lipgloss v1, not v2. The split is documented implicitly by the twogo.modentries but not explicitly in the file.Recommendation: Add a comment in
huh_theme.goexplaining the intentional v1 import:Recommendations
pkg/console/progress.go:54,60lipgloss.Color("#...")withstyles.ColorPurple,styles.ColorInfo,styles.ColorCommentto use adaptive light/dark variantspkg/styles/huh_theme.go:1No structural changes needed. The console output architecture is sound and internally consistent.
References: §23364944234
Beta Was this translation helpful? Give feedback.
All reactions