Repository navigation
[terminal-stylist] Terminal Stylist: console output review of pkg/ (Go, non-test) #79480
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #79768. |
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
Scope: 2,039 non-
_test.goGo files underpkg/(includes some testdata fixtures; raw-write counts exclude testdata). Serena (Go) was active. The console layer is mature: stdout/stderr routing is consistent, theme colors are adaptive, and every huh form goes through a themed, accessibility-aware wrapper. The gaps are a few wrong-formatter calls, mixed warning glyphs, and hand-padded tables.Key metrics
os.Stdout/os.Stderr(fmt.Fprint*/Print*)console.*call linesfmt.Print*(no writer) in production codestyles.*.Renderoutsidepkg/consoleandpkg/stylesFindings
1. Wrong formatter for the message type (highest priority)
FormatInfoMessageprefixesi. Success text wrapped in it renders asi ✓ npm package validated: .... Sites:pkg/workflow/npm_validation.go:102,pkg/workflow/pip_validation.go:110and:268,pkg/workflow/agent_validation.go:449.pkg/cli/mcp_validation.go:171wraps an error-glyph list item inFormatWarningMessage, rendering⚠ ✗ NAME.pkg/cli/deps_report.go:104-149prints decorative rules throughFormatInfoMessage(i ═══...) with hardcoded widths from 7 to 39 characters.2. Mixed warning glyphs
pkg/cli/deps_report.go:124,:152,:177.3. Hand-padded tables and rules bypass the table renderer
%-Nslines in five files:pkg/cli/audit_cross_run_render.go:358,:387,:434;pkg/cli/audit_cross_run_clusters_render.go:82;pkg/cli/remove_command.go:58;pkg/cli/experiments_analyze_statistics.go:805,:816,:820,:827. Hardcodedstrings.Repeatrules atexperiments_analyze_statistics.go:806and:821.pkg/consolealready wrapslipgloss/v2/table(RenderTable,RenderTableStdout).4. Raw ANSI control sequences in
pkg/consolepkg/console/terminal.go:17,:20,:35;pkg/console/prompt_form.go:18-20,:93. The behavior is gated and correct, but the sequences are hand-written.charmbracelet/x/ansiis already a direct dependency (imported bypkg/console/table_width.goandpkg/cli/org_rollout_tui.go).5. Hand-rolled ANSI stripping
pkg/stringutil/ansi.goStripANSI(14 callers) is a custom CSI/OSC state machine that may duplicatex/ansi.Strip.6. NO_COLOR also enables accessible mode
pkg/console/accessibility.goIsAccessibleMode()returns true forACCESSIBLE,TERM=dumb, orNO_COLOR. As a result, huh forms switch to accessible mode (prompt_form.go:36) and spinners are disabled (spinner.go:144-145). NO_COLOR only asks for no color, so the coupling should be confirmed as intended.Strengths
pkg/linters/consolestderr.pkg/styles/theme.godefines 11 light/dark pairs andhuh_theme.gouseslipgloss.LightDark. Windows skips the background probe, with a documented reason.colorwriter.DegradehonorsNO_COLOR,COLORTERM, andTERM.console.NewForm,NewInputForm,NewSelectForm, andNewConfirmForm, so theme and accessibility are applied.PromptFormrefuses non-TTY stdin or stderr, andIsCancelledwrapshuh.ErrUserAborted.work_command_tui.gochecks stdin and stdout TTY. The org rollout TUI is gated inorg_rollout_flags.go:82(stdin and stderr TTY, not CI).Recommended next actions
Format*Messagearguments.pkg/consoleand replace the hardcoded rules.console.RenderTable.StripANSIontox/ansi.Not verified in this run
x/ansiidentifiers:go docfailed because the module proxy was unreachable from the sandbox.pkg/styles/theme.goinit()runslipgloss.HasDarkBackgroundon every non-Windows invocation. Worth measuring for non-interactive commands.References: §44704231626
All reactions