CLI: use raw JSON writer for config schema

This commit is contained in:
Altay
2026-03-26 02:18:39 +03:00
parent 28953ac487
commit 39c15ee70d
3 changed files with 4 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ Docs: https://docs.openclaw.ai
- Plugins/runtime: expose `runHeartbeatOnce` in the plugin runtime `system` namespace so plugins can trigger a single heartbeat cycle with an explicit delivery target override (e.g. `heartbeat: { target: "last" }`). (#40299) Thanks @loveyana.
- Agents/compaction: surface safeguard-specific cancel reasons and relabel benign manual `/compact` no-op cases as skipped instead of failed. (#51072) Thanks @afurm.
- Agents/compaction: preserve the post-compaction AGENTS refresh on stale-usage preflight compaction for both immediate replies and queued followups. (#49479) Thanks @jared596.
- CLI: add `openclaw config schema` to print the generated JSON schema for `openclaw.json`. (#54523) Thanks @kvokka.
### Fixes

View File

@@ -453,6 +453,7 @@ describe("config cli", () => {
expect(mockExit).not.toHaveBeenCalled();
expect(mockError).not.toHaveBeenCalled();
expect(defaultRuntime.writeJson).toHaveBeenCalledTimes(1);
const raw = mockLog.mock.calls.at(-1)?.[0];
expect(typeof raw).toBe("string");
const payload = JSON.parse(String(raw)) as {
@@ -503,6 +504,7 @@ describe("config cli", () => {
await runConfigCommand(["config", "schema"]);
expect(defaultRuntime.writeJson).toHaveBeenCalledTimes(1);
const payload = JSON.parse(String(mockLog.mock.calls.at(-1)?.[0])) as {
properties?: Record<string, unknown>;
};

View File

@@ -1213,7 +1213,7 @@ async function buildCliConfigSchema(): Promise<Record<string, unknown>> {
export async function runConfigSchema(opts: { runtime?: RuntimeEnv } = {}) {
const runtime = opts.runtime ?? defaultRuntime;
try {
runtime.log(JSON.stringify(await buildCliConfigSchema(), null, 2));
writeRuntimeJson(runtime, await buildCliConfigSchema());
} catch (err) {
runtime.error(danger(`Config schema error: ${String(err)}`));
runtime.exit(1);