Terminal Stylist: Console Output Analysis Report #21868
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #22035. |
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 audits console output patterns across 595 non-test Go source files in
pkg/andcmd/, covering usage of the console formatting package, Lipgloss (v2), and Huh interactive forms. The codebase demonstrates strong consistency and thoughtful design — diagnostic output reliably goes to stderr, structured data goes to stdout, and Charmbracelet ecosystem libraries are well-integrated. A few minor gaps are identified below.Summary
console.Format*usagesfmt.Fprintf(os.Stderr, …)callsfmt.Printlnto stdoutpkg/console/,pkg/styles/Console Package Architecture
The
pkg/console/package is the central styling hub. It exports a rich set of formatting functions with consistent emoji prefixes and TTY-aware styling:FormatInfoMessageFormatWarningMessageFormatSuccessMessageFormatVerboseMessageFormatErrorMessageFormatSectionHeaderFormatCommandMessageFormatErrorFormatErrorWithSuggestionsFormatProgressMessageFormatListItemFormatPromptMessageThe
applyStyle()helper unconditionally gates all styling behindisTTY()— no ANSI codes bleed into non-terminal output. This is excellent practice.Lipgloss Usage Analysis
✅ Strengths
Adaptive colors throughout:
pkg/styles/theme.godefines a complete palette usingcompat.AdaptiveColor(light/dark variants), covering Error, Warning, Success, Info, Purple, Yellow, and structural colors. These automatically adapt to the terminal background.TTY-aware rendering:
console.gochecksisTTY()ortty.IsStderrTerminal()before all rich rendering —RenderTitleBox,RenderErrorBox,RenderInfoSection, andRenderComposedSectionsall fall back to plain text gracefully.Rich layout primitives: The console package uses
lipgloss.JoinVertical, double-border boxes, rounded-border boxes, and left-border info sections — all with proper TTY guards.**lipgloss/table for tabular (redacted)
RenderTableuses thecharm.land/lipgloss/v2/tablepackage with alternating row colors, a styled header row, and an optional total row.1. Two lipgloss versions coexist (
pkg/styles/huh_theme.go):pkg/styles/huh_theme.goimportsgithub.com/charmbracelet/lipgloss(v1) while the rest of the codebase usescharm.land/lipgloss/v2. This is intentional and necessary —github.com/charmbracelet/huhv0.8.0 depends on the v1 import path. The theme file bridges the two by mappingcharm.landhex constants to v1lipgloss.AdaptiveColorvalues. The types are incompatible across versions, so this separation is the correct approach.2. Hardcoded hex colors in
pkg/console/progress.go:The progress bar uses hardcoded color literals instead of the theme constants:
These hex values match
hexColorPurpleDark,hexColorInfoDark, andhexColorCommentDarkdefined inpkg/styles/theme.go, but bypass the adaptive system. In light-mode terminals the progress bar will render with dark-theme colors. Consider referencing the theme constants for consistency, or usingstyles.ColorPurple/styles.ColorInfowhencharm.land/bubblessupports adaptive colors.Huh Interactive Forms Analysis
✅ Strengths
Consistent form structure across all 12 files:
Every form follows the same pattern:
Custom theme integration:
pkg/styles/huh_theme.gomaps the Dracula-inspired palette to all huh field states — focused, blurred, options, buttons, and text inputs — giving forms the same visual identity as the rest of the CLI.Accessibility mode support:
console.IsAccessibleMode()detectsACCESSIBLE,TERM=dumb, orNO_COLORenvironment variables. All forms pass this to.WithAccessible(), enabling plain-text mode for screen readers and CI environments.Context-aware execution: Forms use
form.RunWithContext(c.Ctx)(not bareform.Run()), enabling proper Ctrl-C handling and cancellation propagation.Field types used: Input (with
EchoModePasswordfor secrets), Select, Confirm — appropriate choices for the workflow wizard UX.View: Huh form usage by file
pkg/cli/run_interactive.gopkg/cli/interactive.gopkg/cli/add_interactive_auth.gopkg/cli/add_interactive_engine.gopkg/cli/add_interactive_orchestrator.gopkg/cli/add_interactive_schedule.gopkg/cli/add_interactive_git.gopkg/cli/add_interactive_workflow.gopkg/cli/add_interactive_secrets.gopkg/cli/engine_secrets.gopkg/console/input.gopkg/console/confirm.go3.
pkg/cli/mcp_server_http.gouses standardlogpackage:This is the only file using the standard
logpackage. The rest of the codebase useslogger.New("pkg:file")(the project's debug logger), which respectsDEBUG=*environment variables and avoids cluttering normal output. The HTTP request/response logs will print to stdout unconditionally, which could be noisy in non-debug usage.Output Routing Compliance
All 20
fmt.Printlncalls to stdout are intentional structured output (JSON payloads, hashes, Mermaid graphs, state strings) — correct per the codebase's output routing convention. No diagnostic messages were found going to stdout.View: Stdout output locations (all correct)
health_command.gotrial_command.gotool_graph.gochecks_command.gostatus_command.golist_workflows_command.gohash_command.gocompile_orchestration.godeps_report.godomains_command.gorun_workflow_execution.gomcp_list_tools.gomcp_inspect_mcp.gologs_report.goRecommendations
pkg/console/progress.gouses hardcoded hex colorsstyles.ColorPurple,styles.ColorInfo,styles.ColorCommentwhen the bubbles library supports adaptive colors, or document the limitationpkg/cli/mcp_server_http.gouseslog.Printflogger.New("cli:mcp_server_http")and uselog.Printf(...)only underif log.Enabled()for debug-level HTTP tracingv1+v2)huh_theme.goisolation is the right approach; no action neededWhat the Codebase Does Well
pkg/console/IsAccessibleMode()consistently applied to every interactive formpkg/loggerfor debug output,pkg/consolefor user outputReferences: §23319713317
Beta Was this translation helpful? Give feedback.
All reactions