(options: ServiceInstallOptions)
| 133 | } |
| 134 | |
| 135 | function installMacos(options: ServiceInstallOptions): void { |
| 136 | fs.mkdirSync(path.dirname(PLIST_PATH), { recursive: true }) |
| 137 | |
| 138 | if (fs.existsSync(PLIST_PATH)) { |
| 139 | launchctlUnload(PLIST_PATH) |
| 140 | } |
| 141 | |
| 142 | fs.writeFileSync(PLIST_PATH, buildPlist(options)) |
| 143 | launchctlLoad(PLIST_PATH) |
| 144 | |
| 145 | const port = options.port ?? 3110 |
| 146 | const host = options.host ?? '127.0.0.1' |
| 147 | writeMeta({ port, host, installedAt: new Date().toISOString() }) |
| 148 | |
| 149 | console.log(`\nChatLab is now running as a system service`) |
| 150 | console.log(` API: http://${host}:${port}`) |
| 151 | console.log(` Logs: ${LOG_FILE}`) |
| 152 | console.log(` Service: ${SERVICE_LABEL} (launchd)`) |
| 153 | console.log(`\nAuto-starts on login. Use \`chatlab stop\` to remove.\n`) |
| 154 | } |
| 155 | |
| 156 | function uninstallMacos(): void { |
| 157 | if (!fs.existsSync(PLIST_PATH)) { |
no test coverage detected