From deb59bdd214afc92a7584841a2008c9bf1c6b501 Mon Sep 17 00:00:00 2001 From: Kayvan Sylvan Date: Sat, 13 Dec 2025 00:02:44 -0800 Subject: [PATCH] fix: write CLI and streaming errors to stderr ## CHANGES - Route CLI execution errors to standard error output - Print Anthropic stream errors to stderr consistently - Add os import to support stderr error writes - Preserve help-output suppression and exit behavior --- cmd/fabric/main.go | 2 +- internal/plugins/ai/anthropic/anthropic.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/fabric/main.go b/cmd/fabric/main.go index 0bf09c44..92b96612 100644 --- a/cmd/fabric/main.go +++ b/cmd/fabric/main.go @@ -12,7 +12,7 @@ import ( func main() { err := cli.Cli(version) if err != nil && !flags.WroteHelp(err) { - fmt.Printf("%s\n", err) + fmt.Fprintf(os.Stderr, "%s\n", err) os.Exit(1) } } diff --git a/internal/plugins/ai/anthropic/anthropic.go b/internal/plugins/ai/anthropic/anthropic.go index 9628fcf1..2176e74e 100644 --- a/internal/plugins/ai/anthropic/anthropic.go +++ b/internal/plugins/ai/anthropic/anthropic.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/http" + "os" "strconv" "strings" @@ -216,7 +217,7 @@ func (an *Client) SendStream( } if stream.Err() != nil { - fmt.Printf("Messages stream error: %v\n", stream.Err()) + fmt.Fprintf(os.Stderr, "Messages stream error: %v\n", stream.Err()) } close(channel) return