(app: Argv, opts: DaemonCommandsOptions)
| 26 | * Register daemon management commands. |
| 27 | */ |
| 28 | export function registerDaemonCommands(app: Argv, opts: DaemonCommandsOptions): void { |
| 29 | app.command( |
| 30 | 'daemon <action>', |
| 31 | 'Manage the xcodebuildmcp daemon', |
| 32 | (yargs) => { |
| 33 | return yargs |
| 34 | .positional('action', { |
| 35 | describe: 'Daemon action', |
| 36 | choices: ['start', 'stop', 'status', 'restart', 'list', 'logs'] as const, |
| 37 | demandOption: true, |
| 38 | }) |
| 39 | .option('daemon-log-path', { |
| 40 | type: 'string', |
| 41 | describe: 'Override daemon log file path (start/restart only)', |
| 42 | }) |
| 43 | .option('daemon-log-level', { |
| 44 | type: 'string', |
| 45 | describe: 'Set daemon log level (start/restart only)', |
| 46 | choices: [ |
| 47 | 'none', |
| 48 | 'emergency', |
| 49 | 'alert', |
| 50 | 'critical', |
| 51 | 'error', |
| 52 | 'warn', |
| 53 | 'notice', |
| 54 | 'info', |
| 55 | 'debug', |
| 56 | ] as const, |
| 57 | coerce: coerceLogLevel, |
| 58 | }) |
| 59 | .option('tail', { |
| 60 | type: 'number', |
| 61 | default: 200, |
| 62 | describe: 'Number of log lines to show (logs action)', |
| 63 | }) |
| 64 | .option('foreground', { |
| 65 | alias: 'f', |
| 66 | type: 'boolean', |
| 67 | default: false, |
| 68 | describe: 'Run daemon in foreground (for debugging)', |
| 69 | }) |
| 70 | .option('json', { |
| 71 | type: 'boolean', |
| 72 | default: false, |
| 73 | describe: 'Output in JSON format (for list command)', |
| 74 | }) |
| 75 | .option('all', { |
| 76 | type: 'boolean', |
| 77 | default: true, |
| 78 | describe: 'Include stale daemons in list', |
| 79 | }); |
| 80 | }, |
| 81 | async (argv) => { |
| 82 | const action = argv.action as string; |
| 83 | // Socket path comes from global --socket which defaults to workspace socket |
| 84 | const socketPath = argv.socket as string; |
| 85 | const client = new DaemonClient({ socketPath }); |
no test coverage detected