Skip to content

[plan] Fix unformatted stderr output in copilot_setup.go and mcp_list_tools.go #21175

@github-actions

Description

@github-actions

Objective

Replace raw fmt.Fprintf(os.Stderr, ...) calls with appropriate console.Format* wrappers in two high-priority files identified in the Terminal Stylist audit (discussion #21126).

Context

The audit found ~54 files using raw stderr writes. These two files are the highest-priority due to call count and user visibility.

Files to Modify

pkg/cli/copilot_setup.go — 12 raw stderr calls

Replace patterns like:

fmt.Fprintf(os.Stderr, "No version upgrade needed for %s\n", setupStepsPath)
fmt.Fprintf(os.Stderr, "Updated %s with new version %s\n", setupStepsPath, version)
fmt.Fprintf(os.Stderr, "Skipping %s (already has gh-aw extension install step)\n", path)

With:

fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("No version upgrade needed for %s", setupStepsPath)))
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("Updated %s with new version %s", setupStepsPath, version)))
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Skipping %s (already has gh-aw extension install step)", path)))

pkg/cli/mcp_list_tools.go — 4 raw stderr calls

Replace patterns like:

fmt.Fprintf(os.Stderr, "Available MCP servers: ")
fmt.Fprintf(os.Stderr, "%s\n", strings.Join(serverNames, ", "))
fmt.Fprintf(os.Stderr, "Found MCP server '%s' in %d workflow(s): %s\n", ...)
fmt.Fprintf(os.Stderr, "\nRun 'gh aw mcp list-tools %s (workflow-name)'...\n", ...)

With appropriate console.FormatInfoMessage / console.FormatSuccessMessage wrappers.

Approach

  1. Audit each raw fmt.Fprintf(os.Stderr, ...) call in both files
  2. Choose the correct formatter based on message semantics:
    • Info/neutral → console.FormatInfoMessage
    • Success/completion → console.FormatSuccessMessage
    • Warning → console.FormatWarningMessage
    • Error → console.FormatErrorMessage
  3. Convert fmt.Fprintf(os.Stderr, "...\n", args...)fmt.Fprintln(os.Stderr, console.FormatXxxMessage(fmt.Sprintf("...", args...)))
  4. Run make fmt && make test-unit to validate

Acceptance Criteria

  • All raw fmt.Fprintf(os.Stderr, ...) in copilot_setup.go replaced with console formatters
  • All raw fmt.Fprintf(os.Stderr, ...) in mcp_list_tools.go replaced with console formatters
  • make fmt passes with no changes
  • make test-unit passes

Generated by Plan Command for issue #discussion #21126 ·

  • expires on Mar 18, 2026, 5:12 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions