Add console.Print* stderr wrappers and migrate high-volume MCP/secrets callsites#47108
console.Print* stderr wrappers and migrate high-volume MCP/secrets callsites#47108Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
console.Print* stderr wrappers and migrate high-volume MCP/secrets callsites
This comment has been minimized.
This comment has been minimized.
🤖 PR Triage
Score breakdown: Impact 22 · Urgency 12 · Quality 11
|
|
This PR looks great! 🎉 The refactor consolidates stderr output ergonomics in the Strengths:
This is ready for review by core team members!
|
pkg/consoleexposedFormat*helpers but no direct stderr print API, which led to widespread two-stepfmt.Fprintln(os.Stderr, console.Format*(...))patterns and inconsistent output routing ergonomics. This change introduces thinPrint*wrappers and migrates the two largest offenders in CLI code.Console output API consolidation
pkg/console/print.gothat mirror existingFormat*helpers and centralize newline + destination handling (os.Stderr).Targeted migration in highest-volume files
pkg/cli/mcp_inspect_mcp.gopkg/cli/engine_secrets.goFprintln(..., console.Format*)and newline-wrappedFprintf("\n%s\n", console.Format*)patterns toconsole.Print*while preserving message structure.Docs + usage guidance alignment
pkg/console/doc.go,pkg/console/README.md) to preferPrint*for diagnostic stderr output.Focused wrapper coverage
pkg/console/print_test.goto assert that newPrint*wrappers emit expected formatted output to stderr.