-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Description
24 CLI files currently use raw fmt.Printf/fmt.Println calls that bypass the console formatting system, creating inconsistent user experience. These files should use console.Format* functions for consistent styling, color support, and TTY-aware output.
Current Problem
Anti-Pattern (used in 24 files):
// ❌ BAD - Raw fmt.Printf without console formatting
fmt.Printf("Running workflow: %s\n", name)
fmt.Printf("Warning: Could not check status: %v\n", err)
fmt.Println("Success!")Correct Pattern:
// ✅ GOOD - Console formatted with appropriate message types
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Running workflow: %s", name)))
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Could not check status: %v", err)))
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Success!"))Impact
Current Issues:
- ❌ Inconsistent visual appearance across commands
- ❌ No color/styling on important messages
- ❌ Harder to distinguish message types (info vs warning vs error)
- ❌ Messages go to stdout instead of stderr (mixes with data output)
- ❌ No TTY detection (ANSI codes in piped output)
After Fix:
- ✅ Consistent, color-coded output across all commands
- ✅ Clear visual hierarchy (errors in red, warnings in orange, success in green)
- ✅ Proper stderr routing (enables piping:
gh aw list --json | jq) - ✅ TTY-aware (no ANSI codes in pipes/CI environments)
Files Requiring Updates (Priority Order)
High Priority (Most Instances)
pkg/cli/run_workflow_execution.go- 26 instancespkg/cli/remove_command.go- 23 instancespkg/cli/status_command.go- 15 instancespkg/cli/trial_command.go- 7 instances
Medium Priority (5+ Instances)
pkg/cli/logs_command.go- 6 instancespkg/cli/list_command.go- 5 instancespkg/cli/audit_command.go- 5 instances
Lower Priority (<5 Instances Each)
8-24. Other CLI files with 1-4 instances each
Conversion Pattern
Standard Replacements
// 1. Info messages
fmt.Printf("Status: %s\n", status) // Before
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Status: %s", status))) // After
// 2. Warning messages
fmt.Printf("Warning: %v\n", err) // Before
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(err.Error())) // After
// 3. Success messages
fmt.Println("Compilation successful!") // Before
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Compilation successful!")) // After
// 4. Error messages
fmt.Printf("Error: %v\n", err) // Before
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error())) // After
// 5. Commands/paths
fmt.Printf("Run: %s\n", cmd) // Before
fmt.Fprintln(os.Stderr, console.FormatCommandMessage(cmd)) // AfterAvailable Console Formatters
console.FormatSuccessMessage()- Green checkmark, success messagesconsole.FormatInfoMessage()- Cyan info icon, informational messagesconsole.FormatWarningMessage()- Orange warning icon, warningsconsole.FormatErrorMessage()- Red X, error messagesconsole.FormatCommandMessage()- Styled commandsconsole.FormatProgressMessage()- Progress indicatorsconsole.FormatPromptMessage()- User promptsconsole.FormatCountMessage()- Counts and metricsconsole.FormatVerboseMessage()- Verbose/debug outputconsole.FormatLocationMessage()- File paths and locations
Implementation Strategy
Phase 1: High Priority Files (Week 1)
- Update top 4 files with most instances (71 total replacements)
- Run
make testafter each file - Verify output manually with
./gh-aw (command)
Phase 2: Medium Priority Files (Week 2)
- Update files with 5+ instances (16 total replacements)
- Test in TTY and non-TTY environments
Phase 3: Remaining Files (Week 3)
- Update remaining 17 files (<5 instances each)
- Final verification of consistency
Testing Checklist (Per File)
- All
fmt.Print*calls converted toconsole.Format* - Output goes to stderr (not stdout)
-
make testpasses -
make lintpasses - Manual testing:
./gh-aw (command)looks correct - Manual testing:
./gh-aw (command) 2>/dev/nullshows no unwanted output to stdout - Piping works:
./gh-aw (command) --json | jq(if applicable)
Success Criteria
- All 24 files updated to use console formatters
- Zero raw
fmt.Print*calls in CLI files (except JSON output to stdout) - All messages go to stderr (except structured data output)
- Consistent visual appearance across all commands
- All existing tests pass
-
make lintreports no issues - Manual testing confirms improved UX
Additional Context
The console formatting system is already well-established in the codebase:
- ✅ 96 files (20.6%) already use console formatters correctly
- ✅ Comprehensive
pkg/consolepackage with 6,280 lines - ✅ Lipgloss integration for adaptive colors (light/dark theme support)
- ✅ TTY detection for graceful degradation in CI/pipes
This task is about consistency, not building new infrastructure - all tools are already in place.
Source
Extracted from Terminal Stylist Analysis discussion #11742 - Console Output Pattern Review (2026-01-25)
Priority
Medium - Improves user experience and consistency but doesn't block functionality. Large scope (24 files) makes it suitable for incremental improvements.
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 8, 2026, 2:04 PM UTC