Merge pull request #457 from kaitranntt/kai/fix/455-dashboard-delete-unified

fix(dashboard): delete accounts from unified config mode
This commit is contained in:
Kai (Tam Nhu) Tran
2026-02-04 18:17:33 -05:00
committed by GitHub
2 changed files with 22 additions and 4 deletions
+7 -2
View File
@@ -26,8 +26,13 @@ export async function handleShow(ctx: CommandContext, args: string[]): Promise<v
}
try {
const profile = ctx.registry.getProfile(profileName);
const defaultProfile = ctx.registry.getDefaultProfile();
// Use merged profiles (checks unified config first, falls back to legacy)
const allProfiles = ctx.registry.getAllProfilesMerged();
const profile = allProfiles[profileName];
if (!profile) {
exitWithError(`Profile not found: ${profileName}`, ExitCode.PROFILE_ERROR);
}
const defaultProfile = ctx.registry.getDefaultResolved();
const isDefault = profileName === defaultProfile;
const instancePath = ctx.instanceMgr.getInstancePath(profileName);
+15 -2
View File
@@ -205,8 +205,21 @@ router.delete('/:name', (req: Request, res: Response): void => {
return;
}
// Delete the profile (legacy/unified)
registry.deleteProfile(name);
// Delete from appropriate config (unified and/or legacy)
let deleted = false;
if (isUnifiedMode() && registry.hasAccountUnified(name)) {
registry.removeAccountUnified(name);
deleted = true;
}
if (registry.hasProfile(name)) {
registry.deleteProfile(name);
deleted = true;
}
if (!deleted) {
res.status(404).json({ error: `Account not found: ${name}` });
return;
}
res.json({ success: true, deleted: name });
} catch (error) {