mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 06:42:44 +00:00
CLI: dedupe config validate errors and expose allowed values
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { type OpenClawConfig, readConfigFileSnapshot } from "../config/config.js";
|
||||
import { formatConfigIssueLines } from "../config/issue-format.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
|
||||
export async function requireValidConfigSnapshot(
|
||||
@@ -9,7 +10,7 @@ export async function requireValidConfigSnapshot(
|
||||
if (snapshot.exists && !snapshot.valid) {
|
||||
const issues =
|
||||
snapshot.issues.length > 0
|
||||
? snapshot.issues.map((issue) => `- ${issue.path}: ${issue.message}`).join("\n")
|
||||
? formatConfigIssueLines(snapshot.issues, "-").join("\n")
|
||||
: "Unknown validation issue.";
|
||||
runtime.error(`Config invalid:\n${issues}`);
|
||||
runtime.error(`Fix the config or run ${formatCliCommand("openclaw doctor")}.`);
|
||||
|
||||
Reference in New Issue
Block a user