fix(api): remove stale legacy profile target mappings

- delete profile_targets entry when deleting a legacy API profile

- prune empty profile_targets object to avoid config drift
This commit is contained in:
Tam Nhu Tran
2026-02-25 17:00:39 +07:00
parent 1c7e4e116f
commit e32dedcf4c
+6
View File
@@ -251,6 +251,12 @@ function removeApiProfileUnified(name: string): void {
function removeApiProfileLegacy(name: string): void {
const config = loadConfigSafe();
delete config.profiles[name];
if (config.profile_targets) {
delete config.profile_targets[name];
if (Object.keys(config.profile_targets).length === 0) {
delete config.profile_targets;
}
}
const configPath = getConfigPath();
const tempPath = configPath + '.tmp';