You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This report analyzes console output patterns across 1,056 non-test Go source files in pkg/. The codebase already has a strong, well-structured console architecture — the main opportunity is enforcing consistency more broadly.
Key Metrics
Area
Status
Console abstraction layer
✅ Strong (pkg/console)
Centralized style system
✅ Good (pkg/styles/theme.go)
TTY/accessibility detection
✅ Solid throughout
Huh form integration
✅ Well-wrapped
Adaptive colors
✅ Centralized
Raw fmt.Print* in CLI flows
⚠️ Some inconsistency
ANSI leak risk
⚠️ Debug logger worth verifying
Console Package API Summary
pkg/console is the central output layer:
Format* = pure string formatting (single messages/items)
Render* = structured or multi-element layout output
Diagnostic output → stderr; structured data → stdout
Core APIs:
FormatError(...) — rich compiler-style error with source context
pkg/cli/compile_schedule_calendar.go — returns unstyled glyphs for non-TTY output
pkg/styles/huh_theme.go — uses lipgloss.LightDark(...) for per-render light/dark selection
Mild Concerns
pkg/logger/logger.go — uses lipgloss.Fprintf(stderrWriter(), ...) gated by DEBUG_COLORS but not explicitly by TTY. Worth confirming ANSI doesn't leak into redirected stderr when DEBUG_COLORS is set.
pkg/cli/compile_schedule_calendar.go — directly uses lipgloss.Style outside pkg/console/styles. Not a bug, but it softens the presentation-layer boundary.
Huh Form Usage Analysis
The huh integration is one of the cleanest areas in the codebase:
pkg/console/prompt_form.go:12-37 — applies styles.HuhTheme and WithAccessible(IsAccessibleMode())
pkg/styles/huh_theme.go:13-74 — maps semantic gh-aw palette into form styling
All interactive flows route through console wrappers
Mixed patterns: some info messages use console.Format*, but non-TTY workflow selection prompt and showWorkflowInfo sections use direct fmt.Fprintf(os.Stderr, ...). Lines ~120, ~210–254 are clearest candidates.
pkg/cli/interactive.go
Non-TTY fallback prompt rendering uses raw fmt.Fprintf(os.Stderr, ...) where console.PrintInfoStderr(...) would be cleaner. Lines ~76, ~132.
pkg/cli/trial_confirmation.go
Mostly uses console.FormatInfoMessageStderr(...) but wraps it in fmt.Fprintf(os.Stderr, ..., console.FormatInfoMessageStderr(...), ...) — slightly awkward double-wrapping. Lines ~141–227.
Recommendations
1. Keep pkg/console + pkg/styles as the single presentation layer — the architecture is sound; continue steering callers toward console.Format* / console.Render* / styles.*.
2. Add small stderr convenience helpers to eliminate repeated scaffolding:
// Instead of:fmt.Fprintln(os.Stderr, console.FormatInfoMessage(msg))
// A helper like:console.PrintInfoStderr(msg)
console.PrintfInfoStderr(format, args...)
// same for Warning, Success
3. Migrate raw fmt.Fprintf in CLI flows — primary targets:
pkg/cli/run_interactive.go (non-TTY workflow selection + info display)
pkg/cli/interactive.go (non-TTY plain prompts)
4. Verify debug logger TTY behavior — confirm pkg/logger/logger.go does not emit ANSI styling when stderr is redirected even when DEBUG_COLORS is set.
5. Keep ANSI literals in console infrastructure only — current state is correct (pkg/console/terminal.go, pkg/console/spinner.go), maintain the discipline.
6. Keep adaptive colors centralized — no ad hoc lipgloss.Color("#...") values outside pkg/styles/theme.go or pkg/styles/huh_theme.go.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
This report analyzes console output patterns across 1,056 non-test Go source files in
pkg/. The codebase already has a strong, well-structured console architecture — the main opportunity is enforcing consistency more broadly.Key Metrics
pkg/console)pkg/styles/theme.go)fmt.Print*in CLI flowsConsole Package API Summary
pkg/consoleis the central output layer:Format*= pure string formatting (single messages/items)Render*= structured or multi-element layout outputCore APIs:
FormatError(...)— rich compiler-style error with source contextFormatSuccessMessage(...)/FormatSuccessMessageStderr(...)FormatInfoMessage(...)/FormatInfoMessageStderr(...)FormatWarningMessage(...)RenderTable(...),RenderStruct(...)RenderTitleBox(...),RenderInfoSection(...),RenderComposedSections(...)FormatBanner()/PrintBanner()Interactive APIs:
NewForm(...),NewInputForm(...),NewSelectForm(...),NewConfirmForm(...)ConfirmAction(...),ShowInteractiveList(...),PromptSecretInput(...)pkg/console/spinner.goLipgloss Usage Analysis
Good Patterns
Centralized theme (
pkg/styles/theme.go):Error,Warning,Success,Info,FilePath,TableHeader, etc.)TTY gating before styling:
pkg/console/console.go:35-40—isTTY(),isStderrTTY(),applyStyleWithTTY(...)pkg/cli/compile_schedule_calendar.go— returns unstyled glyphs for non-TTY outputpkg/styles/huh_theme.go— useslipgloss.LightDark(...)for per-render light/dark selectionMild Concerns
pkg/logger/logger.go— useslipgloss.Fprintf(stderrWriter(), ...)gated byDEBUG_COLORSbut not explicitly by TTY. Worth confirming ANSI doesn't leak into redirected stderr whenDEBUG_COLORSis set.pkg/cli/compile_schedule_calendar.go— directly useslipgloss.Styleoutsidepkg/console/styles. Not a bug, but it softens the presentation-layer boundary.Huh Form Usage Analysis
The
huhintegration is one of the cleanest areas in the codebase:pkg/console/prompt_form.go:12-37— appliesstyles.HuhThemeandWithAccessible(IsAccessibleMode())pkg/styles/huh_theme.go:13-74— maps semantic gh-aw palette into form stylingFiles using huh correctly:
pkg/console/confirm.go,pkg/console/list.go,pkg/console/input.gopkg/cli/interactive.go,pkg/cli/run_interactive.gopkg/cli/add_interactive_*.go,pkg/cli/engine_secrets.goNo anti-patterns found here.
Files Worth Cleanup Review
pkg/cli/run_interactive.goMixed patterns: some info messages use
console.Format*, but non-TTY workflow selection prompt andshowWorkflowInfosections use directfmt.Fprintf(os.Stderr, ...). Lines ~120, ~210–254 are clearest candidates.pkg/cli/interactive.goNon-TTY fallback prompt rendering uses raw
fmt.Fprintf(os.Stderr, ...)whereconsole.PrintInfoStderr(...)would be cleaner. Lines ~76, ~132.pkg/cli/trial_confirmation.goMostly uses
console.FormatInfoMessageStderr(...)but wraps it infmt.Fprintf(os.Stderr, ..., console.FormatInfoMessageStderr(...), ...)— slightly awkward double-wrapping. Lines ~141–227.Recommendations
1. Keep
pkg/console+pkg/stylesas the single presentation layer — the architecture is sound; continue steering callers towardconsole.Format*/console.Render*/styles.*.2. Add small stderr convenience helpers to eliminate repeated scaffolding:
3. Migrate raw
fmt.Fprintfin CLI flows — primary targets:pkg/cli/run_interactive.go(non-TTY workflow selection + info display)pkg/cli/interactive.go(non-TTY plain prompts)4. Verify debug logger TTY behavior — confirm
pkg/logger/logger.godoes not emit ANSI styling when stderr is redirected even whenDEBUG_COLORSis set.5. Keep ANSI literals in console infrastructure only — current state is correct (
pkg/console/terminal.go,pkg/console/spinner.go), maintain the discipline.6. Keep adaptive colors centralized — no ad hoc
lipgloss.Color("#...")values outsidepkg/styles/theme.goorpkg/styles/huh_theme.go.References:
Beta Was this translation helpful? Give feedback.
All reactions