fix: clarify config invalid output
This commit is contained in:
@@ -21,8 +21,8 @@ export async function ensureConfigReady(params: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const snapshot = await readConfigFileSnapshot();
|
const snapshot = await readConfigFileSnapshot();
|
||||||
const command = params.commandPath?.[0];
|
const commandName = params.commandPath?.[0];
|
||||||
const allowInvalid = command ? ALLOWED_INVALID_COMMANDS.has(command) : false;
|
const allowInvalid = commandName ? ALLOWED_INVALID_COMMANDS.has(commandName) : false;
|
||||||
const issues = snapshot.exists && !snapshot.valid ? formatConfigIssues(snapshot.issues) : [];
|
const issues = snapshot.exists && !snapshot.valid ? formatConfigIssues(snapshot.issues) : [];
|
||||||
const legacyIssues =
|
const legacyIssues =
|
||||||
snapshot.legacyIssues.length > 0
|
snapshot.legacyIssues.length > 0
|
||||||
@@ -55,7 +55,7 @@ export async function ensureConfigReady(params: {
|
|||||||
const muted = (value: string) => colorize(rich, theme.muted, value);
|
const muted = (value: string) => colorize(rich, theme.muted, value);
|
||||||
const error = (value: string) => colorize(rich, theme.error, value);
|
const error = (value: string) => colorize(rich, theme.error, value);
|
||||||
const heading = (value: string) => colorize(rich, theme.heading, value);
|
const heading = (value: string) => colorize(rich, theme.heading, value);
|
||||||
const command = (value: string) => colorize(rich, theme.command, value);
|
const commandText = (value: string) => colorize(rich, theme.command, value);
|
||||||
|
|
||||||
params.runtime.error(heading("Config invalid"));
|
params.runtime.error(heading("Config invalid"));
|
||||||
params.runtime.error(`${muted("File:")} ${muted(snapshot.path)}`);
|
params.runtime.error(`${muted("File:")} ${muted(snapshot.path)}`);
|
||||||
@@ -72,7 +72,7 @@ export async function ensureConfigReady(params: {
|
|||||||
params.runtime.error(pluginIssues.map((issue) => ` ${error(issue)}`).join("\n"));
|
params.runtime.error(pluginIssues.map((issue) => ` ${error(issue)}`).join("\n"));
|
||||||
}
|
}
|
||||||
params.runtime.error("");
|
params.runtime.error("");
|
||||||
params.runtime.error(`${muted("Run:")} ${command("clawdbot doctor --fix")}`);
|
params.runtime.error(`${muted("Run:")} ${commandText("clawdbot doctor --fix")}`);
|
||||||
if (!allowInvalid) {
|
if (!allowInvalid) {
|
||||||
params.runtime.exit(1);
|
params.runtime.exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user