diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-12 19:39:27 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-12 19:39:27 +0300 |
| commit | 9529976f13ec42c565e04578b3918eb2467dc72e (patch) | |
| tree | 19b0f9a715f5eeb5dfb3a8593b4bfb4425298078 /internal/release | |
| parent | 7a2c4b61e5ecba37ae8e601bc7b408db2f6192ea (diff) | |
fix: abort on Claude CLI failure and show error message
- 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 <noreply@anthropic.com>
Diffstat (limited to 'internal/release')
| -rw-r--r-- | internal/release/release.go | 20 |
1 files changed, 7 insertions, 13 deletions
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)) |
