Terminal Stylist Audit: Console Output Consistency Analysis #23542
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #23683. |
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 report covers all non-test Go source files in
pkg/andcmd/— scanning for console output patterns, Lipgloss styling, and Huh form usage. Run triggered by workflow §23743626795.Summary
The codebase is in strong shape for terminal output consistency. The
pkg/consolepackage is comprehensive and widely adopted, with 1,319 uses of console formatting functions. Lipgloss and Huh are properly integrated with TTY detection and adaptive colors. A small number of files bypass console formatting for stderr writes — detailed below.applyStyle())compat.AdaptiveColorinpkg/stylesWithTheme+WithAccessibleLipgloss Usage
Library:
charm.land/lipgloss/v2(current major version) withcharm.land/lipgloss/v2/table.Strengths:
applyStyle()inpkg/console/console.gowraps all styling with a TTY gate — ANSI codes are suppressed when output is pipedcompat.AdaptiveColor{Light: ..., Dark: ...}used throughoutpkg/styles/theme.gofor full light/dark terminal supportRenderTitleBox,RenderErrorBox,RenderInfoSection,RenderComposedSections,RenderTable,FormatError(Rust-like compiler errors with source context)Known version split (by design):
pkg/styles/huh_theme.gomust importgithub.com/charmbracelet/lipgloss(v1) becausecharmbracelet/huhdepends on v1. This is correctly documented in the file and is not a bug — it's a transitional state untilhuhupgrades to v2.Huh Form Usage
16 form instances found across 9 files. All are consistent:
styles.HuhTheme()maps the Dracula-inspired CLI palette to huh field styles (focus, blur, buttons, inputs, selects)console.IsAccessibleMode()respects theGH_ACCESSIBLEenvironment variablepkg/console/input.gocorrectly rejects non-TTY environments before showing interactive promptsConfirm,Select[string],Input(plain + password-masked), multi-group formsFiles:
add_interactive_auth.go,add_interactive_engine.go,add_interactive_git.go,add_interactive_orchestrator.go,add_interactive_schedule.go,add_interactive_workflow.go,engine_secrets.go,interactive.go,run_interactive.goUnformatted Stderr Writes (Improvement Opportunities)
The following files write to
os.Stderrdirectly without going through console formatting helpers. These are non-critical but inconsistent with the rest of the codebase.pkg/cli/compile_watch.go — 5 raw writes
Adjacent lines already use
console.FormatInfoMessageandconsole.FormatProgressMessage. These should be consistent:pkg/cli/mcp_inspect_inspector.go — 8 raw writes
console.FormatListItem()exists precisely for the bullet-point pattern:The configuration details block could be rendered with
console.RenderInfoSection()for visual consistency.pkg/cli/observability_insights.go — 4 raw writes
This builds its own icon+title+category layout that bypasses console formatting entirely. A structured approach using
console.FormatSectionHeaderandconsole.FormatListItemwould be more consistent.pkg/cli/devcontainer.go — 2 raw writes
These are success messages that should use
console.FormatSuccessMessage:pkg/cli/deps_report.go — 8 raw writes
Lines 112–163 mix console-formatted and raw stderr writes within the same render functions. The raw writes output numeric summary lines like
"Total dependencies: %d (%d direct, %d indirect)\n"— these could useconsole.FormatInfoMessageor theRenderTablehelper for tabular summary data.pkg/cli/update_display.go — 1 raw write
Should use
console.FormatListItem(failure.Name + ": " + failure.Error)to match the list items rendered for successes on line 18.pkg/cli/add_interactive_auth.go — 1 raw write
Should use
console.FormatInfoMessageorconsole.FormatWarningMessage.Stdout Output (Correct Patterns)
The following files use
fmt.Println/fmt.Printfto stdout — all are intentionally outputting structured/piped data:audit_cross_run_render.goaudit_diff_render.gochecks_command.go:413compile_pipeline.go,deps_report.godomains_command.go,health_command.gohash_command.golist_workflows_command.gorun_workflow_execution.go,status_command.gotool_graph.gotrial_command.goRecommendations
compile_watch.go— the surrounding code already uses console formatting and the inconsistency is visually noticeable when watching filesmcp_inspect_inspector.goconfig display usingRenderInfoSectionfor the detailed server blockdevcontainer.go,update_display.go, andadd_interactive_auth.goare each 1–2 line fixesobservability_insights.gohas a custom multi-line layout that doesn't map cleanly to a single console helper — consider a newconsole.RenderInsight(icon, title, category, summary, evidence string)helper if this pattern repeatsNo architectural changes are needed. The Lipgloss and Huh integration is excellent and the console package is a well-designed abstraction.
References: §23743626795
Beta Was this translation helpful? Give feedback.
All reactions