Skip to content

[Code Quality] Fix stdout anti-patterns in CLI commands #12222

@github-actions

Description

@github-actions

Description

Found 5 instances of user-facing messages using stdout without console formatting. Messages should use stderr with proper console formatting for consistency and to avoid breaking piped output.

Locations to Fix

File Line Current Pattern Issue
pkg/workflow/file_tracker.go 86 fmt.Println("No files to stage") Should use stderr
pkg/cli/pr_command.go 770 fmt.Printf("Creating PR: %s\\n", title) Should use stderr + console formatting
pkg/workflow/run_workflow_validation.go 288, 315 fmt.Printf(...) Should use stderr + console formatting

Note: JSON output (--json flag) and graph output (Mermaid) correctly use stdout and don't need changes.

Proposed Fixes

Example 1: Simple message

Before:

fmt.Println("No files to stage")

After:

fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No files to stage"))

Example 2: Formatted message

Before:

fmt.Printf("Creating PR: %s\\n", title)

After:

fmt.Fprintln(os.Stderr, console.FormatProgressMessage(fmt.Sprintf("Creating PR: %s", title)))

Files Affected

  • pkg/workflow/file_tracker.go (1 instance)
  • pkg/cli/pr_command.go (1 instance)
  • pkg/workflow/run_workflow_validation.go (2 instances)

Success Criteria

  • All 5 instances updated to use stderr
  • Console formatting applied (FormatInfoMessage, FormatProgressMessage)
  • Verify JSON output still goes to stdout
  • Verify graph output still goes to stdout
  • All existing tests pass
  • Messages appear consistently styled in terminal

Impact

  • Severity: Low-Medium - Improves consistency
  • Effort: Low - Estimated 30 minutes
  • Risk: Minimal - Well-defined pattern changes
  • Benefit: Consistent message styling, proper stdout/stderr separation

Source

Extracted from Terminal Stylist Report: Console Output Analysis

Priority

Medium - Improves CLI consistency and output handling

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 11, 2026, 9:11 AM UTC

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions