- Renamed config.json to metadata.json to clarify purpose (database metadata)
- Fixed config.yaml/config.json conflict by making Viper explicitly load only config.yaml
- Added automatic migration from config.json to metadata.json on first read
- Fixed jsonOutput variable shadowing across 22 command files
- Updated bd init to create both metadata.json and config.yaml template
- Fixed 5 failing JSON output tests
- All tests passing
Resolves config file confusion and makes config.yaml work correctly.
Closes#178 (global flags), addresses config issues from #193
Amp-Thread-ID: https://ampcode.com/threads/T-e6ac8192-e18f-4ed7-83bc-4a5986718bb7
Co-authored-by: Amp <amp@ampcode.com>
Fixes#204
Multiple critical bugs in bd migrate:
1. **Respects config.json database name**: migrate now loads config.json
and uses the configured database name instead of hardcoding beads.db.
Users with custom database names (e.g., beady.db) will no longer
have their databases renamed.
2. **Fixes disk I/O error (522)**: Clean up orphaned WAL files before
reopening database to update schema version. This prevents SQLite
error 522 (disk I/O error) when WAL files exist from previous
database sessions.
3. **Creates backup before migration**: First migration now creates
a timestamped backup (*.backup-pre-migrate-*.db) before renaming
database, consistent with hash-id migration behavior.
4. **Cleans up orphaned WAL files**: Removes .db-wal and .db-shm
files after migrating old database to prevent stale files.
Changes:
- Load config.json in migrate command to get target database name
- Use cfg.Database instead of hardcoded beads.CanonicalDatabaseName
- Add loadOrCreateConfig() helper function
- Add cleanupWALFiles() to remove orphaned WAL/SHM files
- Create backup before first migration
- Clean up WAL files before version update and after migration
- Add TestMigrateRespectsConfigJSON test
All migration tests passing.
Amp-Thread-ID: https://ampcode.com/threads/T-e5b9ddd0-621b-418b-bc52-ba9462975c39
Co-authored-by: Amp <amp@ampcode.com>
- Implement bd migrate command with detection, version checking, and cleanup
- Update daemon to suggest bd migrate for version mismatches
- Enhance CLI version warnings to recommend bd migrate
- Add comprehensive tests for migration scenarios
- Document migration workflow in QUICKSTART.md and AGENTS.md
Completes bd-164 and epic bd-159
Amp-Thread-ID: https://ampcode.com/threads/T-34ea4682-8c48-44c2-8421-dc40f867773b
Co-authored-by: Amp <amp@ampcode.com>