[terminal-stylist] Terminal Stylist: Console Output Consistency Analysis #49943
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-08-04T10:00:40.758Z.
|
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.
Terminal Stylist Analysis — Console Output Consistency
Scanned 1,179 non-test
.gofiles underpkg/. Console output is already highly centralized: 244 files usepkg/console, 6 uselipglossdirectly, 17 usehuh, and only 2 production files call rawfmt.Print*outside the console package.Key Findings
pkg/console(console.go, banner.go, spinner.go, list.go, confirm.go, input.go, prompt_form.go), which wraps Lipgloss styling with TTY/NO_COLOR/COLORTERM detection (applyStyleWithTTY,applyStdoutStyleWithTTY,applyStderrStyleWithTTY).pkg/styles/theme.godefines a customadaptiveColortype mirroringlipgloss.AdaptiveColor, wired tolipgloss.HasDarkBackgroundviaconfigureHasDarkBackground, with light/dark pairs for Error, Warning, Success, Info, Purple, Yellow, Comment, Foreground, Background, Border, and TableAltRow — good separation of concerns and testability (background detector is injectable).pkg/styles/huh_theme.go.Files with raw fmt.Print* (non-test, non-linter)
pkg/cli/status_command.gofmt.Print(console.RenderStruct(statuses))— acceptable: output is already styled byconsole.RenderStruct;fmt.Printis just the sink.pkg/cli/view_command.gofmt.Print(output)— same pattern,outputappears pre-rendered. Low risk but consider routing through aconsole.Print/console.Writewrapper for consistency and future TTY-aware behavior.Two additional
fmt.Print*hits are inpkg/linters/hardcodedfilepath/hardcodedfilepath.go(a linter analyzer, not user console output) and its testdata — not in scope for this report.Lipgloss usage details
pkg/console/console.go: table rendering (buildTableStyleFunc), borders (DoubleBorder,NormalBorder), alignment (lipgloss.Center,lipgloss.Left), vertical joins (lipgloss.JoinVertical) — all gated behind TTY checks before styling is applied, which correctly avoids leaking ANSI codes into pipes/redirects.pkg/console/banner.go: banner box styling.pkg/cli/compile_schedule_calendar.go: calendar rendering, isolated usage — good.pkg/logger/logger.go: namespace coloring for debug logs — appropriate use of Lipgloss for structured debug output.pkg/styles/theme.go/huh_theme.go: central style/theme registry consumed by the rest of the codebase — this is the right architecture (single source of truth for styling).No hardcoded ANSI escape sequences or manual color codes were found outside Lipgloss — a good sign of discipline.
Huh usage details
Forms are spread across well-scoped files by responsibility:
add_interactive_orchestrator.go,add_interactive_git.go,add_interactive_auth.go,add_interactive_workflow.go,add_interactive_schedule.go,add_interactive_engine.go,bootstrap_profile_github_app.go,bootstrap_profile_helpers.go,engine_secrets.go,run_interactive.go, and generic wrappers inpkg/console(spinner.go,list.go,confirm.go,input.go,prompt_form.go). This modular split (one concern per file) matches the repo's code-organization conventions and keeps forms testable.No obvious accessibility regressions were found in the sampled entry points;
pkg/consolewrappers appear to be the common interactive surface, so accessibility mode (if configured) benefits all callers uniformly.Recommendations
status_command.go:288andview_command.go:168through aconsolesink function (e.g., a thinconsole.Print/console.Write) instead of callingfmt.Printdirectly, purely for consistency/greppability — functionally they're already safe since content is pre-styled.go vet-style analyzer, consistent with existingpkg/linters/*) to flag any new rawfmt.Print*calls inpkg/clioutside the console package, to preserve this consistency going forward.All reactions