[terminal-stylist] Terminal Stylist Audit: Console Output Analysis #24287
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #24473. |
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.
-
This audit analyzed 644 Go source files across
pkg/for console output patterns, covering Lipgloss styling, Huh form usage, and adherence to the console formatting guidelines.Executive Summary
charm.land/lipgloss/v2; full adaptive color systempkg/consoleisTTY()/tty.IsStderrTerminal()fmt.Fprintf(os.Stderr, ...)audit_cross_run_render.gohas no rich terminal pathLipgloss Usage Analysis
✅ Strengths
pkg/styles/theme.gois a well-structured centralized style registry:compat.AdaptiveColorwith explicitLight/Darkhex values (Dracula-inspired dark palette)Error,Warning,Success,Info,Command,Progress,Prompt,Verbose,Table*,Tree*,ServerName,HeaderRoundedBorder,NormalBorder,ThickBorder) available for consistencypkg/console/console.goimplements best-practice Lipgloss patterns:applyStyle()correctly gates all styling behindisTTY()— no ANSI leaks into pipesRenderTable()useslipgloss/tablewith zebra-striping, header separation, and border stylingRenderTitleBox()/RenderErrorBox()/RenderInfoSection()provide composable terminal widgets with TTY fallbacksRenderComposedSections()useslipgloss.JoinVerticalfor proper vertical layout compositionpkg/console/banner.gocleanly useslipgloss.NewStyle()with//go:embedfor the ASCII logo.audit_cross_run_render.go — Markdown-only report (no rich terminal path)
pkg/cli/audit_cross_run_render.go(356 lines, ~111fmt.Print*calls) emits raw Markdown to stdout — correct per the project's output routing convention. However, there is no TTY-branched rendering path for terminal users:Similar pattern exists in
audit_report_render.go(234 fmt calls).mcp_inspect_inspector.go — Inconsistent MCP server detail formatting
Most lines in this file use
console.FormatInfoMessage/console.FormatWarningMessagecorrectly, but the "configuration details" block mixes raw formatting with the console package:The hardcoded
📡should useconsole.FormatCommandMessageorconsole.FormatInfoMessagewithstyles.ServerNamefor the server name.compile_watch.go — Partially formatted watch mode messages
These should use
console.FormatInfoMessage/console.FormatProgressMessage.devcontainer.go — Path messages lack FormatLocationMessage
The wasm stub defines
FormatLocationMessage(📁) but it is absent from the non-wasmconsole.go. Either addFormatLocationMessagetoconsole.goand use it here, or useconsole.FormatSuccessMessage.Huh Usage Analysis
✅ Strengths
pkg/styles/huh_theme.goprovides a customHuhTheme()function that maps the Dracula-inspired palette to all Huh field states (focused, blurred, group). Notably:lipgloss.AdaptiveColorfor all colors — fully light/dark adaptivegithub.com/charmbracelet/lipgloss(v1) to match Huh's own dependency, while the rest of the codebase usescharm.land/lipgloss/v2— this dual-import is documented with a comment and is the correct approachTitle,Description,ErrorIndicator,SelectSelector,Option,TextInput,FocusedButton,BlurredButtonCentralized Huh wrappers in
pkg/console/:ConfirmAction()— useshuh.NewConfirmwith theme + accessibilityPromptSecretInput()— useshuh.EchoModePasswordwith TTY guard and validationShowInteractiveList()— useshuh.NewSelectwith TTY guard and non-TTY text fallbackAll three follow the same pattern:
Direct
huhusage inpkg/cli/(9 files) also consistently applies.WithTheme(styles.HuhTheme()).terminal.go — ShowWelcomeBanner lacks styling
Could use
applyStyle(styles.Header, "🚀 Welcome to GitHub Agentic Workflows!")or integrateconsole.FormatBanner().observability_insights.go — Manual insight rendering
The insights rendering loop (lines 340–345) uses raw
fmt.Fprintf(os.Stderr, ...)with manual icon selection. TheRenderStructreflection system or a dedicated insights table viaconsole.RenderTable()would be more consistent.ANSI Escape Code Analysis
pkg/console/terminal.go\033[H\033[2J(clear screen),\033[K(clear line)pkg/logger/logger.goDEBUG_COLORS=0disables itNo inappropriate ANSI escape sequences found in user-facing CLI output paths.
Architecture Strengths Worth Preserving
applyStyle()pattern — The single function inconsole.gothat gates all Lipgloss styling behind TTY detection is clean and consistent. All new formatting functions should follow this pattern.pkg/stylesas single source of truth — Color constants and pre-built styles are centralized, making brand updates a one-file change.Wasm build parity —
console_wasm.goprovides stub equivalents for all console functions. However,FormatLocationMessageandFormatCountMessageexist in the wasm stub but are missing fromconsole.go(non-wasm). Since no non-wasm callers exist today, this is low risk, but the API surface should be consistent.Huh theme centralization — Every interactive form goes through
styles.HuhTheme(), ensuring visual consistency without repetition.Recommendations Summary
audit_cross_run_render.goconsole.RenderTable()for terminal usersaudit_report_render.gomcp_inspect_inspector.gofmt.Fprintfconfig detail block with console formatterscompile_watch.goFormatProgressMessage/FormatInfoMessagedevcontainer.goFormatSuccessMessagefor path update messagesterminal.gostyles.Headerstyle toShowWelcomeBannertextconsole.goFormatLocationMessageandFormatCountMessageto match wasm stub API parityReferences: §23945280781
Beta Was this translation helpful? Give feedback.
All reactions