mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 19:32:27 +00:00
feat(cli): add json schema to cli tool (#54523)
Merged via squash.
Prepared head SHA: 39c15ee70d
Co-authored-by: kvokka <15954013+kvokka@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
@@ -178,6 +178,7 @@ describe("registerPreActionHooks", () => {
|
||||
.command("validate")
|
||||
.option("--json")
|
||||
.action(() => {});
|
||||
config.command("schema").action(() => {});
|
||||
registerPreActionHooks(program, "9.9.9-test");
|
||||
return program;
|
||||
}
|
||||
@@ -422,6 +423,15 @@ describe("registerPreActionHooks", () => {
|
||||
expect(ensureConfigReadyMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("bypasses config guard for config schema", async () => {
|
||||
await runPreAction({
|
||||
parseArgv: ["config", "schema"],
|
||||
processArgv: ["node", "openclaw", "config", "schema"],
|
||||
});
|
||||
|
||||
expect(ensureConfigReadyMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("bypasses config guard for backup create", async () => {
|
||||
await runPreAction({
|
||||
parseArgv: ["backup", "create"],
|
||||
|
||||
@@ -49,9 +49,7 @@ function shouldBypassConfigGuard(commandPath: string[]): boolean {
|
||||
if (CONFIG_GUARD_BYPASS_COMMANDS.has(primary)) {
|
||||
return true;
|
||||
}
|
||||
// config validate is the explicit validation command; let it render
|
||||
// validation failures directly without preflight guard output duplication.
|
||||
if (primary === "config" && secondary === "validate") {
|
||||
if (primary === "config" && (secondary === "validate" || secondary === "schema")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user