-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Labels
automationclicode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!refactoringtask-mining
Description
Description
The codebase contains 46 instances of raw fmt.Println() calls that should be replaced with explicit fmt.Fprintln(os.Stderr, ...) for consistent output routing. Following Unix conventions, diagnostic output should go to stderr, reserving stdout for structured data (JSON).
Current Issues
- Inconsistent output routing - Some diagnostic messages go to stdout, others to stderr
- Breaks Unix conventions - Data and diagnostics are mixed
- Complicates piping - Users can't easily separate data from diagnostics
- No linter enforcement - New instances can be introduced
Files Affected
The following files contain raw fmt.Println() calls that need conversion:
pkg/workflow/stop_after.go- 10 instancespkg/workflow/mcp_config_custom.go- 1 instancepkg/workflow/engine_firewall_support.go- 3 instancespkg/campaign/command.go- 3 instances (JSON output exception)pkg/cli/tool_graph.go- 1 instance- Additional files - ~28 instances
Suggested Changes
Pattern to Replace
// ❌ Current (wrong)
fmt.Println(console.FormatWarningMessage("Warning message"))
fmt.Printf("Status: %s\n", status)
// ✅ Correct
fmt.Fprintln(os.Stderr, console.FormatWarningMessage("Warning message"))
fmt.Fprintf(os.Stderr, "Status: %s\n", status)Exception: JSON Output
// ✅ JSON output should go to stdout (not stderr)
fmt.Println(string(jsonBytes)) // Keep this for JSON outputImplementation Steps
- Identify all
fmt.Println()andfmt.Printf()calls - For each instance:
- If JSON output → Keep as
fmt.Println()to stdout - If diagnostic output → Change to
fmt.Fprintln(os.Stderr, ...)
- If JSON output → Keep as
- Run full test suite to verify no breakage
- Update AGENTS.md with output routing guidelines
Success Criteria
- All non-JSON
fmt.Println()calls replaced withfmt.Fprintln(os.Stderr, ...) - All non-JSON
fmt.Printf()calls replaced withfmt.Fprintf(os.Stderr, ...) - JSON output continues to go to stdout
- All tests pass
- AGENTS.md updated with output routing convention
- Consider adding linter rule to prevent new instances
Priority
High - Affects consistency across entire CLI, impacts user experience when piping/redirecting output
Source
Extracted from Terminal Stylist Analysis discussion #12488
The analysis identified 46 instances of raw fmt.Print* calls that should be standardized for consistent output routing following Unix conventions.
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 12, 2026, 1:27 PM UTC
Copilot
Metadata
Metadata
Labels
automationclicode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!refactoringtask-mining