()
| 273 | /* ---------- Status read ----------------------------------------------- */ |
| 274 | |
| 275 | export async function getCliInstallStatus(): Promise<CliInstallStatus> { |
| 276 | const supportedPlatform = process.platform === 'darwin' || process.platform === 'linux' |
| 277 | if (!supportedPlatform) { |
| 278 | return { |
| 279 | available: false, |
| 280 | reason: 'CLI install is currently macOS- and Linux-only. Windows support is on the way.', |
| 281 | defaultTarget: '', |
| 282 | requiresSudo: false, |
| 283 | targetOnPath: false, |
| 284 | pathHint: null, |
| 285 | installedAt: null, |
| 286 | installedByThisApp: false, |
| 287 | supportedPlatform: false |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | const wrapper = await locateWrapper() |
| 292 | const target = await pickInstallTarget() |
| 293 | const existing = await findExistingInstall(wrapper) |
| 294 | |
| 295 | return { |
| 296 | available: wrapper != null, |
| 297 | reason: wrapper |
| 298 | ? null |
| 299 | : 'The CLI has not been built yet. Run `npm run build` (or use a packaged build) so Settings has a wrapper to install.', |
| 300 | defaultTarget: target.linkPath, |
| 301 | requiresSudo: target.requiresSudo, |
| 302 | targetOnPath: target.onPath, |
| 303 | pathHint: target.pathHint, |
| 304 | installedAt: existing?.linkPath ?? null, |
| 305 | installedByThisApp: existing?.installedByThisApp ?? false, |
| 306 | supportedPlatform: true |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Remove ZenNotes-managed symlinks with the given names across candidate dirs — |
no test coverage detected