[terminal-stylist] Terminal Stylist Audit — Console Output Analysis #28060
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Terminal Stylist. A newer discussion is available at Discussion #28253. |
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.
-
Overview
This audit analyzed all non-test Go source files in
pkg/andcmd/for console output consistency, Lipgloss usage patterns, and Huh interactive form implementations.Summary:
console.*calls (well-established formatter usage)fmt.Println/fmt.Printfto stdout (mostly structured output — correct)fmt.Fprintf(os.Stderr, ...)/fmt.Fprintln(os.Stderr, ...)withoutconsole.Format*wrappers (improvement opportunity)pkg/stylesandpkg/console✅ What's Working Well
Lipgloss — Adaptive Colors & TTY Detection
pkg/styles/theme.gocorrectly useslipgloss.Colorwith explicit light/dark hex pairs andlipgloss.LightDarkinpkg/styles/huh_theme.go. TheapplyStyle()helper inpkg/console/console.gogates all rendering behindisTTY()so pipes/redirects receive plain text.Lipgloss Table —
RenderTable()pkg/console/console.goexposes aRenderTable(TableConfig)helper that wrapslipgloss/tablewith styled headers, alt-row highlighting, total rows, and TTY-aware borders. This is a good central abstraction.Huh Forms — Theme + Accessibility
All interactive prompts (
confirm.go,input.go,list.go, interactiveadd_*commands) applystyles.HuhThemeandconsole.IsAccessibleMode(), satisfying Huh's best-practice recommendations. Accessible mode is triggered viaACCESSIBLE,TERM=dumb, orNO_COLORenvironment variables — a thorough implementation.FormatErrorChain()The new
FormatErrorChain(err)function correctly unwraps nested errors and renders each level with consistent indentation, matching Rust-style error output.1. Raw Warning/Error Messages in
pkg/workflow/Several files emit diagnostic messages to stderr as bare strings without
console.Format*:pkg/workflow/cache.gofmt.Fprintf(os.Stderr, "Warning: ...")pkg/workflow/push_to_pull_request_branch.gofmt.Fprintf(os.Stderr, "Warning: ...")pkg/workflow/mcp_renderer.gofmt.Fprintf(os.Stderr, "Error ...")pkg/workflow/compiler_orchestrator_engine.gofmt.Fprintf(os.Stderr, "WARNING: ...")Recommended fix:
2. Debug Messages to
stderrinpkg/workflow/claude_logs.goLines 155–326 emit detailed diagnostic/trace information (JSON parsing progress, token counts, entry counts) directly to
os.Stderrinstead of using the debug logger. These messages are too verbose for normal stderr and belong inlogger.New("workflow:claude_logs").3. Manual SHA Info to
stderrinpkg/workflow/action_sha_checker.goLines 186–187 output raw SHA values without formatting:
These should use
console.FormatInfoMessageor the debug logger depending on their intent.4.
audit_cross_run_render.goandaudit_diff_render.go— Manual Markdown TablesThese two files together account for 130 raw
fmt.Printf/fmt.Printlncalls that produce plain markdown-formatted tables to stdout. While stdout is correct for structured output, the tables are entirely hand-crafted strings:Since these render as markdown (e.g., piped to a file or displayed in a terminal that renders markdown), this is acceptable but fragile. If TTY rendering is ever desired,
console.RenderTable()is already available and could be used with a--plainfallback.5. Unused
FormatCountMessage/FormatLocationMessage/FormatListItemSeveral console helpers defined in
console.goandconsole_wasm.go(FormatCountMessage,FormatLocationMessage,FormatListItem) appear to have zero call-sites in production code. These either need adoption or can be removed to reduce dead surface area.6.
pkg/cli/compile_file_operations.go— Unformatted ErrorShould be
console.FormatErrorMessage(err.Error()).Huh Usage Assessment
✅ Strengths
pkg/styles/huh_theme.go): Fullhuh.ThemeFuncusing the Dracula palette, covering focused/blurred states, selectors, buttons, text cursors, and file pickers. This is a model integration.WithAccessible(IsAccessibleMode())applied consistently across all forms.PromptSecretInputincludes non-empty validation;add_interactive_*files handle errors fromform.Run()correctly.pkg/cli/interactive.goandpkg/cli/run_interactive.godefine customhuhforms directly rather than going through theconsolepackage helpers. This is fine for multi-field forms, but single-field prompts should useconsole.ConfirmAction()/console.PromptSecretInput()for consistency.huh.Notefields are used anywhere. Where instructions or context need to be shown inside a form group (e.g., onboarding steps),huh.NewNote()would improve the UX.Lipgloss Layout Assessment
✅ Strengths
RenderTitleBox,RenderErrorBox,RenderInfoSection, andRenderComposedSectionsinconsole.gouselipgloss.JoinVerticaland border composition correctly.styles.RoundedBorder/styles.NormalBorder/styles.ThickBorderconstants, ensuring visual consistency.pkg/cli/audit_report_render.goand sibling files usefmt.Fprintf(os.Stderr, ...)for tabular content that would benefit fromconsole.RenderTable(). The audit rendering pipeline is the largest site of unformatted output.pkg/cli/copilot_setup.goemits multi-line YAML snippets as rawfmt.Fprintln(os.Stderr, ...)strings (lines 264–290). Wrapping this inconsole.RenderInfoSection()would give it a visual left-border emphasis consistent with how info sections are rendered elsewhere.Recommendations — Priority Order
pkg/workflow/cache.go,mcp_renderer.go,push_to_pull_request_branch.go,compiler_orchestrator_engine.gofmt.Fprintf(os.Stderr, "Warning/Error: ...")withconsole.FormatWarningMessage/console.FormatErrorMessagepkg/cli/compile_file_operations.go:113console.FormatErrorMessage(err.Error())pkg/workflow/claude_logs.gologger.New("workflow:claude_logs")pkg/workflow/action_sha_checker.go:186-187console.FormatInfoMessageor debug loggerpkg/cli/copilot_setup.goconsole.RenderInfoSection()pkg/console/console.goFormatCountMessage,FormatLocationMessage,FormatListItempkg/cli/interactive.gohuh.NewNote()fields for onboarding contextReferences: §24834031763
Beta Was this translation helpful? Give feedback.
All reactions