-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Labels
Description
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.Printfwith error-related text - Identify messages that should use
console.FormatErrorMessage() - Ensure output goes to stderr
- Search for
-
Convert error messages:
- Use
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(...)) - Maintain clear, actionable error messages
- Ensure proper error wrapping with
%w
- Use
-
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
- All error messages in
commands.gouse console formatting - All error messages in
git.gouse console formatting - All error messages in
file_tracker.gouse console formatting - All error messages in
run_workflow_tracking.gouse console formatting - All error output goes to stderr
- Existing tests pass
- Code passes
make fmtandmake lint -
make agent-finishcompletes successfully
Priority
Phase 2: Standardize Error Messages (4-6 hours estimated)
AI generated by Plan Command for discussion #11611
Reactions are currently unavailable