Standardize CLI output with console formatting and stderr routing #11771
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CLI commands were using raw
fmt.Printf/fmt.Printlncalls that bypassed the console formatting system, causing inconsistent styling, messages routed to stdout instead of stderr, and no TTY detection for ANSI codes.Changes
Converted 95 message formatting calls across 10 CLI files:
run_workflow_execution.go(26),remove_command.go(23),status_command.go(15),trial_command.go(7)mcp_secrets.go(6),copilot-agents.go(5),tool_graph.go(4)mcp_list_tools.go(3),mcp_inspect.go(3),mcp_add.go(3)Pattern applied:
Intentionally unchanged: Data output (JSON, tables, Mermaid graphs) remains on stdout for proper piping:
gh aw list --json | jqImpact
Original prompt
This section details on the original issue you should resolve
<issue_title>[Code Quality] Standardize Console Formatting Across 24 CLI Files</issue_title>
<issue_description>## Description
24 CLI files currently use raw
fmt.Printf/fmt.Printlncalls that bypass the console formatting system, creating inconsistent user experience. These files should useconsole.Format*functions for consistent styling, color support, and TTY-aware output.Current Problem
Anti-Pattern (used in 24 files):
Correct Pattern:
Impact
Current Issues:
After Fix:
gh aw list --json | jq)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 instancesMedium Priority (5+ Instances)
pkg/cli/logs_command.go- 6 instancespkg/cli/list_command.go- 5 instancespkg/cli/audit_command.go- 5 instancesLower Priority (<5 Instances Each)
8-24. Other CLI files with 1-4 instances each
Conversion Pattern
Standard Replacements
Available 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 locationsImplementation Strategy
Phase 1: High Priority Files (Week 1)
make testafter each file./gh-aw (command)Phase 2: Medium Priority Files (Week 2)
Phase 3: Remaining Files (Week 3)
Testing Checklist (Per File)
fmt.Print*calls converted toconsole.Format*make testpassesmake lintpasses./gh-aw (command)looks correct./gh-aw (command) 2>/dev/nullshows no unwanted output to stdout./gh-aw (command) --json | jq(if applicable)Success Criteria
fmt.Print*calls in CLI files (except JSON output to stdout)make lintreports no issuesAdditional Context
...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.