Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(cua-driver): add `doctor` command to clean up legacy install bits
Francesco Bonaccib79df97ef641
diff --git a/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swift b/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swiftindex f7fc080191..bed1e59cde 100644--- a/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swift+++ b/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swift@@ -23,6 +23,7 @@ struct CuaDriverCommand: AsyncParsableCommand {MCPConfigCommand.self,UpdateCommand.self,DiagnoseCommand.self,+ DoctorCommand.self,])}@@ -98,6 +99,7 @@ struct CuaDriverEntryPoint {"config","update","diagnose",+ "doctor","help",]@@ -377,3 +379,83 @@ struct UpdateCommand: AsyncParsableCommand {}}}++/// `cua-driver doctor` — clean up stale install bits left from older versions.+///+/// v0.0.5 and earlier installed a weekly LaunchAgent at+/// `~/Library/LaunchAgents/com.trycua.cua_driver_updater.plist` and a companion+/// `/usr/local/bin/cua-driver-update` script. v0.0.6 dropped both in favor of+/// the explicit `cua-driver update` command, but users who upgraded via the+/// legacy auto-updater path still have these dead files lingering.+///+/// Removing the LaunchAgent stops the weekly cron from firing the stale+/// update script. The plist lives under `$HOME` (no sudo). The companion+/// script under `/usr/local/bin` is root-owned, so we print the exact+/// `sudo rm` command for the user to run if it still exists.+struct DoctorCommand: ParsableCommand {+ static let configuration = CommandConfiguration(+ commandName: "doctor",+ abstract: "Clean up stale install bits left from older cua-driver versions."+ )++ func run() throws {+ let home = FileManager.default.homeDirectoryForCurrentUser.path+ let legacyPlist = "\(home)/Library/LaunchAgents/com.trycua.cua_driver_updater.plist"+ let legacyScript = "/usr/local/bin/cua-driver-update"++ var removedCount = 0+ var manualSteps: [String] = []++ // LaunchAgent — no sudo needed, lives under $HOME.+ if FileManager.default.fileExists(atPath: legacyPlist) {+ // Best-effort unload before removal — tolerate failure since the+ // agent may not be loaded.+ let unload = Process()+ unload.executableURL = URL(fileURLWithPath: "/bin/launchctl")+ unload.arguments = ["unload", legacyPlist]+ unload.standardOutput = Pipe()+ unload.standardError = Pipe()+ try? unload.run()+ unload.waitUntilExit()++ do {+ try FileManager.default.removeItem(atPath: legacyPlist)+ print("✓ removed legacy LaunchAgent: \(legacyPlist)")+ removedCount += 1+ } catch {+ print("✗ could not remove \(legacyPlist): \(error)")+ }+ }++ // Update script — root-owned. Try without sudo first; on failure,+ // surface the exact command for the user to run manually.+ if FileManager.default.fileExists(atPath: legacyScript) {+ if FileManager.default.isWritableFile(atPath: legacyScript)+ && FileManager.default.isWritableFile(atPath: "/usr/local/bin")+ {+ do {+ try FileManager.default.removeItem(atPath: legacyScript)+ print("✓ removed legacy update script: \(legacyScript)")+ removedCount += 1+ } catch {+ manualSteps.append("sudo rm -f \(legacyScript)")+ }+ } else {+ manualSteps.append("sudo rm -f \(legacyScript)")+ }+ }++ if removedCount == 0 && manualSteps.isEmpty {+ print("Nothing to clean — install is up to date.")+ return+ }++ if !manualSteps.isEmpty {+ print("")+ print("The following needs to be removed manually (root-owned):")+ for step in manualSteps {+ print(" \(step)")+ }+ }+ }+}