Skip to content

[plan] Console format all CLI error messages #9237

@github-actions

Description

@github-actions

Objective

Convert all raw error outputs in CLI command files to use console.FormatErrorMessage() for consistent, professional error presentation.

Context

Currently only 3% (44/1,450) of error outputs use proper console formatting despite AGENTS.md requirements. This creates an inconsistent user experience where some errors are beautifully formatted while others appear as raw text dumps.

Files to Modify

High-priority CLI files with raw error outputs:

  • pkg/cli/access_log.go
  • pkg/cli/actions_build_command.go
  • pkg/cli/add_command.go
  • pkg/cli/audit.go
  • pkg/cli/audit_report_render.go
  • pkg/cli/compile_batch_operations.go
  • pkg/cli/compile_helpers.go
  • pkg/cli/compile_orchestration.go

Approach

Replace raw error output patterns with console formatting:

// OLD - Raw output
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
fmt.Println(err)

// NEW - Console formatted
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))

Ensure all files:

  1. Import github.com/githubnext/gh-aw/pkg/console
  2. Send all error output to stderr (not stdout)
  3. Use console.FormatErrorMessage() consistently
  4. Follow console formatting guidelines from AGENTS.md

Acceptance Criteria

  • All error outputs in pkg/cli/*.go use console.FormatErrorMessage()
  • No fmt.Println(err) or fmt.Printf(err) direct error outputs remain
  • All error output goes to stderr via fmt.Fprintln(os.Stderr, ...)
  • Consistent formatting across all CLI commands
  • Visual regression tests pass (run make test)
  • No errors printed to stdout

Validation

Run after changes:

make test
make lint
# Verify no direct error prints remain
grep -r "fmt.Println.*err" pkg/cli/

Related to #9236

AI generated by Plan Command for discussion #9231

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions