mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 05:30:42 +00:00
fix(cli): improve guardrail messages
This commit is contained in:
@@ -128,8 +128,9 @@ describe("ensureConfigReady", () => {
|
||||
setInvalidSnapshot();
|
||||
const runtime = await runEnsureConfigReady(["message"]);
|
||||
|
||||
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("Config invalid"));
|
||||
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("config is invalid"));
|
||||
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("doctor --fix"));
|
||||
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("config validate"));
|
||||
expect(runtime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ export async function ensureConfigReady(params: {
|
||||
const heading = (value: string) => colorize(rich, theme.heading, value);
|
||||
const commandText = (value: string) => colorize(rich, theme.command, value);
|
||||
|
||||
params.runtime.error(heading("Config invalid"));
|
||||
params.runtime.error(heading("OpenClaw config is invalid"));
|
||||
params.runtime.error(`${muted("File:")} ${muted(shortenHomePath(snapshot.path))}`);
|
||||
if (issues.length > 0) {
|
||||
params.runtime.error(muted("Problem:"));
|
||||
@@ -124,7 +124,13 @@ export async function ensureConfigReady(params: {
|
||||
}
|
||||
params.runtime.error("");
|
||||
params.runtime.error(
|
||||
`${muted("Run:")} ${commandText(formatCliCommand("openclaw doctor --fix"))}`,
|
||||
`${muted("Fix:")} ${commandText(formatCliCommand("openclaw doctor --fix"))}`,
|
||||
);
|
||||
params.runtime.error(
|
||||
`${muted("Inspect:")} ${commandText(formatCliCommand("openclaw config validate"))}`,
|
||||
);
|
||||
params.runtime.error(
|
||||
muted("Status, health, logs, and doctor commands still run with invalid config."),
|
||||
);
|
||||
if (!allowInvalid) {
|
||||
params.runtime.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user