fix(config): require doctor for invalid configs (#764 — thanks @mukhtharcm)

This commit is contained in:
Peter Steinberger
2026-01-13 01:18:18 +00:00
parent 20ba8d4891
commit 231d2d5fdf
7 changed files with 80 additions and 11 deletions

View File

@@ -586,7 +586,7 @@ export async function runConfigureWizard(
const prompter = createClackPrompter();
const snapshot = await readConfigFileSnapshot();
let baseConfig: ClawdbotConfig = snapshot.valid ? snapshot.config : {};
const baseConfig: ClawdbotConfig = snapshot.valid ? snapshot.config : {};
if (snapshot.exists) {
const title = snapshot.valid
@@ -604,14 +604,11 @@ export async function runConfigureWizard(
);
}
if (!snapshot.valid) {
const reset = guardCancel(
await confirm({
message: "Config invalid. Start fresh?",
initialValue: true,
}),
runtime,
outro(
"Config invalid. Run `clawdbot doctor` to repair it, then re-run configure.",
);
if (reset) baseConfig = {};
runtime.exit(1);
return;
}
}

View File

@@ -128,6 +128,13 @@ export async function runNonInteractiveOnboarding(
runtime: RuntimeEnv = defaultRuntime,
) {
const snapshot = await readConfigFileSnapshot();
if (snapshot.exists && !snapshot.valid) {
runtime.error(
"Config invalid. Run `clawdbot doctor` to repair it, then re-run onboarding.",
);
runtime.exit(1);
return;
}
const baseConfig: ClawdbotConfig = snapshot.valid ? snapshot.config : {};
const mode = opts.mode ?? "local";
if (mode !== "local" && mode !== "remote") {