Enforce canonical database naming (beads.db) - bd-165

- Added CanonicalDatabaseName constant (beads.db) and LegacyDatabaseNames list
- Updated bd init to use canonical name via constant
- Added daemon validation to reject non-canonical database names
- Updated bd migrate to use canonical name constant
- Enhanced FindDatabasePath to warn when using legacy database names
- All database discovery now prefers beads.db with backward compatibility

Closes bd-165
This commit is contained in:
Steve Yegge
2025-10-26 20:42:18 -07:00
parent a02729ea57
commit f24573a5f8
5 changed files with 65 additions and 30 deletions

View File

@@ -1162,11 +1162,23 @@ func runDaemonLoop(interval time.Duration, autoCommit, autoPush bool, logPath, p
for _, db := range validDBs {
log.log(" - %s", filepath.Base(db))
}
log.log("Run 'bd init' to migrate to beads.db or manually remove old databases")
log.log("")
log.log("Beads requires a single canonical database: %s", beads.CanonicalDatabaseName)
log.log("Run 'bd init' to migrate legacy databases")
os.Exit(1)
}
}
// Validate using canonical name
dbBaseName := filepath.Base(daemonDBPath)
if dbBaseName != beads.CanonicalDatabaseName {
log.log("Error: Non-canonical database name: %s", dbBaseName)
log.log("Expected: %s", beads.CanonicalDatabaseName)
log.log("")
log.log("Run 'bd init' to migrate to canonical name")
os.Exit(1)
}
log.log("Using database: %s", daemonDBPath)
store, err := sqlite.New(daemonDBPath)