fix(macos): honor pnpm/node when locating clawdis for health
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user