feat: Add version mismatch detection for outdated binaries

Prevent user confusion when running outdated bd binaries by detecting
version mismatches between the binary and database.

Features:
- Store bd version in metadata table on init
- Check version on every command (PersistentPreRun)
- Warn if binary is outdated with rebuild instructions
- Auto-upgrade database if binary is newer
- Silent operation when versions match

Fixes confusion from bd-182 (auto-export not working with old binary)
Implements bd-197

Files changed:
- cmd/bd/init.go: Store version on init
- cmd/bd/main.go: checkVersionMismatch() + integration

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-10-15 00:43:25 -07:00
parent e1aeccfce6
commit a26dc8a849
2 changed files with 55 additions and 0 deletions

View File

@@ -56,6 +56,12 @@ and database file. Optionally specify a custom issue prefix.`,
os.Exit(1)
}
// Store the bd version in metadata (for version mismatch detection)
if err := store.SetMetadata(ctx, "bd_version", Version); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to store version metadata: %v\n", err)
// Non-fatal - continue anyway
}
if err := store.Close(); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to close database: %v\n", err)
}