Terminal Stylist Audit: Console Output Patterns in gh-aw #23341
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #23442. |
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 report analyzes console output patterns across all Go source files in
pkg/, covering Lipgloss v2 usage, Huh form implementations, and console formatting consistency.Workflow Run: §23684561979
Summary
console.*formattingconsole.*formattingfmt.Fprintln/Fprintf(os.Stderr)callsconsole.*helpersRunWithContextLipgloss Usage Analysis
✅ Strengths
Architecture (
pkg/styles/): The codebase has an excellent centralized style system:compat.AdaptiveColor{Light, Dark}for every semantic color — properly handles both light and dark terminal themesError,Warning,Success,Info,Command,Progress,Prompt,Verbose,Count,FilePath, etc.) use adaptive colorscharm.land/lipgloss/v2used for core CLI,github.com/charmbracelet/lipgloss(v1) used inpkg/styles/huh_theme.goto match huh's dependency requirementsTTY Detection: The
applyStyle()helper inconsole.gocorrectly gates all Lipgloss rendering:Table Rendering:
RenderTable()inconsole.gousescharm.land/lipgloss/v2/tablewith proper zebra-striping viaColorTableAltRow, header styling, and border configuration.Layout Features Used:
lipgloss.JoinVertical()for composing multi-section displayslipgloss.DoubleBorder()for title boxeslipgloss.NormalBorder()for info section left-border emphasislipgloss.RoundedBorder()for error boxesCharmbracelet Ecosystem Integration:
charm.land/bubbles/v2/spinner— TTY-aware, accessible-mode disabledcharm.land/bubbles/v2/progress— Determinate/indeterminate with gradient blendcharm.land/bubbles/v2/list— Full Bubble Tea interactive list with keyboard nav1. Manual formatting in
audit_cross_run_render.goandaudit_diff_render.goThese files produce markdown-formatted table output using raw
fmt.Printfinstead of theRenderTable()helper. While intentional for piped/redirected output (the output is markdown text, not styled terminal output), the inconsistency is notable:2. Missing symmetric functions in
console.goThe WASM stub (
console_wasm.go) defines three functions absent fromconsole.go:FormatLocationMessage(message string)— for directory/file location messagesFormatCountMessage(message string)— for count/numeric statusFormatListHeader(header string)— for list section headersWhile
pkg/styles/theme.godefinesLocation,Count, andListHeaderstyles, the correspondingFormat*Message()helper functions are missing from the non-WASM build. This creates an API inconsistency between build targets and prevents these patterns from being used in non-WASM CLI code.3. Raw stderr calls bypassing console formatting (~477 occurrences)
The following files have diagnostic messages sent to stderr without using the console formatting helpers — missing the styled prefix icons and color coding:
pkg/cli/compile_watch.go(5 occurrences):pkg/cli/preconditions.go(~11 occurrences):pkg/cli/mcp_inspect_inspector.go(~7 occurrences — configuration detail lines):pkg/workflow/compiler_orchestrator_engine.go(2 occurrences):pkg/workflow/cache.go(2 occurrences):pkg/cli/compile_stats.go(6 occurrences):pkg/workflow/claude_logs.go(~5 occurrences — debug-level messages):Huh Form Analysis
✅ Strengths
Consistent theming across all 15 forms: Every form applies the custom Dracula-inspired theme:
Accessibility mode: All forms check
console.IsAccessibleMode(), which correctly detectsACCESSIBLE,TERM=dumb, andNO_COLORenvironment variables — excellent screen reader support.Context propagation: 13/15 forms use
RunWithContext(ctx)instead ofRun()for proper cancellation support. The 2 exceptions (confirm.go,input.go) are utility helpers that don't have a context parameter, which is acceptable.Theme implementation (
pkg/styles/huh_theme.go): Well-structured mapping of the codebase palette to huh's field styles, covering:Field types in use:
NewInput— secret entry with EchoModePassword (masking), validationNewSelect— engine selection with descriptive labelsNewMultiSelect— tool selectionNewConfirm— PR merge confirmationNewText— multi-line intent/prompt input1. No Description fields on most Select forms
Most
NewSelectforms omit the.Description()call, which provides helpful context below the title:2. `huh.NewNote` not used for informational display
Several places output raw
fmt.Fprintln(os.Stderr, ...)text before or after forms. These could usehuh.NewNote()fields within the form group for more cohesive UI:3. Validation inconsistency
pkg/console/input.goimplements field validation but manyNewInputusages inpkg/cli/do not validate input:Console Package Architecture Assessment
The
pkg/console/package is well-designed with clear separation of concerns:console.gobanner.gospinner.goprogress.golist.goconfirm.goinput.goaccessibility.goverbose.gorender.goformat.goMinor gap:
FormatLocationMessage,FormatCountMessage, andFormatListHeaderare defined in the WASM stub but absent fromconsole.go. While no code currently calls them from non-WASM builds, adding them would complete the API symmetry and enable new usage patterns (particularlyFormatCountMessagefor statistics output, which currently uses rawfmt.Fprintf).Recommendations (Priority Order)
pkg/workflow/claude_logs.gofmt.Fprintf(os.Stderr, ...)withlogger.Printf()— these are debug messages, not user messagespkg/workflow/compiler_orchestrator_engine.go,cache.go"WARNING: ..."strings withconsole.FormatWarningMessage()pkg/cli/compile_watch.go,preconditions.gopkg/console/console.goFormatLocationMessage,FormatCountMessage,FormatListHeaderto match WASM stub APIpkg/cli/mcp_inspect_inspector.goconsole.FormatListItem()for bullet point server listings.Description()toNewSelectfields for better UXhuh.NewNote()for pre-form informational messagesPositive Patterns to Preserve
References:
Beta Was this translation helpful? Give feedback.
All reactions