[terminal-stylist] Terminal Stylist Report: Console Output Analysis #30803
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-05-08T09:34:00.039Z.
|
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 analyzes console output patterns across 764 Go source files in
pkg/. The codebase has a mature, well-structured approach to terminal output, centered on three pillars: apkg/consoleformatting package, Lipgloss v2 for styling, and Huh v2 for interactive forms. Overall consistency is high, with 1,624console.Format*calls and 194 files importing the console package. A handful of areas warrant attention.✅ What's Working Well
Console Formatting Package
The
pkg/consolepackage provides a comprehensive set of formatting helpers (FormatSuccessMessage,FormatErrorMessage,FormatInfoMessage,FormatWarningMessage, etc.) and is used across 194 source files with 1,624 calls. The package correctly routes all diagnostic output toos.Stderr(428fmt.Fprintf(os.Stderr,...)+ 1,854fmt.Fprintln(os.Stderr,...)calls), while structured data (JSON, hashes, graphs) goes toos.Stdout.Lipgloss v2 — Adaptive Colors
pkg/styles/theme.gousescompat.AdaptiveColor(light/dark pairs) for every semantic color (ColorError,ColorWarning,ColorSuccess,ColorInfo, etc.), ensuring correct rendering on both light and dark terminals. TTY detection is centralised inconsole.applyStyle(), which wraps all style rendering behindtty.IsStdoutTerminal()— ANSI codes are stripped automatically in pipes/redirects.Huh v2 — Interactive Forms
Huh is used consistently for all interactive prompts. The
pkg/consolepackage wrapshuh.NewForminto reusable helpers (ConfirmAction,SelectOption,InputText). The customstyles.HuhTheme(Dracula-inspired) maps all palette colors to focused/blurred/group styles, giving forms the same visual identity as other CLI output. All form wrappers correctly call.WithAccessible(IsAccessibleMode()).Structured Output to stdout
JSON output (
json.Encoderorfmt.Println(string(jsonBytes))), hash output (fmt.Println(hash)), Mermaid graph output (fmt.Println(mermaidGraph)), and console-rendered structs (fmt.Print(console.RenderStruct(...))) correctly go toos.Stdoutto support piping/redirection. This is intentional and correct.1. Markdown Report Rendering — Missing TTY Check
Files:
pkg/cli/audit_cross_run_render.go,pkg/cli/audit_diff_render.goBoth files render Markdown reports directly to
os.Stdoutusing rawfmt.Println/fmt.Printf. This is the correct destination for structured output, but the reports contain Markdown headings and tables that become noisy when piped or redirected.Recommendation: These are intentional Markdown report renderers (the callers pass
--format markdown), so the output destination is correct. However, a TTY check should be added for heading decorations — or a Lipglosstablerenderer could improve the experience in terminals:2.
compile_schedule_calendar.go— Inlinelipgloss.NewStyle()per CallFile:
pkg/cli/compile_schedule_calendar.goThe
intensityStyle()helper creates newlipgloss.Stylevalues on every call, which allocates unnecessarily:Recommendation: Declare styles as package-level
vars, similar topkg/styles/theme.go:3. Missing Accessibility Wrapping in
run_interactive.goFile:
pkg/cli/run_interactive.goHuh forms in
run_interactive.goshould consistently pass.WithAccessible(console.IsAccessibleMode()). Confirm this pattern is applied uniformly — thepkg/consolewrappers do this correctly, but directhuh.NewFormcalls in CLI commands may not.Recommendation: Audit every direct
huh.NewForm(...)call outsidepkg/consoleto ensure.WithAccessible(console.IsAccessibleMode())and.WithTheme(styles.HuhTheme)are applied:Summary Table
console.Format*usagecompat.AdaptiveColorthroughoutconsole.applyStyle()lipgloss.NewStyle()compile_schedule_calendar.goRecommendations Priority
intensityStyle()incompile_schedule_calendar.goto use package-level style vars.huh.NewFormcalls in CLI commands for.WithAccessible()coverage.lipgloss/tablein audit Markdown renderers for richer terminal output when running interactively.References:
All reactions