From a3bf0d600237c46034a6d4cf034a913a633e183a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 7 Dec 2025 15:07:38 +0100 Subject: [PATCH] fix(macos): honor pnpm/node when locating clawdis for health --- apps/macos/Sources/Clawdis/HealthStore.swift | 4 ++-- apps/macos/Sources/Clawdis/Utilities.swift | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/apps/macos/Sources/Clawdis/HealthStore.swift b/apps/macos/Sources/Clawdis/HealthStore.swift index 44059efd5..47cde6035 100644 --- a/apps/macos/Sources/Clawdis/HealthStore.swift +++ b/apps/macos/Sources/Clawdis/HealthStore.swift @@ -93,8 +93,8 @@ 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" + guard CommandResolver.hasAnyClawdisInvoker() else { + self.lastError = "clawdis CLI not found; install deps in the configured project root or add it to PATH" if onDemand { self.snapshot = nil } return } diff --git a/apps/macos/Sources/Clawdis/Utilities.swift b/apps/macos/Sources/Clawdis/Utilities.swift index 55c58c75f..2393e5ccd 100644 --- a/apps/macos/Sources/Clawdis/Utilities.swift +++ b/apps/macos/Sources/Clawdis/Utilities.swift @@ -228,13 +228,24 @@ enum CommandResolver { self.findExecutable(named: self.helperName) } + static func nodeCliPath() -> String? { + let candidate = self.projectRoot().appendingPathComponent("bin/clawdis.js").path + return FileManager.default.isReadableFile(atPath: candidate) ? candidate : nil + } + + static func hasAnyClawdisInvoker() -> Bool { + if self.clawdisExecutable() != nil { return true } + if self.findExecutable(named: "pnpm") != nil { return true } + if self.findExecutable(named: "node") != nil, self.nodeCliPath() != nil { return true } + return false + } + static func clawdisCommand(subcommand: String, extraArgs: [String] = []) -> [String] { if let clawdisPath = self.clawdisExecutable() { return [clawdisPath, subcommand] + extraArgs } if let node = self.findExecutable(named: "node") { - let cli = self.projectRoot().appendingPathComponent("bin/clawdis.js").path - if FileManager.default.isReadableFile(atPath: cli) { + if let cli = self.nodeCliPath() { return [node, cli, subcommand] + extraArgs } }