UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.14 kB
import{Command,InvalidArgumentError}from"commander"; //!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`)}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`})})}export{createNodeWorkerCommand as n,addNodeCommandOptions as t};