From 9529976f13ec42c565e04578b3918eb2467dc72e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 12 Jul 2025 19:39:27 +0300 Subject: fix: abort on Claude CLI failure and show error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use CombinedOutput to capture both stdout and stderr - Display exit code and error message when Claude fails - Abort immediately instead of trying fallback models - Makes debugging easier when Claude CLI has issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- internal/release/release.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'internal') diff --git a/internal/release/release.go b/internal/release/release.go index 8e92051..4245bd2 100644 --- a/internal/release/release.go +++ b/internal/release/release.go @@ -341,21 +341,15 @@ func (m *Manager) GenerateAIReleaseNotes(repoPath, repoName, tag string, allTags } cmd := exec.Command("claude", "--model", "sonnet", prompt.String()) - output, err := cmd.Output() + output, err := cmd.CombinedOutput() // Use CombinedOutput to capture stderr if err != nil { - // Try with opus model - fmt.Println(" Trying with opus model...") - cmd = exec.Command("claude", "--model", "opus", prompt.String()) - output, err = cmd.Output() - if err != nil { - // Try with default model - fmt.Println(" Trying with default model...") - cmd = exec.Command("claude", prompt.String()) - output, err = cmd.Output() - if err != nil { - return "", fmt.Errorf("failed to run claude: %w", err) - } + // Check if it's an exit error and print the output + if exitErr, ok := err.(*exec.ExitError); ok { + fmt.Printf(" Claude CLI failed with exit code %d\n", exitErr.ExitCode()) + fmt.Printf(" Error output: %s\n", string(output)) + return "", fmt.Errorf("claude CLI failed: %s", string(output)) } + return "", fmt.Errorf("failed to run claude: %w", err) } releaseNotes := strings.TrimSpace(string(output)) -- cgit v1.2.3