refactor: centralize config update logging

This commit is contained in:
Peter Steinberger
2026-01-23 04:01:11 +00:00
parent 246ee490f6
commit e750ad5e75
20 changed files with 73 additions and 70 deletions

View File

@@ -1,7 +1,7 @@
import { buildModelAliasIndex, resolveModelRefFromString } from "../../agents/model-selection.js";
import { CONFIG_PATH_CLAWDBOT, loadConfig } from "../../config/config.js";
import { loadConfig } from "../../config/config.js";
import { logConfigUpdated } from "../../config/logging.js";
import type { RuntimeEnv } from "../../runtime.js";
import { shortenHomePath } from "../../utils.js";
import {
DEFAULT_PROVIDER,
ensureFlagCompatibility,
@@ -79,7 +79,7 @@ export async function modelsImageFallbacksAddCommand(modelRaw: string, runtime:
};
});
runtime.log(`Updated ${shortenHomePath(CONFIG_PATH_CLAWDBOT)}`);
logConfigUpdated(runtime);
runtime.log(
`Image fallbacks: ${(updated.agents?.defaults?.imageModel?.fallbacks ?? []).join(", ")}`,
);
@@ -127,7 +127,7 @@ export async function modelsImageFallbacksRemoveCommand(modelRaw: string, runtim
};
});
runtime.log(`Updated ${shortenHomePath(CONFIG_PATH_CLAWDBOT)}`);
logConfigUpdated(runtime);
runtime.log(
`Image fallbacks: ${(updated.agents?.defaults?.imageModel?.fallbacks ?? []).join(", ")}`,
);
@@ -153,6 +153,6 @@ export async function modelsImageFallbacksClearCommand(runtime: RuntimeEnv) {
};
});
runtime.log(`Updated ${shortenHomePath(CONFIG_PATH_CLAWDBOT)}`);
logConfigUpdated(runtime);
runtime.log("Image fallback list cleared.");
}