fix(macos): handle missing clawdis CLI for health check
This commit is contained in:
@@ -93,6 +93,12 @@ final class HealthStore: ObservableObject {
|
|||||||
self.isRefreshing = true
|
self.isRefreshing = true
|
||||||
defer { self.isRefreshing = false }
|
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(
|
let response = await ShellRunner.run(
|
||||||
command: CommandResolver.clawdisCommand(subcommand: "health", extraArgs: ["--json"]),
|
command: CommandResolver.clawdisCommand(subcommand: "health", extraArgs: ["--json"]),
|
||||||
cwd: nil,
|
cwd: nil,
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ enum CLIInstaller {
|
|||||||
|
|
||||||
enum CommandResolver {
|
enum CommandResolver {
|
||||||
private static let projectRootDefaultsKey = "clawdis.relayProjectRootPath"
|
private static let projectRootDefaultsKey = "clawdis.relayProjectRootPath"
|
||||||
|
private static let helperName = "clawdis"
|
||||||
|
|
||||||
static func projectRoot() -> URL {
|
static func projectRoot() -> URL {
|
||||||
if let stored = UserDefaults.standard.string(forKey: self.projectRootDefaultsKey),
|
if let stored = UserDefaults.standard.string(forKey: self.projectRootDefaultsKey),
|
||||||
@@ -223,8 +224,12 @@ enum CommandResolver {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func clawdisExecutable() -> String? {
|
||||||
|
self.findExecutable(named: self.helperName)
|
||||||
|
}
|
||||||
|
|
||||||
static func clawdisCommand(subcommand: String, extraArgs: [String] = []) -> [String] {
|
static func clawdisCommand(subcommand: String, extraArgs: [String] = []) -> [String] {
|
||||||
if let clawdisPath = self.findExecutable(named: "clawdis") {
|
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") {
|
||||||
|
|||||||
Reference in New Issue
Block a user