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

@@ -10,6 +10,7 @@ import (
"github.com/fatih/color"
"github.com/spf13/cobra"
"github.com/steveyegge/beads"
"github.com/steveyegge/beads/internal/storage/sqlite"
_ "modernc.org/sqlite"
)
@@ -73,7 +74,7 @@ This command:
}
// Check if beads.db exists and is current
targetPath := filepath.Join(beadsDir, "beads.db")
targetPath := filepath.Join(beadsDir, beads.CanonicalDatabaseName)
var currentDB *dbInfo
var oldDBs []*dbInfo
@@ -271,7 +272,7 @@ This command:
if jsonOutput {
outputJSON(map[string]interface{}{
"status": "success",
"current_database": "beads.db",
"current_database": beads.CanonicalDatabaseName,
"version": Version,
"migrated": needsMigration,
"version_updated": needsVersionUpdate,