()
| 97 | } |
| 98 | |
| 99 | async function uninstall(): Promise<LifecycleResult> { |
| 100 | const plistPath = deps.plistPath(); |
| 101 | const installed = existsSync(plistPath); |
| 102 | if (!installed) { |
| 103 | deleteInstallPlan(); |
| 104 | return { ok: true, message: 'LaunchAgent was not installed; nothing to remove.' }; |
| 105 | } |
| 106 | const bootout = await deps.execLaunchctl([ |
| 107 | 'bootout', |
| 108 | `${deps.guiDomain()}/${KIMI_SERVER_LABEL}`, |
| 109 | ]); |
| 110 | |
| 111 | void bootout; |
| 112 | try { |
| 113 | rmSync(plistPath, { force: true }); |
| 114 | } catch (error) { |
| 115 | throw new Error( |
| 116 | `failed to remove plist ${plistPath}: ${error instanceof Error ? error.message : String(error)}`, |
| 117 | ); |
| 118 | } |
| 119 | deleteInstallPlan(); |
| 120 | return { ok: true, message: `LaunchAgent removed (${plistPath}).` }; |
| 121 | } |
| 122 | |
| 123 | async function start(): Promise<LifecycleResult> { |
| 124 | const plistPath = deps.plistPath(); |
nothing calls this directly
no test coverage detected