You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Analysis of all non-test Go source files in pkg/ and cmd/ for console output consistency. Overall, the codebase has a well-designed, centralized styling foundation (pkg/styles, pkg/console) and most CLI commands use it correctly. However, several files bypass the formatting system, creating inconsistent terminal output.
Total fmt.Print* calls (non-test): ~150
Properly formatted via console.*: ~100 ✅
Structured stdout output (JSON/hashes/graphs): ~20 ✅ (correct per guidelines)
Raw diagnostic output needing improvement: ~30 ⚠️
Architecture Overview
The styling system is well-structured:
pkg/styles/theme.go — Centralized Lipgloss v2 styles with adaptive colors (light/dark variants using Dracula-inspired dark palette and high-contrast light variants). Provides Error, Warning, Success, Info, FilePath, Progress, Command, Verbose, TableHeader, TableCell, and more.
Form fields used: huh.NewInput, huh.NewSelect, huh.NewMultiSelect, huh.NewConfirm, huh.NewText. Console wrappers (confirm.go, input.go, list.go) provide convenient building blocks.
Lipgloss — Properly Centralized
Zero direct lipgloss.* calls outside pkg/styles/ and pkg/console/. All lipgloss usage goes through the centralized style definitions, ensuring consistency. TTY detection is applied via applyStyle() which guards all styling.
⚠️ Areas Needing Improvement
1. Audit Report Renderers — Raw fmt.Printf to stdout
These files generate Markdown-formatted reports using dozens of raw fmt.Printf/fmt.Println calls to stdout. The markdown tables are formatted manually:
// ❌ Current — manual markdown table formattingfmt.Printf("| Metric | Value |\n")
fmt.Printf("|--------|-------|\n")
fmt.Printf("| Runs analyzed | %d |\n", report.RunsAnalyzed)
Recommendation: The table sections could be rendered using console.RenderTable when a TTY is detected, with fallback to the current markdown format for pipes/redirects. This would produce styled, aligned tables in interactive terminals. Alternatively, add a --markdown flag that explicitly requests raw markdown output.
These insight entries follow the same pattern as console formatters but don't benefit from TTY-aware styling or color coding based on severity.
Lipgloss Opportunities
Table Rendering in Audit Reports
The audit_cross_run_render.go and audit_diff_render.go files generate multiple markdown tables. The console.RenderTable function (backed by lipgloss/table) already exists and supports:
Zebra striping (alternating row colors)
Rounded borders
TTY-aware rendering (plain text fallback for pipes)
Adaptive colors
Using console.RenderTable for the summary/metrics tables would improve terminal readability while preserving pipe-safe markdown output via a fallback.
CountMessage Format Function
The pkg/styles package has a Count style (bold cyan) but pkg/console/console.go is missing a corresponding FormatCountMessage wrapper. Several files could use this for numeric statistics:
run_interactive.go:317 correctly uses .WithAccessible(console.IsAccessibleMode()), but add_interactive_auth.go:45 and add_interactive_workflow.go:104 do not set .WithAccessible(). All forms should include this option.
The manual fmt.Scanf fallback in run_interactive.go (lines 213-254) could be replaced with console.IsAccessibleMode() check plus a simpler console.ShowInteractiveList call, leveraging the accessible mode built into Huh forms.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Analysis of all non-test Go source files in
pkg/andcmd/for console output consistency. Overall, the codebase has a well-designed, centralized styling foundation (pkg/styles,pkg/console) and most CLI commands use it correctly. However, several files bypass the formatting system, creating inconsistent terminal output.fmt.Print*calls (non-test): ~150console.*: ~100 ✅Architecture Overview
The styling system is well-structured:
pkg/styles/theme.go— Centralized Lipgloss v2 styles with adaptive colors (light/dark variants using Dracula-inspired dark palette and high-contrast light variants). ProvidesError,Warning,Success,Info,FilePath,Progress,Command,Verbose,TableHeader,TableCell, and more.pkg/console/console.go— TTY-aware wrappers:FormatSuccessMessage,FormatErrorMessage,FormatInfoMessage,FormatWarningMessage,FormatProgressMessage,FormatCommandMessage,FormatVerboseMessage,FormatListItem,RenderTable(usinglipgloss/table).pkg/styles/huh_theme.go— CustomHuhThememapped to the Dracula palette for interactive forms.pkg/console/accessibility.go—IsAccessibleMode()detectsACCESSIBLE,TERM=dumb, orNO_COLOR.✅ What's Working Well
Console Formatting — Correct Usage
These files consistently use
console.Format*Message()withfmt.Fprintln(os.Stderr, ...):pkg/cli/logs_metrics.go— Extensive, correct use of Info/Warning/Success formatters (~40 calls)pkg/cli/compile_watch.go— All output via console formatterspkg/cli/tokens_bootstrap.go— All output via console formatterspkg/cli/run_workflow_validation.go— UsesFormatProgressMessage,FormatErrorWithSuggestionspkg/cli/compile_orchestrator.go— Correct warning messagesStructured Stdout Output — Correct Pattern
JSON, hashes, and graph output correctly goes to
stdout(piping-friendly):Huh Forms — Well Integrated
Interactive forms are properly set up with the custom theme and accessibility support:
Form fields used:
huh.NewInput,huh.NewSelect,huh.NewMultiSelect,huh.NewConfirm,huh.NewText. Console wrappers (confirm.go,input.go,list.go) provide convenient building blocks.Lipgloss — Properly Centralized
Zero direct
lipgloss.*calls outsidepkg/styles/andpkg/console/. All lipgloss usage goes through the centralized style definitions, ensuring consistency. TTY detection is applied viaapplyStyle()which guards all styling.1. Audit Report Renderers — Raw
fmt.Printfto stdoutFiles:
pkg/cli/audit_cross_run_render.go(~60 calls),pkg/cli/audit_diff_render.go(~50 calls)These files generate Markdown-formatted reports using dozens of raw
fmt.Printf/fmt.Printlncalls to stdout. The markdown tables are formatted manually:Recommendation: The table sections could be rendered using
console.RenderTablewhen a TTY is detected, with fallback to the current markdown format for pipes/redirects. This would produce styled, aligned tables in interactive terminals. Alternatively, add a--markdownflag that explicitly requests raw markdown output.2.
deps_report.go— Manual Emoji Icons Without Console FormattingFile:
pkg/cli/deps_report.go(~15 raw stderr calls)Uses manual emoji and raw
fmt.Fprintf(os.Stderr, ...)instead of console formatters:3.
mcp_inspect_inspector.go— Inconsistent Mixed UsageFile:
pkg/cli/mcp_inspect_inspector.go(~8 raw stderr calls)The same file uses
console.FormatInfoMessagein some places and rawfmt.Fprintf(os.Stderr, ...)in others:The MCP server details block (lines 158–173) should use console formatters or the
console.RenderTablefunction.4.
remove_command.go— List Items WithoutFormatListItemFile:
pkg/cli/remove_command.go(~6 calls)List items bypass
console.FormatListItem:5.
run_interactive.go— Manual Fallback Prompt Bypasses HuhFile:
pkg/cli/run_interactive.go(lines 213–217)A non-interactive fallback prompt uses raw
fmt.Fprintfto stderr when the form library isn't available:This code path should use
console.FormatPromptMessagefor the prompt andconsole.FormatListItemfor items.6.
devcontainer.go— Plain Messages Without FormattingFile:
pkg/cli/devcontainer.go(lines 165, 192)7.
observability_insights.go— Manual Icon/Format PatternFile:
pkg/cli/observability_insights.go(lines 340–343)These insight entries follow the same pattern as console formatters but don't benefit from TTY-aware styling or color coding based on severity.
Lipgloss Opportunities
Table Rendering in Audit Reports
The
audit_cross_run_render.goandaudit_diff_render.gofiles generate multiple markdown tables. Theconsole.RenderTablefunction (backed bylipgloss/table) already exists and supports:Using
console.RenderTablefor the summary/metrics tables would improve terminal readability while preserving pipe-safe markdown output via a fallback.CountMessageFormat FunctionThe
pkg/stylespackage has aCountstyle (bold cyan) butpkg/console/console.gois missing a correspondingFormatCountMessagewrapper. Several files could use this for numeric statistics:Huh Forms Recommendations
Accessible Mode Consistency
run_interactive.go:317correctly uses.WithAccessible(console.IsAccessibleMode()), butadd_interactive_auth.go:45andadd_interactive_workflow.go:104do not set.WithAccessible(). All forms should include this option.Non-Interactive Fallback
The manual
fmt.Scanffallback inrun_interactive.go(lines 213-254) could be replaced withconsole.IsAccessibleMode()check plus a simplerconsole.ShowInteractiveListcall, leveraging the accessible mode built into Huh forms.Priority Summary
deps_report.gomcp_inspect_inspector.goremove_command.goFormatListItemdevcontainer.goobservability_insights.gorun_interactive.go.WithAccessible()audit_cross_run_render.goRenderTableaudit_diff_render.goRenderTable.WithAccessible()on some formsReferences:
Beta Was this translation helpful? Give feedback.
All reactions