mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 02:45:38 -06:00
269bc5c89e
Co-authored-by: 1052326311 <65798732+1052326311@users.noreply.github.com>
15 lines
636 B
TypeScript
15 lines
636 B
TypeScript
import { getRootOptionAwareCommandPath } from "openclaw/plugin-sdk/cli-argv";
|
|
|
|
/** Policy commands follow Unix convention and switch to JSON when stdout is not a terminal. */
|
|
function isPolicyMachineOutput(params: { argv: readonly string[]; stdoutIsTTY: boolean }): boolean {
|
|
const [, command] = getRootOptionAwareCommandPath(params.argv, 2);
|
|
return ["check", "compare", "watch"].includes(command ?? "") && !params.stdoutIsTTY;
|
|
}
|
|
|
|
export const POLICY_CLI_DESCRIPTOR = {
|
|
name: "policy",
|
|
description: "Check policy requirements and emit audit evidence",
|
|
hasSubcommands: true,
|
|
machineOutput: isPolicyMachineOutput,
|
|
} as const;
|