Terminal Stylist: Console Output Analysis Report #21126
Closed
Replies: 2 comments
-
|
/plan |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #21292. |
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 579 non-test Go source files across
pkg/for console output consistency, Lipgloss styling patterns, and Huh form usage. The codebase has a well-architected, centralized console formatting system and makes excellent use of the Charmbracelet ecosystem. A focused set of files still use rawfmt.Fprintf(os.Stderr, ...)without console formatters, creating minor visual inconsistencies.Overall score: 9/10 — excellent foundation with a clear, actionable improvement area.
Summary
fmt.Fprintf(os.Stderr, ...)Charmbracelet Ecosystem Integration
Lipgloss — Adaptive Color System
The
pkg/styles/theme.gofile implements a comprehensive adaptive color palette usinglipgloss.AdaptiveColor, automatically choosing between light- and dark-mode variants:Dark theme is Dracula-inspired; light theme uses higher-contrast, saturated variants. All styling is gated behind TTY detection via
applyStyle().The console package exposes a rich rendering API built on Lipgloss:
RenderTable(TableConfig)—lipgloss/tablewith alternating rows, headers, totalsRenderTitleBox(title, width)— double border, centered, boldRenderErrorBox(title)— rounded border in error colorRenderInfoSection(content)— left border in info colorRenderComposedSections([]string)—lipgloss.JoinVerticalUsage stats: 17 ×
console.RenderTable, 2 ×RenderTitleBox, 3 ×RenderErrorBox, 4 ×RenderInfoSectionHuh — Interactive Forms
Huh v0.8.0 is properly integrated for all interactive user input across 12 files:
pkg/console/confirm.goNewConfirmpkg/console/input.goNewInputwithEchoModePasswordpkg/cli/run_interactive.goNewSelect,NewInput,NewConfirmpkg/cli/add_interactive_engine.goNewSelectpkg/cli/add_interactive_schedule.goNewSelectpkg/cli/add_interactive_auth.goNewInputpkg/cli/add_interactive_orchestrator.goNewConfirmpkg/cli/add_interactive_git.gopkg/cli/add_interactive_workflow.gopkg/cli/engine_secrets.gopkg/cli/interactive.goAccessibility: All forms call
.WithAccessible(console.IsAccessibleMode()). TheIsAccessibleMode()function correctly checksACCESSIBLE,TERM=dumb, andNO_COLORenvironment variables.No plain
fmt.Scan*orbufio.Scannerprompts were found — all interactive input goes through Huh. ✅Console Formatter Usage
Function usage breakdown (1,248 total calls)
console.FormatInfoMessageconsole.FormatWarningMessageconsole.FormatSuccessMessageconsole.FormatVerboseMessageconsole.FormatErrorMessageconsole.FormatSectionHeaderconsole.RenderTableconsole.FormatCommandMessageconsole.FormatFileSizeconsole.FormatProgressMessageconsole.FormatErrorWithSuggestionsconsole.RenderStructFormatListItem,RenderErrorBox, etc.)Issues: Unformatted
stderrOutput~54 files write directly to
os.Stderrwithout console formatters. All diagnostic messages—not data output—should use the appropriateconsole.Format*wrapper for visual consistency.Priority files to fix
pkg/cli/copilot_setup.go— 12 raw stderr callspkg/cli/mcp_list_tools.go— 4 raw stderr callspkg/cli/gateway_logs.go— Manual ASCII table rendering (20+ lines)This file builds tables manually using Unicode box-drawing characters and
fmt.Fprintfcolumn alignment. The output is written to astrings.Builder(not directly to stderr), then likely displayed later. This is a candidate forconsole.RenderTable(TableConfig{...})if the output is user-facing, or can remain as-is if it's a formatted data export.Files with raw stderr (complete list, 54 files)
actionlint.go,add_command.go,add_interactive_auth.go,add_interactive_engine.go,add_interactive_git.go,add_interactive_orchestrator.go,add_interactive_schedule.go,add_interactive_secrets.go,add_interactive_workflow.go,audit.go,audit_report_render.go,compile_helpers.go,compile_stats.go,compile_watch.go,copilot_agents.go,copilot_setup.go,deps_outdated.go,deps_report.go,deps_security.go,devcontainer.go,domains_command.go,enable.go,engine_secrets.go,fix_command.go,gateway_logs.go,health_command.go,init.go,interactive.go,list_workflows_command.go,logs_orchestrator.go,logs_report.go,mcp_config_file.go,mcp_inspect.go,mcp_inspect_inspector.go,mcp_inspect_list.go,mcp_inspect_mcp.go,mcp_list.go,mcp_list_tools.go,pr_command.go,preconditions.go,remove_command.go,run_interactive.go,run_push.go,run_workflow_execution.go,secret_set_command.go,shell_completion.go,tokens_bootstrap.go,trial_command.go,trial_repository.go,update_actions.go,update_check.go,update_display.go,upgrade_command.go,vscode_config.goJustified Patterns (No Action Needed)
pkg/logger/logger.gopkg/console/terminal.goClearScreen()/ClearLine()require raw ANSIpkg/stringutil/ansi.gofmt.Println(jsonBytes)to stdouthealth_command.go,status_command.go, etc.fmt.Println(hash)to stdouthash_command.gofmt.Println(mermaidGraph)to stdouttool_graph.goRecommendations
🟡 Medium — Wrap unformatted
os.Stderrwrites (54 files)Replace bare
fmt.Fprintf(os.Stderr, "message\n")withfmt.Fprintln(os.Stderr, console.FormatInfoMessage("message"))(or the appropriate formatter). Focus first on user-visible commands:copilot setup,mcp list-tools, andgateway_logs.🟢 Low —
gateway_logs.gomanual table →console.RenderTableThe manual Unicode box-drawing table (~40 lines) in
gateway_logs.gocould be replaced withconsole.RenderTable(TableConfig{...})to gain adaptive colors, TTY-aware rendering, and consistent border styling.🟢 Low —
FormatListItemandFormatPromptMessageunderusedFormatListItem(used only 2× in cli/) andFormatPromptMessage(used 1×) are available but underutilized. Audit spots withfmt.Fprintf(os.Stderr, " - %s\n", item)andfmt.Fprintf(os.Stderr, "\nSelect ...\n")patterns.References:
Beta Was this translation helpful? Give feedback.
All reactions