-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Description
Several CLI command files use raw fmt.Printf and fmt.Println directly without routing to stderr or using console formatters. This breaks pipeline conventions (output to stdout instead of stderr), provides no color/styling, and has no TTY detection (colors leak into pipes/redirects).
Background
Identified during Console Output Analysis on 2026-01-23 (discussion #11476). While the codebase has excellent console formatting infrastructure with Lipgloss, Huh, and Bubble Tea, approximately ~20 raw fmt.Print calls* exist in CLI code that bypass this system.
Current state: Raw fmt usage in ~10 CLI files
Impact: Inconsistent output, breaks pipeline conventions, no TTY detection
Comparison: Most CLI code properly uses console formatters
Files Affected
Primary files (with call counts):
pkg/cli/file_tracker.go- 9 locationspkg/cli/commands.go- 4 locationspkg/cli/copilot-agents.go- 4 locationspkg/cli/git.go- 1 locationpkg/cli/mcp_secrets.go- multiple locationspkg/cli/mcp_list_tools.go- multiple locations
Suggested Changes
Standard Replacement Pattern
Before:
fmt.Printf("Created %s: %s\n", fileType, targetPath)After:
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(
fmt.Sprintf("Created %s: %s", fileType, targetPath)))For Verbose Output with TTY Detection
if verbose {
if tty.IsStderrTerminal() {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Processing..."))
} else {
fmt.Fprintln(os.Stderr, "Processing...")
}
}For List Output
Before:
for _, file := range allFiles {
fmt.Printf(" - %s\n", file)
}After:
for _, file := range allFiles {
fmt.Fprintln(os.Stderr, console.FormatListItem(file))
}Success Criteria
- All raw
fmt.Printfandfmt.Printlncalls in CLI commands replaced with console formatters - Output routed to stderr (except JSON output which goes to stdout)
- TTY detection added to verbose output paths
- Consistent styling with rest of CLI
- Colors don't leak into pipes/redirects
-
make agent-finishpasses
Priority
Medium - Improves consistency and user experience
Estimated effort: Medium (2-3 hours across multiple files)
Source
Extracted from Console Output Analysis discussion #11476
Analysis quote:
"###
⚠️ Issue #1: Raw fmt.Print Usage Without stderr*Problem: Several CLI files use
fmt.Printfandfmt.Printlndirectly without routing to stderr or using console formatters.Impact:
- Output goes to stdout instead of stderr (breaks pipeline conventions)
- No color/styling applied (inconsistent with rest of CLI)
- No TTY detection (colors leak into pipes/redirects)"
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 6, 2026, 2:07 PM UTC