(argv: string[])
| 95 | ]; |
| 96 | |
| 97 | export async function runDaemonCommand(argv: string[]): Promise<void> { |
| 98 | const options = parseDaemonCommandArgs(argv); |
| 99 | if (options.subcommand === 'install') { |
| 100 | const plan = await buildDaemonInstallPlan(options); |
| 101 | if (options.dryRun) { |
| 102 | printInstallPlan(plan); |
| 103 | return; |
| 104 | } |
| 105 | await installDaemon(plan); |
| 106 | printInstallSuccess(plan); |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | if (options.dryRun) { |
| 111 | throw new Error('--dry-run is only supported for daemon install.'); |
| 112 | } |
| 113 | |
| 114 | switch (options.subcommand) { |
| 115 | case 'start': |
| 116 | await startDaemon(); |
| 117 | return; |
| 118 | case 'stop': |
| 119 | await stopDaemon(); |
| 120 | return; |
| 121 | case 'restart': |
| 122 | await restartDaemon(); |
| 123 | return; |
| 124 | case 'status': |
| 125 | await statusDaemon(); |
| 126 | return; |
| 127 | case 'logs': |
| 128 | await logsDaemon({ follow: options.follow, lines: options.lines }); |
| 129 | return; |
| 130 | case 'uninstall': |
| 131 | await uninstallDaemon(); |
| 132 | return; |
| 133 | default: |
| 134 | throw new Error(`Unsupported daemon subcommand: ${String(options.subcommand)}`); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | export async function runDaemonSupervisor(argv: string[]): Promise<void> { |
| 139 | const options = parseSupervisorArgs(argv); |
no test coverage detected