openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
113 lines (112 loc) • 3.68 kB
JavaScript
import { o as getCommandPositionalsWithRootOptions, s as getRootOptionAwareCommandPath } from "./cli-root-options-xlQx6o4R.mjs";
//#region src/cli/update-option-specs.ts
const UPDATE_OPTION_SPECS = [
[
"--json",
"Output result as JSON",
false
],
["--no-restart", "Skip updater restart (package Gateways may restart themselves)"],
[
"--dry-run",
"Preview update actions without making changes",
false
],
[
"--full-integrity-check",
"Run full database integrity checks during migrations",
false
],
["--admission <auto|installed>", "Select candidate or installed admission checks (default: auto)"],
["--channel <stable|extended-stable|beta|dev>", "Persist update channel (git + npm)"],
["--tag <dist-tag|version|spec>", "Override the package target for this update (dist-tag, version, or package spec)"],
["--timeout <seconds>", "Set an overall update budget in seconds"],
["--drain-timeout <seconds>", "Set the immutable activation drain budget before interruption"],
["--sha <commit>", "Prepare an exact official commit for an adopted immutable installation"],
[
"--yes",
"Skip confirmation prompts (non-interactive)",
false
],
[
"--reapply-local-overrides",
"Replay trusted packaged dist edits when the target baseline is unchanged",
false
],
[
"--accept-capabilities",
"Accept widened plugin capabilities",
false
]
];
//#endregion
//#region src/cli/parent-command-path.ts
const AGENT_PARENT_BOOLEAN_FLAGS = [
"--local",
"--deliver",
"--json"
];
const AGENT_PARENT_VALUE_FLAGS = [
"-m",
"--message",
"--message-file",
"-t",
"--to",
"--session-key",
"--session-id",
"--agent",
"--model",
"--thinking",
"--verbose",
"--channel",
"--reply-to",
"--reply-channel",
"--reply-account",
"--timeout"
];
const MODELS_PARENT_BOOLEAN_FLAGS = [
"--json",
"--status-json",
"--status-plain"
];
const MODELS_PARENT_VALUE_FLAGS = ["--agent"];
const UPDATE_PARENT_BOOLEAN_FLAGS = UPDATE_OPTION_SPECS.filter(([e]) => !e.includes("<")).map(([e]) => e);
const UPDATE_PARENT_VALUE_FLAGS = UPDATE_OPTION_SPECS.filter(([e]) => e.includes("<")).map(([e]) => e.slice(0, e.indexOf(" ")));
const PARENT_COMMAND_FLAGS = /* @__PURE__ */ new Map([
["agent", [AGENT_PARENT_BOOLEAN_FLAGS, AGENT_PARENT_VALUE_FLAGS]],
["models", [MODELS_PARENT_BOOLEAN_FLAGS, MODELS_PARENT_VALUE_FLAGS]],
["config", [[], ["--section"]]],
["skills", [["--json"], ["--agent"]]],
["channels", [[], ["--agent"]]],
["update", [UPDATE_PARENT_BOOLEAN_FLAGS, UPDATE_PARENT_VALUE_FLAGS]]
]);
function resolveCliParentCommandPath(e, t) {
const [n] = getRootOptionAwareCommandPath(e, 1);
if (!n || t && n !== t) return null;
const r = PARENT_COMMAND_FLAGS.get(n);
if (!r) return null;
const [i, a] = r;
const o = getCommandPositionalsWithRootOptions(e, {
commandPath: [n],
booleanFlags: i,
valueFlags: a,
maxPositionals: 1,
mode: "command-path"
})?.[0];
return o ? [n, o] : [n];
}
//#endregion
//#region src/cli/config-output-mode.ts
/** Config values, paths, and schemas reserve stdout for machine-consumed output. */
function isConfigMachineOutput(e) {
const t = resolveCliParentCommandPath(e, "config")?.[1];
return t === "get" || t === "file" || t === "schema";
}
/** Config set uses --json as a parser alias except when dry-run emits a JSON report. */
function isConfigSetJsonParseOnly(e) {
const t = e.indexOf("--", 2);
const n = new Set(e.slice(2, t < 0 ? void 0 : t));
return n.has("--json") && !n.has("--dry-run");
}
//#endregion
export { resolveCliParentCommandPath as a, MODELS_PARENT_VALUE_FLAGS as i, isConfigSetJsonParseOnly as n, UPDATE_OPTION_SPECS as o, MODELS_PARENT_BOOLEAN_FLAGS as r, isConfigMachineOutput as t };