| 2 | |
| 3 | // Function to add common options to any command |
| 4 | export function addCommonOptions(command: Command): Command { |
| 5 | return command |
| 6 | .option( |
| 7 | "--config <path>", |
| 8 | "Configuration file for the assistant (can be a file path or hub slug)", |
| 9 | ) |
| 10 | .option( |
| 11 | "--org <slug>", |
| 12 | "Organization slug to use for this session (supported only in headless mode)", |
| 13 | ) |
| 14 | .option("--readonly", "Start in plan mode (read-only tools)") |
| 15 | .option("--auto", "Start in auto mode (all tools allowed)") |
| 16 | .option("--verbose", "Enable verbose logging") |
| 17 | .option("--beta-status-tool", "Enable beta status tool") |
| 18 | .option( |
| 19 | "--rule <rule>", |
| 20 | "Add a rule (can be a file path, hub slug, or string content). Can be specified multiple times.", |
| 21 | (value: string, previous: string[] | undefined) => { |
| 22 | const array = Array.isArray(previous) ? previous : []; |
| 23 | array.push(value); |
| 24 | return array; |
| 25 | }, |
| 26 | [] as string[], |
| 27 | ) |
| 28 | .option( |
| 29 | "--mcp <slug>", |
| 30 | "Add an MCP server from the hub (slug in format 'owner/package'). Can be specified multiple times.", |
| 31 | (value: string, previous: string[] | undefined) => { |
| 32 | const array = Array.isArray(previous) ? previous : []; |
| 33 | array.push(value); |
| 34 | return array; |
| 35 | }, |
| 36 | [] as string[], |
| 37 | ) |
| 38 | .option( |
| 39 | "--model <slug>", |
| 40 | "Add a model from the hub (slug in format 'owner/package'). Can be specified multiple times.", |
| 41 | (value: string, previous: string[] | undefined) => { |
| 42 | const array = Array.isArray(previous) ? previous : []; |
| 43 | array.push(value); |
| 44 | return array; |
| 45 | }, |
| 46 | [] as string[], |
| 47 | ) |
| 48 | .option( |
| 49 | "--prompt <prompt>", |
| 50 | "Add to the initial user message (can be a file path, hub slug, or string content). Can be specified multiple times.", |
| 51 | (value: string, previous: string[] | undefined) => { |
| 52 | const array = Array.isArray(previous) ? previous : []; |
| 53 | array.push(value); |
| 54 | return array; |
| 55 | }, |
| 56 | [] as string[], |
| 57 | ) |
| 58 | .option( |
| 59 | "--allow <tool>", |
| 60 | "Allow specified tool (overrides default policies). Can be specified multiple times.", |
| 61 | (value: string, previous: string[] | undefined) => { |