refactor: split doctor into modules

This commit is contained in:
Peter Steinberger
2026-01-07 23:40:31 +01:00
parent 8b9f0c4e2a
commit 2ca936ee98
8 changed files with 937 additions and 919 deletions

View File

@@ -0,0 +1,30 @@
import { note } from "@clack/prompts";
import {
ensureAuthProfileStore,
repairOAuthProfileIdMismatch,
} from "../agents/auth-profiles.js";
import type { ClawdbotConfig } from "../config/config.js";
import type { DoctorPrompter } from "./doctor-prompter.js";
export async function maybeRepairAnthropicOAuthProfileId(
cfg: ClawdbotConfig,
prompter: DoctorPrompter,
): Promise<ClawdbotConfig> {
const store = ensureAuthProfileStore();
const repair = repairOAuthProfileIdMismatch({
cfg,
store,
provider: "anthropic",
legacyProfileId: "anthropic:default",
});
if (!repair.migrated || repair.changes.length === 0) return cfg;
note(repair.changes.map((c) => `- ${c}`).join("\n"), "Auth profiles");
const apply = await prompter.confirm({
message: "Update Anthropic OAuth profile id in config now?",
initialValue: true,
});
if (!apply) return cfg;
return repair.config;
}