Objective
Convert all user-facing error messages to use console.FormatErrorMessage() and ensure they go to stderr for consistency.
Context
From discussion #11611: Multiple CLI files use direct fmt.Printf for error messages instead of the standardized console formatting. This affects user experience and consistency.
Files with Issues: commands.go, git.go, file_tracker.go, run_workflow_tracking.go
Approach
-
Audit each file for error message patterns:
- Search for
fmt.Printf with error-related text
- Identify messages that should use
console.FormatErrorMessage()
- Ensure output goes to stderr
-
Convert error messages:
- Use
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(...))
- Maintain clear, actionable error messages
- Ensure proper error wrapping with
%w
-
Test changes:
- Verify errors display correctly in terminal
- Test non-TTY mode strips ANSI codes
- Run existing tests to ensure no regressions
Files to Modify
- Update:
pkg/cli/commands.go
- Update:
pkg/cli/git.go
- Update:
pkg/cli/file_tracker.go
- Update:
pkg/cli/run_workflow_tracking.go
Pattern to Follow
// ❌ WRONG - Direct fmt.Printf without console formatting:
fmt.Printf("Error: Failed to process workflow: %v\n", err)
// ✅ CORRECT - Console formatted error to stderr:
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))
// ✅ CORRECT - With context:
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("Failed to process workflow: %v", err)))
Acceptance Criteria
Priority
Phase 2: Standardize Error Messages (4-6 hours estimated)
AI generated by Plan Command for discussion #11611
Objective
Convert all user-facing error messages to use
console.FormatErrorMessage()and ensure they go to stderr for consistency.Context
From discussion #11611: Multiple CLI files use direct
fmt.Printffor error messages instead of the standardized console formatting. This affects user experience and consistency.Files with Issues:
commands.go,git.go,file_tracker.go,run_workflow_tracking.goApproach
Audit each file for error message patterns:
fmt.Printfwith error-related textconsole.FormatErrorMessage()Convert error messages:
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(...))%wTest changes:
Files to Modify
pkg/cli/commands.gopkg/cli/git.gopkg/cli/file_tracker.gopkg/cli/run_workflow_tracking.goPattern to Follow
Acceptance Criteria
commands.gouse console formattinggit.gouse console formattingfile_tracker.gouse console formattingrun_workflow_tracking.gouse console formattingmake fmtandmake lintmake agent-finishcompletes successfullyPriority
Phase 2: Standardize Error Messages (4-6 hours estimated)