fix(macos): honor pnpm/node when locating clawdis for health

This commit is contained in:
Peter Steinberger
2025-12-07 15:07:38 +01:00
parent 96ae0dd23a
commit a3bf0d6002
2 changed files with 15 additions and 4 deletions

View File

@@ -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
}
}