[terminal-stylist] Terminal Stylist Audit — Console Output Analysis #26207
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #26416. |
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 audit analyzes console output patterns across 668 Go source files in
pkg/andcmd/, covering Lipgloss styling, Huh interactive forms, and theconsoleformatting package.Overview
The codebase demonstrates excellent overall console architecture with a well-structured
pkg/consoleandpkg/stylespackages built on the Charmbracelet ecosystem. The console formatting API is heavily adopted (1,189+ usages) and provides consistent, accessible output. There are targeted areas where rawfmt.Fprintf(os.Stderr, ...)calls bypass the formatting system.✅ Lipgloss Usage — Well Implemented
pkg/styles/theme.goprovides a centralized Dracula-inspired adaptive color system:compat.AdaptiveColor{Light: ..., Dark: ...}for automatic light/dark terminal adaptationstyles.Error,styles.Warning,styles.Success,styles.Info,styles.FilePath,styles.LineNumber,styles.Comment— pre-configuredlipgloss.NewStyle()valuesRoundedBorder,NormalBorder,ThickBorder) with documented usage guidelinespkg/console/console.gouses Lipgloss correctly throughout:applyStyle(style, text)helper gates all styling on TTY detection (tty.IsStdoutTerminal())lipgloss/tablewithstyleFuncfor zebra-striped, rounded-border tableslipgloss.JoinVerticalfor composing multi-section panelspkg/console/banner.go:lipgloss.NewStyle().Bold(true).Foreground(styles.ColorPurple)Lipgloss usage inventory
pkg/styles/theme.gopkg/console/console.golipgloss/table, boxes, sectionspkg/console/banner.golipgloss.NewStyle()for logopkg/console/spinner.go✅ Huh Interactive Forms — Consistently Applied
All 9 CLI files that use
huhdirectly apply the full theme/accessibility chain:pkg/styles/huh_theme.go— customHuhThemefunction:lipgloss.LightDark(isDark)to derive per-variable light/dark valuespkg/console/confirm.go,input.go,list.go— library wrappers:ConfirmAction,PromptSecretInput,ShowInteractiveListall usestyles.HuhTheme+ accessibilityinput.goandlist.gochecktty.IsStderrTerminal()before entering interactive modelist.goprovides a graceful non-TTY text fallbackFiles using huh directly (all compliant)
pkg/cli/add_interactive_auth.gopkg/cli/add_interactive_engine.gopkg/cli/add_interactive_git.gopkg/cli/add_interactive_orchestrator.gopkg/cli/add_interactive_schedule.gopkg/cli/add_interactive_workflow.gopkg/cli/engine_secrets.gopkg/cli/interactive.gopkg/cli/run_interactive.goThe
consolepackage provides 17Format*functions, well-distributed across the codebase:pkg/cli/FormatInfoMessageFormatWarningMessageFormatSuccessMessageFormatVerboseMessageFormatErrorMessageFormatSectionHeaderFormatCommandMessageFormatNumberGaps — Raw stderr writes without console formatting:
~371
fmt.Fprintf(os.Stderr, ...)calls with content that bypass the console formatting system. Top offenders:Top files with unformatted stderr output
pkg/cli/audit_report_render.gopkg/cli/mcp_inspect_mcp.gopkg/cli/engine_secrets.gopkg/cli/audit_cross_run_render.gopkg/cli/preconditions.gopkg/cli/add_interactive_workflow.gopkg/cli/shell_completion.gopkg/cli/deps_report.gopkg/cli/copilot_setup.gopkg/cli/enable.goNotable anti-patterns found:
pkg/cli/preconditions.go— User-facing messages as plain strings:pkg/cli/mcp_inspect_mcp.go— Manual emoji formatting instead of console functions:pkg/cli/enable.go— Status/progress messages without formatting:✅ Correct Stdout Usage
Files that output structured data to stdout are following the correct pattern:
pkg/cli/hash_command.gopkg/cli/audit_cross_run_render.gopkg/cli/audit_diff_render.gopkg/cli/tool_graph.gopkg/cli/domains_command.goRecommendations
Priority 1 — User-Facing Instruction Text (preconditions.go)
pkg/cli/preconditions.gocontains 15+ user-visible strings describing required user actions. These are high-value targets since they appear during auth failures and permission errors:fmt.Fprintln(os.Stderr, "...")withconsole.FormatInfoMessageorconsole.FormatWarningMessageconsole.FormatCommandMessagefor inline command examplesPriority 2 — MCP Inspect Output (mcp_inspect_mcp.go)
The
mcp inspecttool output uses manual emoji+markdown formatting. This could be refactored to:console.RenderStructwithconsolestruct tags for the tool detail viewconsole.RenderTablefor the tool listconsole.FormatSuccessMessage/FormatWarningMessagePriority 3 — Enable Command Status (enable.go)
enable.gomixes formatted and unformatted output. Standardize with:console.FormatInfoMessagefor status updatesconsole.FormatSuccessMessagefor completion messagesconsole.FormatListItemfor the workflow listPositive Patterns to Continue
WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())— applied consistently on all formsapplyStyle(style, text)TTY gating — should be followed for any new Lipgloss usagepkg/consolewrappers (ConfirmAction,PromptSecretInput,ShowInteractiveList) — should be preferred over directhuhusage for simple single-field casesReferences:
Beta Was this translation helpful? Give feedback.
All reactions