fix(config): require doctor for invalid configs (#764 — thanks @mukhtharcm)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user