fix(macos): honor pnpm/node when locating clawdis for health
parent
96ae0dd23a
commit
a3bf0d6002
|
|
@ -93,8 +93,8 @@ final class HealthStore: ObservableObject {
|
||||||
self.isRefreshing = true
|
self.isRefreshing = true
|
||||||
defer { self.isRefreshing = false }
|
defer { self.isRefreshing = false }
|
||||||
|
|
||||||
guard CommandResolver.clawdisExecutable() != nil else {
|
guard CommandResolver.hasAnyClawdisInvoker() else {
|
||||||
self.lastError = "clawdis CLI not found; install the CLI (pnpm) or symlink it into PATH"
|
self.lastError = "clawdis CLI not found; install deps in the configured project root or add it to PATH"
|
||||||
if onDemand { self.snapshot = nil }
|
if onDemand { self.snapshot = nil }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,13 +228,24 @@ enum CommandResolver {
|
||||||
self.findExecutable(named: self.helperName)
|
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] {
|
static func clawdisCommand(subcommand: String, extraArgs: [String] = []) -> [String] {
|
||||||
if let clawdisPath = self.clawdisExecutable() {
|
if let clawdisPath = self.clawdisExecutable() {
|
||||||
return [clawdisPath, subcommand] + extraArgs
|
return [clawdisPath, subcommand] + extraArgs
|
||||||
}
|
}
|
||||||
if let node = self.findExecutable(named: "node") {
|
if let node = self.findExecutable(named: "node") {
|
||||||
let cli = self.projectRoot().appendingPathComponent("bin/clawdis.js").path
|
if let cli = self.nodeCliPath() {
|
||||||
if FileManager.default.isReadableFile(atPath: cli) {
|
|
||||||
return [node, cli, subcommand] + extraArgs
|
return [node, cli, subcommand] + extraArgs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue