fix(doctor): add beads database check to detect empty issues.db

Add a new doctor check that detects when issues.db is empty but
issues.jsonl has content. This situation can cause "table issues has
no column named pinned" errors when running bd mail send.

The check:
- Detects empty database file alongside non-empty JSONL
- Can auto-fix by deleting the empty database and triggering rebuild
- Works for both town-level and rig-level beads

Run 'gt doctor --fix' to automatically fix this issue.

Fixes gt-bxi8

🤖 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-19 16:06:12 -08:00
parent 349205eda1
commit debe47cc62
4 changed files with 459 additions and 183 deletions

View File

@@ -53,16 +53,7 @@ func runDoctor(cmd *cobra.Command, args []string) error {
d := doctor.NewDoctor()
// Register built-in checks
// Note: Town-level checks are registered in gt-f9x.5
// Rig-level checks are registered in gt-f9x.6
// For now, we just have the framework ready
// If no checks registered, inform user
if len(d.Checks()) == 0 {
fmt.Println("No health checks registered yet.")
fmt.Println("Town-level and rig-level checks will be added in future updates.")
return nil
}
d.Register(doctor.NewBeadsDatabaseCheck())
// Run checks
var report *doctor.Report