Fix #349: Improve compact error messages, remove bogus merge suggestion, add daemon/maintenance docs

- bd-1h8: Add --no-daemon hint to compact error messages
- bd-8ql: Replace non-existent merge command with actionable guidance
- bd-ayw: Add 'When to use daemon mode' decision tree to daemon.md
- bd-keb: Add database maintenance section to QUICKSTART.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-20 20:58:56 -05:00
parent f20aec672d
commit 27c0c331ac
4 changed files with 65 additions and 12 deletions

View File

@@ -105,11 +105,13 @@ Examples:
if compactAnalyze {
if err := ensureDirectMode("compact --analyze requires direct database access"); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
fmt.Fprintf(os.Stderr, "Hint: Use --no-daemon flag to bypass daemon and access database directly\n")
os.Exit(1)
}
sqliteStore, ok := store.(*sqlite.SQLiteStorage)
if !ok {
fmt.Fprintf(os.Stderr, "Error: compact requires SQLite storage\n")
fmt.Fprintf(os.Stderr, "Error: failed to open database in direct mode\n")
fmt.Fprintf(os.Stderr, "Hint: Ensure .beads/beads.db exists and is readable\n")
os.Exit(1)
}
runCompactAnalyze(ctx, sqliteStore)
@@ -120,6 +122,7 @@ Examples:
if compactApply {
if err := ensureDirectMode("compact --apply requires direct database access"); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
fmt.Fprintf(os.Stderr, "Hint: Use --no-daemon flag to bypass daemon and access database directly\n")
os.Exit(1)
}
if compactID == "" {
@@ -132,7 +135,8 @@ Examples:
}
sqliteStore, ok := store.(*sqlite.SQLiteStorage)
if !ok {
fmt.Fprintf(os.Stderr, "Error: compact requires SQLite storage\n")
fmt.Fprintf(os.Stderr, "Error: failed to open database in direct mode\n")
fmt.Fprintf(os.Stderr, "Hint: Ensure .beads/beads.db exists and is readable\n")
os.Exit(1)
}
runCompactApply(ctx, sqliteStore)

View File

@@ -82,9 +82,13 @@ Example:
sources = append(sources, issue.ID)
}
}
// TODO: performMerge implementation pending
// For now, just generate the command suggestion
cmd := fmt.Sprintf("bd merge %s --into %s", strings.Join(sources, " "), target.ID)
// Generate actionable command suggestion
cmd := fmt.Sprintf("# Duplicate: %s (same content as %s)\n# Suggested action: bd close %s && bd dep add %s %s --type related",
strings.Join(sources, " "),
target.ID,
strings.Join(sources, " "),
strings.Join(sources, " "),
target.ID)
mergeCommands = append(mergeCommands, cmd)
if autoMerge || dryRun {
@@ -134,8 +138,9 @@ Example:
sources = append(sources, issue.ID)
}
}
fmt.Printf(" %s bd merge %s --into %s\n\n",
cyan("Suggested:"), strings.Join(sources, " "), target.ID)
fmt.Printf(" %s Duplicate: %s (same content as %s)\n", cyan("Note:"), strings.Join(sources, " "), target.ID)
fmt.Printf(" %s bd close %s && bd dep add %s %s --type related\n\n",
cyan("Suggested:"), strings.Join(sources, " "), strings.Join(sources, " "), target.ID)
}
if autoMerge {
if dryRun {
@@ -245,11 +250,12 @@ func formatDuplicateGroupsJSON(groups [][]*types.Issue, refCounts map[string]int
}
}
result = append(result, map[string]interface{}{
"title": group[0].Title,
"issues": issues,
"suggested_target": target.ID,
"suggested_sources": sources,
"suggested_merge_cmd": fmt.Sprintf("bd merge %s --into %s", strings.Join(sources, " "), target.ID),
"title": group[0].Title,
"issues": issues,
"suggested_target": target.ID,
"suggested_sources": sources,
"suggested_action": fmt.Sprintf("bd close %s && bd dep add %s %s --type related", strings.Join(sources, " "), strings.Join(sources, " "), target.ID),
"note": fmt.Sprintf("Duplicate: %s (same content as %s)", strings.Join(sources, " "), target.ID),
})
}
return result