UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

20 lines (19 loc) • 1.34 kB
import { Command, InvalidArgumentError } from "commander"; //#region src/cli/node-cli/command-options.ts function createNodeWorkerCommand() { return new Command("worker").description("Run the private macOS app node-host worker").option("--desktop-sharing", "Enable the app's desktop viewer capability").option("--no-desktop-sharing", "Disable the app's desktop viewer capability"); } /** Collect repeatable, comma-separated exact node command ids without treating patterns as globs. */ function collectNodeCommandIds(e, t = []) { const n = e.split(",").map((e) => e.trim()); if (n.some((e) => !e)) throw new InvalidArgumentError("--commands requires comma-separated non-empty command ids"); return [.../* @__PURE__ */ new Set([...t, ...n])].toSorted(); } function addNodeCommandOptions(e) { return e.option("--commands <ids>", "Advertise only these exact command ids (comma-separated; repeatable)", collectNodeCommandIds).option("--all-commands", "Advertise the full default command surface and forget any saved --commands allowlist").hook("preAction", (e, t) => { const n = t.optsWithGlobals(); if (n.allCommands && n.commands !== void 0) t.error("--all-commands cannot be combined with --commands", { code: "commander.conflictingOption" }); }); } //#endregion export { createNodeWorkerCommand as n, addNodeCommandOptions as t };