Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 12, 2025

This PR completes Step 1 of the multi-step migration to using the golang log package with stderr output, as outlined in the project's logging guidelines.

Problem

The codebase was using fmt.Println() for console-formatted logging output, which writes to stdout. According to the AGENTS.md guidelines, all CLI logging should go to stderr using fmt.Fprintln(os.Stderr, ...) to properly separate user output from diagnostic/informational messages.

Changes

Migrated 40 occurrences of fmt.Println to fmt.Fprintln(os.Stderr, ...) across 4 files in the workflow package:

  • pkg/workflow/compiler.go (31 occurrences) - All verbose compilation messages including file reading, parsing, validation, and success messages
  • pkg/workflow/custom_engine.go (3 occurrences) - Log parsing fallback messages
  • pkg/workflow/mcp-config.go (3 occurrences) - MCP server type warnings
  • pkg/workflow/stop_after.go (3 occurrences) - Stop-after time resolution messages

All migrated calls use console formatting helpers (console.FormatInfoMessage, console.FormatWarningMessage, console.FormatSuccessMessage) and now correctly output to stderr.

Testing

Verified that verbose compilation output now goes to stderr:

# Output only appears on stderr, not stdout
./gh-aw compile workflow.md --verbose 2>&1 1>/dev/null
# Shows verbose output

./gh-aw compile workflow.md --verbose 1>/dev/null 2>&1  
# No output (redirected stderr to stdout which is then redirected to /dev/null)

All existing tests pass without modification, confirming backward compatibility.

Future Work

This is Step 1 of a phased migration. Remaining work includes migrating fmt.Printf calls (32 occurrences) in subsequent PRs to complete the transition to proper stderr-based logging throughout the codebase.

Related

  • Follows guidelines documented in AGENTS.md
  • Part of multi-step logging migration initiative
Original prompt

We are going to do a multiple step migration to using the golang log package. Use stderr.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Migrate to using the golang log package with stderr Step 1: Migrate console-formatted logging from fmt.Println to stderr Oct 12, 2025
@Copilot Copilot AI requested a review from pelikhan October 12, 2025 04:12
Copilot finished work on behalf of pelikhan October 12, 2025 04:12
@pelikhan pelikhan closed this Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants