feat(reset): add integration tests and doctor reset suggestion
- Add 9 integration tests for bd reset command (reset_test.go) - Tests cover: dry-run, force, skip-init, backup, confirmation, cancellation, no-beads-dir, multiple issues, verbose mode - Enhance bd doctor to suggest reset when >= 3 unfixable errors found - Addresses bd-aydr.7, bd-aydr.5, bd-aydr.8 Closes: #479 (via GitHub comment with solution) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1318,6 +1318,7 @@ func printDiagnostics(result doctorResult) {
|
||||
|
||||
// Print warnings/errors with fixes
|
||||
hasIssues := false
|
||||
unfixableErrors := 0
|
||||
for _, check := range result.Checks {
|
||||
if check.Status != statusOK && check.Fix != "" {
|
||||
if !hasIssues {
|
||||
@@ -1332,12 +1333,27 @@ func printDiagnostics(result doctorResult) {
|
||||
}
|
||||
|
||||
fmt.Printf(" Fix: %s\n\n", check.Fix)
|
||||
} else if check.Status == statusError && check.Fix == "" {
|
||||
// Count unfixable errors
|
||||
unfixableErrors++
|
||||
}
|
||||
}
|
||||
|
||||
if !hasIssues {
|
||||
color.Green("✓ All checks passed\n")
|
||||
}
|
||||
|
||||
// Suggest reset if there are multiple unfixable errors
|
||||
if unfixableErrors >= 3 {
|
||||
fmt.Println()
|
||||
color.Yellow("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n")
|
||||
color.Yellow("⚠ Found %d unfixable errors\n", unfixableErrors)
|
||||
fmt.Println()
|
||||
fmt.Println(" Your beads state may be too corrupted to repair automatically.")
|
||||
fmt.Println(" Consider running 'bd reset' to start fresh.")
|
||||
fmt.Println(" (Use 'bd reset --backup' to save current state first)")
|
||||
color.Yellow("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n")
|
||||
}
|
||||
}
|
||||
|
||||
func checkMultipleDatabases(path string) doctorCheck {
|
||||
|
||||
Reference in New Issue
Block a user