[terminal-stylist] Terminal Stylist Analysis: Console Output Patterns in pkg/ #42450
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-07-01T10:02:12.739Z.
|
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 analyzes console output patterns across 983 Go source files in
pkg/(excluding test files), focusing onfmt.Print*usage, Lipgloss styling, and Huh interactive form implementations.Key Metrics
console.Format*/console.Render*calls inpkg/clifmt.Fprintf(os.Stderr)without console wrapperhuh.NewFormcallsWithTheme+WithAccessible✅ What's Working Well
Lipgloss: Excellent adaptive color system
pkg/styles/theme.goimplements a well-designed adaptive color system:adaptiveColortype satisfiescolor.Color, auto-selecting light/dark based on terminal detectionlipgloss.HasDarkBackgroundprobe on Windows to avoidSTATUS_DLL_INIT_FAILED/hang under ConPTYColorError,ColorWarning,ColorSuccess,ColorInfo,ColorPurple,ColorYellow,ColorComment,ColorForeground,ColorBackground,ColorBorder,ColorTableAltRowError,Warning,Success,Info,FilePath,LineNumber,ContextLine,Highlight,Command,Progress,Prompt,Verbose,Header,TableHeader,TableCell,TableTotal,TableTitle,TableBorder,TreeEnumerator,TreeNode, plus schedule-calendar intensity stylesRoundedBorder(primary),NormalBorder(subtle),ThickBorder(reserved)Huh: 100% theme/accessibility coverage
All 20
huh.NewFormcalls across 12 files consistently apply:The
styles.HuhThemeis ahuh.ThemeFuncthat maps the Dracula palette to every huh field variant: focused/blurred states, text inputs, selects, multi-selects, confirms, buttons, and navigation indicators.console.IsAccessibleMode()checks theACCESSIBLEenv var for screen-reader support.Files covered:
console/input.go,console/list.go,console/confirm.go,cli/add_interactive_auth.go,cli/add_interactive_git.go,cli/add_interactive_workflow.go,cli/add_interactive_orchestrator.go,cli/add_interactive_engine.go,cli/add_interactive_schedule.go,cli/run_interactive.go,cli/engine_secrets.go,cli/interactive.goTTY detection: Consistent and correct
console.applyStyle/console.applyStyleWithTTYwrap every lipgloss render call with a TTY check — ANSI codes are stripped in pipes/redirectsRenderTitleBox,RenderErrorBox,RenderInfoSectioneach have graceful non-TTY text fallbacksRenderTableaccepts aTTYFuncoverride for tables written to stderr vs stdoutNewSpinnercheckstty.IsStderrTerminal()andIsAccessibleMode()before enabling animationtea.WithInput(nil)to avoid consuming keyboard input from subsequent huh formsconsole package: Well-documented naming convention
pkg/console/doc.godocuments a clearFormat*vsRender*convention:Format*: pure string transformations for a single message typeRender*: multi-element/structured output — tables, boxes, trees, structsFormatErrorChaindeserves special mention: it walks theerrors.Unwrapchain, strips the inner-error suffix from each level's message, and renders a visually nested chain with consistent indentation.Lipgloss/tree used correctly in cli layer
The four
pkg/clifiles that import lipgloss directly all use it appropriately:compile_schedule_calendar.go:intensityStyle()returns a pre-definedstyles.ScheduleCalendar*stylemcp_inspect.go:lipgloss/treewithstyles.TreeEnumerator+styles.TreeNodestatus_command.go:lipgloss/treefor workflow dependency tree with same style tokensgateway_logs_timeline_render.go: lipgloss for timeline displayIssue 1: Inconsistent sub-step indentation in trial_confirmation.go
File:
pkg/cli/trial_confirmation.go(lines 182–183, 199–200)Sub-step items
a.andb.are printed with barefmt.Fprintfwhile surrounding numbered steps useconsole.FormatInfoMessage:Issue 2: Hardcoded [hint] prefix in logs_orchestrator.go
File:
pkg/cli/logs_orchestrator.go(line 872)The
consolepackage already formats hints inFormatErrorusingstyles.Infostyling. Aconsole.FormatHintMessagehelper would unify this pattern.Recommendation: Add
FormatHintMessage(string) stringto the console package (usingstyles.Infowith a"hint: "prefix) and replace this raw format call.Issue 3: Hardcoded separator lines without TTY guard
File:
pkg/cli/add_interactive_orchestrator.go(lines 326, 328)Compare with
trial_confirmation.go:221which wraps the separator inconsole.FormatInfoMessagefor at least some styling, though still hardcodes the string.Recommendation: Use
console.RenderTitleBoxor a dedicatedconsole.RenderSeparator()helper that respects TTY detection.Issue 4: Bare fmt.Fprintf in org_runner.go, mcp_list_tools.go, remove_command.go
Several files emit plain text to stderr without console formatters:
pkg/cli/org_runner.go(lines 87–103): Repository/workflow preview list itemspkg/cli/mcp_list_tools.go(lines 77–79, 134–136): Server availability messagespkg/cli/remove_command.go(lines 58–60, 104–106): Workflow/file listing — could useconsole.RenderTablefor aligned multi-column display.Issue 5 (low priority): Markdown table output without TTY detection
Files:
pkg/cli/audit_diff_render.go,pkg/cli/audit_cross_run_render.goThese files emit hardcoded markdown table borders (
|--------|) to stdout — intentional for downstream markdown consumption (e.g., GitHub comment formatting). However, there is no TTY detection, so raw markdown appears in interactive terminal sessions.Recommendation: Detect stdout TTY and switch between
console.RenderTable(terminal) and markdown format (pipe).Issue 6 (low priority): update_container_pins.go and experiments_command.go
pkg/cli/update_container_pins.go(lines 160–185, 344): Uses barefmt.Fprintln(os.Stderr, "")for blank lines andfmt.Fprintf(os.Stderr, " %s: %s\n", f.image, f.reason)for image/status pairs.console.RenderTablewould give aligned, styled output.pkg/cli/experiments_command.go(lines 765–766, 807): Uses barefmt.Fprintf(os.Stderr, " Branch: %s\n", ...).console.RenderStructwith appropriate struct tags would give consistent rendering.Recommendations Summary
fmt.Fprintfwithconsole.FormatInfoMessagecli/trial_confirmation.goconsole.FormatHintMessage(), replace[hint]raw formatcli/logs_orchestrator.go,console/console.go━━━separators with TTY-aware helpercli/add_interactive_orchestrator.go,cli/trial_confirmation.goconsole.FormatListItem/FormatInfoMessageconsistentlycli/org_runner.go,cli/mcp_list_tools.go,cli/remove_command.goconsole.RenderTablefor aligned outputcli/update_container_pins.go,cli/experiments_command.gocli/audit_diff_render.go,cli/audit_cross_run_render.goReferences:
Beta Was this translation helpful? Give feedback.
All reactions