From 96ae0dd23a58b9a8a609168c6c03c00441955416 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 7 Dec 2025 15:03:05 +0100 Subject: [PATCH] fix(macos): handle missing clawdis CLI for health check --- apps/macos/Sources/Clawdis/HealthStore.swift | 6 ++++++ apps/macos/Sources/Clawdis/Utilities.swift | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/macos/Sources/Clawdis/HealthStore.swift b/apps/macos/Sources/Clawdis/HealthStore.swift index 7687aacf2..44059efd5 100644 --- a/apps/macos/Sources/Clawdis/HealthStore.swift +++ b/apps/macos/Sources/Clawdis/HealthStore.swift @@ -93,6 +93,12 @@ final class HealthStore: ObservableObject { self.isRefreshing = true defer { self.isRefreshing = false } + guard CommandResolver.clawdisExecutable() != nil else { + self.lastError = "clawdis CLI not found; install the CLI (pnpm) or symlink it into PATH" + if onDemand { self.snapshot = nil } + return + } + let response = await ShellRunner.run( command: CommandResolver.clawdisCommand(subcommand: "health", extraArgs: ["--json"]), cwd: nil, diff --git a/apps/macos/Sources/Clawdis/Utilities.swift b/apps/macos/Sources/Clawdis/Utilities.swift index 0480397dd..55c58c75f 100644 --- a/apps/macos/Sources/Clawdis/Utilities.swift +++ b/apps/macos/Sources/Clawdis/Utilities.swift @@ -176,6 +176,7 @@ enum CLIInstaller { enum CommandResolver { private static let projectRootDefaultsKey = "clawdis.relayProjectRootPath" + private static let helperName = "clawdis" static func projectRoot() -> URL { if let stored = UserDefaults.standard.string(forKey: self.projectRootDefaultsKey), @@ -223,8 +224,12 @@ enum CommandResolver { return nil } + static func clawdisExecutable() -> String? { + self.findExecutable(named: self.helperName) + } + static func clawdisCommand(subcommand: String, extraArgs: [String] = []) -> [String] { - if let clawdisPath = self.findExecutable(named: "clawdis") { + if let clawdisPath = self.clawdisExecutable() { return [clawdisPath, subcommand] + extraArgs } if let node = self.findExecutable(named: "node") {