refactor: remove legacy kb compatibility

Drops the .kb/kb.db migration path, legacy backup filename handling, and
backward-compat test suites. Renames internal kbDir identifiers to
fusionDir and hasKbProject/isValidKbProject to their fusion equivalents.

- Remove needsCentralMigration, autoMigrateToCentral, and the
  "needs-migration" FirstRunState; checkAndMigrate and KB_SKIP_MIGRATION
  env var are gone
- Remove LEGACY_BACKUP_DIR and canonicalizeBackupDir; listBackups no
  longer matches kb-* filenames
- Delete backward-compat.test.ts and store-backward-compat.test.ts;
  update remaining tests to new 3-state first-run model

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-23 16:55:46 -07:00
parent f4e0850f9d
commit f20d0b5a18
36 changed files with 365 additions and 1194 deletions

View File

@@ -22,14 +22,14 @@ async function resolveBackupStore(projectName?: string): Promise<TaskStore> {
async function getBackupManager(projectName?: string): Promise<{
manager: BackupManager;
store: TaskStore;
kbDir: string;
fusionDir: string;
}> {
const store = await resolveBackupStore(projectName);
// Access the private kbDir property via type assertion
const kbDir = (store as unknown as { kbDir: string }).kbDir;
// Access the private fusionDir property via type assertion
const fusionDir = (store as unknown as { fusionDir: string }).fusionDir;
const settings = await store.getSettings();
const manager = createBackupManager(kbDir, settings);
return { manager, store, kbDir };
const manager = createBackupManager(fusionDir, settings);
return { manager, store, fusionDir };
}
/**
@@ -37,12 +37,12 @@ async function getBackupManager(projectName?: string): Promise<{
* Usage: fn backup --create
*/
export async function runBackupCreate(projectName?: string): Promise<void> {
const { kbDir, store } = await getBackupManager(projectName);
const { fusionDir, store } = await getBackupManager(projectName);
const settings = await store.getSettings();
console.log("Creating database backup...");
const result = await runBackupCommand(kbDir, settings);
const result = await runBackupCommand(fusionDir, settings);
if (result.success) {
console.log(result.output);