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

@@ -16,14 +16,10 @@ import {
import { resolveDefaultAgentWorkspaceDir } from "../../agents/workspace.js";
import { parseDurationMs } from "../../cli/parse-duration.js";
import { formatCliCommand } from "../../cli/command-format.js";
import {
CONFIG_PATH_CLAWDBOT,
readConfigFileSnapshot,
type ClawdbotConfig,
} from "../../config/config.js";
import { readConfigFileSnapshot, type ClawdbotConfig } from "../../config/config.js";
import { logConfigUpdated } from "../../config/logging.js";
import type { RuntimeEnv } from "../../runtime.js";
import { stylePromptHint, stylePromptMessage } from "../../terminal/prompt-style.js";
import { shortenHomePath } from "../../utils.js";
import { applyAuthProfileConfig } from "../onboard-auth.js";
import { isRemoteEnvironment } from "../oauth-env.js";
import { openUrl } from "../onboard-helpers.js";
@@ -118,7 +114,7 @@ export async function modelsAuthSetupTokenCommand(
}),
);
runtime.log(`Updated ${shortenHomePath(CONFIG_PATH_CLAWDBOT)}`);
logConfigUpdated(runtime);
runtime.log(`Auth profile: ${CLAUDE_CLI_PROFILE_ID} (anthropic/oauth)`);
}
@@ -160,7 +156,7 @@ export async function modelsAuthPasteTokenCommand(
await updateConfig((cfg) => applyAuthProfileConfig(cfg, { profileId, provider, mode: "token" }));
runtime.log(`Updated ${shortenHomePath(CONFIG_PATH_CLAWDBOT)}`);
logConfigUpdated(runtime);
runtime.log(`Auth profile: ${profileId} (${provider}/token)`);
}
@@ -426,7 +422,7 @@ export async function modelsAuthLoginCommand(opts: LoginOptions, runtime: Runtim
return next;
});
runtime.log(`Updated ${shortenHomePath(CONFIG_PATH_CLAWDBOT)}`);
logConfigUpdated(runtime);
for (const profile of result.profiles) {
runtime.log(
`Auth profile: ${profile.profileId} (${profile.credential.provider}/${credentialMode(profile.credential)})`,