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
{{ message }}
Repository navigation
[terminal-stylist] Console output consistency analysis for pkg/ (Go)
#77398
Scope: 1,766 non-test Go files under pkg/ (*_test.go and testdata/ excluded). Serena was activated for gh-aw, and the key call sites were confirmed with Serena reference lookups.
The console layer is in good shape. Styling is centralized, TTY-aware, NO_COLOR-aware, and destination-aware (stdout vs stderr). Huh forms always go through the console.New*Form wrappers, so theme and accessibility apply everywhere. Most issues come from call sites that bypass these helpers.
Metric
Value
Files importing pkg/console
293 of 1,766
Bare fmt.Print* (no writer) in production code
0
Raw fmt.Fprint*(os.Stderr/os.Stdout, ...) call sites
RenderTableStdout with TTYFunc set skips colorwriter.Degrade
console.go (RenderTableStdout, renderTableWithTTY); no production caller sets TTYFunc
9
Design
NO_COLOR and TERM=dumb also enable accessibility mode
accessibility.go 16-18; this disables spinners and switches huh forms to accessible prompts
Details: examples for findings 1, 2, and 4
Finding 1: a ✅ passed to console.PrintSuccessMessage in mcp_inspect_mcp.go prints ✓ ✅ Successfully connected to MCP server. A ✓ passed to console.FormatInfoMessage prints i ✓ uv package validated. A ✗ passed to console.FormatWarningMessage prints ⚠ ✗ <name>.
Finding 2: RenderErrorBox returns ANSI-styled lines when stderr is a TTY. Callers write them with fmt.Fprintln(os.Stderr, line). RenderComposedSections writes through stderrWriter(), which is the color-profile-aware path.
Finding 4 call sites: mcp_registry.go:125, run.go:53,55,100,102, run_workflow_tracking.go:151,172, workflows.go:175,177, interactive.go:777, logs_download.go:235, status_command.go:585. StopWithMessage writes its argument verbatim, so the checkmark never gets the success style that FormatSuccessMessage applies.
Recommended next actions
Fix the double markers: remove the hand-typed glyph from the string, or use the matching helper (FormatSuccessMessage for success lines). Low risk.
Route RenderErrorBox, RenderTitleBox, and RenderInfoSection output through stderrWriter() (or RenderComposedSections), or have the box helpers degrade with colorwriter.Degrade.
Add a success-completion helper for spinners and migrate the 12 StopWithMessage call sites.
Replace literal **Label:** output with styled labels or a key/value table in mcp_inspect_mcp.go and audit_diff_render.go.
Route the verbose warnings in cache_steps.go and push_to_pull_request_branch.go through formatCompilerMessage.
Add a lint (or extend consolestderr) that flags hand-typed glyphs as the first argument of console.* calls and StopWithMessage. This keeps the double-marker class from coming back.
Maintainer decision: keep NO_COLOR implying accessible mode (documented today), or split out a separate color check so NO_COLOR no longer disables spinners.
What already works (keep)
One adaptive palette in pkg/styles/theme.go with light and dark variants.
Destination-aware formatters, checked by the consolestderr linter.
TTY gating on interactive flows, with text-prompt fallbacks (interactive.go, run_interactive.go).
Hardcoded ANSI is limited to documented cursor and screen control (terminal.go, prompt_form.go).
No bare fmt.Print* calls in production code.
Method and limits
Static analysis only: grep counts plus Serena reference lookups. Terminal output was not captured at runtime, so findings 2 and 8 come from reading the code paths and have not been reproduced. Test files and testdata/ were excluded. No files were changed.
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.
Overview
Scope: 1,766 non-test Go files under
pkg/(*_test.goandtestdata/excluded). Serena was activated forgh-aw, and the key call sites were confirmed with Serena reference lookups.The console layer is in good shape. Styling is centralized, TTY-aware, NO_COLOR-aware, and destination-aware (stdout vs stderr). Huh forms always go through the
console.New*Formwrappers, so theme and accessibility apply everywhere. Most issues come from call sites that bypass these helpers.pkg/consolefmt.Print*(no writer) in production codefmt.Fprint*(os.Stderr/os.Stdout, ...)call sitesconsole.orstyles.tokenpkg/styles/theme.go)consolestderrlinternolintexemptionsFindings (ranked)
mcp_inspect_mcp.go90, 673;pip_validation.go110, 268;npm_validation.go102;agent_validation.go449;mcp_validation.go171;generate_action_metadata_command.go75console.go525 (RenderErrorBox);deps_security.go96-98;mcp_inspect_mcp.go68-82**Label:**printed to the terminalmcp_inspect_mcp.go523-555;audit_diff_render.go(20 raw lines across the 2 files)StopWithMessagecallscache_steps.go24;push_to_pull_request_branch.go128;run_workflow_execution.go297, 391, 475;preconditions.goaudit_cross_run_render.go(37 raw writes,%-30scolumns); 4 hand-rolledstrings.Repeatrules inpkg/climcp_inspect_mcp.go;deps_security.go(🔴);audit_expanded.go(✅ ❌RenderTableStdoutwithTTYFuncset skipscolorwriter.Degradeconsole.go(RenderTableStdout,renderTableWithTTY); no production caller setsTTYFuncNO_COLORandTERM=dumbalso enable accessibility modeaccessibility.go16-18; this disables spinners and switches huh forms to accessible promptsDetails: examples for findings 1, 2, and 4
✅passed toconsole.PrintSuccessMessageinmcp_inspect_mcp.goprints✓ ✅ Successfully connected to MCP server. A✓passed toconsole.FormatInfoMessageprintsi ✓ uv package validated. A✗passed toconsole.FormatWarningMessageprints⚠ ✗ <name>.RenderErrorBoxreturns ANSI-styled lines when stderr is a TTY. Callers write them withfmt.Fprintln(os.Stderr, line).RenderComposedSectionswrites throughstderrWriter(), which is the color-profile-aware path.mcp_registry.go:125,run.go:53,55,100,102,run_workflow_tracking.go:151,172,workflows.go:175,177,interactive.go:777,logs_download.go:235,status_command.go:585.StopWithMessagewrites its argument verbatim, so the checkmark never gets the success style thatFormatSuccessMessageapplies.Recommended next actions
FormatSuccessMessagefor success lines). Low risk.RenderErrorBox,RenderTitleBox, andRenderInfoSectionoutput throughstderrWriter()(orRenderComposedSections), or have the box helpers degrade withcolorwriter.Degrade.StopWithMessagecall sites.**Label:**output with styled labels or a key/value table inmcp_inspect_mcp.goandaudit_diff_render.go.cache_steps.goandpush_to_pull_request_branch.gothroughformatCompilerMessage.consolestderr) that flags hand-typed glyphs as the first argument ofconsole.*calls andStopWithMessage. This keeps the double-marker class from coming back.NO_COLORimplying accessible mode (documented today), or split out a separate color check soNO_COLORno longer disables spinners.What already works (keep)
pkg/styles/theme.gowith light and dark variants.consolestderrlinter.interactive.go,run_interactive.go).terminal.go,prompt_form.go).fmt.Print*calls in production code.Method and limits
Static analysis only: grep counts plus Serena reference lookups. Terminal output was not captured at runtime, so findings 2 and 8 come from reading the code paths and have not been reproduced. Test files and
testdata/were excluded. No files were changed.References: §43394908476
All reactions