feat: consolidate maintenance commands into bd doctor --fix (bd-bqcc)

Add new Maintenance category to bd doctor with checks for:
- Stale closed issues (older than 30 days)
- Expired tombstones (older than TTL)
- Compaction candidates (info only)

Add fix handlers for cleanup and tombstone pruning via bd doctor --fix.
Add deprecation hints to cleanup, compact, and detect-pollution commands
suggesting users try bd doctor instead.

This consolidation reduces cognitive load - users just need to remember
'bd doctor' for health checks and 'bd doctor --fix' for maintenance.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 00:25:09 -08:00
parent cfe823da61
commit aa1ce63156
9 changed files with 624 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/steveyegge/beads/internal/config"
"github.com/steveyegge/beads/internal/storage/sqlite"
"github.com/steveyegge/beads/internal/types"
"github.com/steveyegge/beads/internal/ui"
)
var (
@@ -109,7 +110,11 @@ type CompactApplyResponse struct {
TombstonesPruned *TombstonePrunedInfo `json:"tombstones_pruned,omitempty"`
}
// TODO: Consider consolidating into 'bd doctor --fix' for simpler maintenance UX
// showCompactDeprecationHint shows a hint about bd doctor consolidation (bd-bqcc)
func showCompactDeprecationHint() {
fmt.Fprintln(os.Stderr, ui.RenderMuted("💡 Tip: 'bd doctor' now shows compaction candidates in the Maintenance section"))
}
var compactCmd = &cobra.Command{
Use: "compact",
GroupID: "maint",
@@ -578,6 +583,9 @@ func runCompactStats(ctx context.Context, store *sqlite.SQLiteStorage) {
if tier2Size > 0 {
fmt.Printf(" Estimated savings: %d bytes (95%%)\n", tier2Size*95/100)
}
// bd-bqcc: Show hint about doctor consolidation
showCompactDeprecationHint()
}
func progressBar(current, total int) string {