Your AI agent skills, finally organized. A macOS app to browse, edit, and manage skills across Claude Code, Cursor, Codex, Windsurf, and Amp.
Connect to remote servers to discover, browse, and edit skills. (#26)
Trent Kocurek6f3c41adb6be
diff --git a/Chops.xcodeproj/project.pbxproj b/Chops.xcodeproj/project.pbxprojindex 7b8e1fa..5cde62e 100644--- a/Chops.xcodeproj/project.pbxproj+++ b/Chops.xcodeproj/project.pbxproj@@ -12,7 +12,9 @@25A4FB387DB5BD96DB630C14 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 231C267216AF1BCA8628B667 /* AppState.swift */; };309B12E0B72A22C9772BBC99 /* ChopsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2787064DC7DF112E70C4E4D0 /* ChopsApp.swift */; };331F55021A7E6C9F0B666514 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 4338FC540625A275BBC9AAC9 /* Sparkle */; };+ 480681BAD19F7CAF6AE154A2 /* RemoteServersSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E684304D1723CA691F40335B /* RemoteServersSettingsView.swift */; };53C393C13E30EC439317509F /* ToolBadge.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B6AE242CAD6A285DD57079 /* ToolBadge.swift */; };+ 5B81DED237A60776ADB04134 /* RemoteServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3314080A44DEB895223E36D5 /* RemoteServer.swift */; };60A6711BAB0C3B8A3ACBF985 /* SkillParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5155D141EF812A3FE9ADF59C /* SkillParser.swift */; };6A8E0927D95BB14C9F377F4E /* SkillScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A5B26D335C1AFB6CDE8207 /* SkillScanner.swift */; };71E92A838AB4D1D6DC6174AF /* NewSkillSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = F02A00F80E4712872205EA7B /* NewSkillSheet.swift */; };@@ -28,6 +30,7 @@99EE8F6124FE91AC9576D6FD /* FileWatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAD26AA4787A2E0CDC86AADC /* FileWatcher.swift */; };9ED88D6237B36693ABE5CE85 /* HighlightrSyntaxHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57F2C41F08F6E1BEFC5ADD4 /* HighlightrSyntaxHighlighter.swift */; };A99BA179E0520DCDC98E1382 /* AppLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F45D5C8E8C732B2F4A867E43 /* AppLogger.swift */; };+ AAC4A3CBF2A9B4DF50608948 /* SSHService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6797D4AC1970DB9ACB5ACA73 /* SSHService.swift */; };AFDC3DAB708B352A7606F119 /* DiagnosticExporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5D3C2567FBF8DBA4DE957B3 /* DiagnosticExporter.swift */; };B5B95B9DA63A734F25470FF5 /* SchemaVersions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F8AA042D5D8A9F92F35CA3 /* SchemaVersions.swift */; };BD584933CCE2B650345C4CF1 /* ToolSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5487D9027B97F7E9EE9A1F4A /* ToolSource.swift */; };@@ -53,11 +56,13 @@27D6ED655F951177D2152351 /* Skill.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Skill.swift; sourceTree = "<group>"; };2CF7822031FD82A28978D9C5 /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };31B4DB87833D5160A11E39C9 /* SkillEditorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillEditorView.swift; sourceTree = "<group>"; };+ 3314080A44DEB895223E36D5 /* RemoteServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteServer.swift; sourceTree = "<group>"; };3A4F680B33C74A38FCF5ADD5 /* MDCParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MDCParser.swift; sourceTree = "<group>"; };4CA102A49ACFB23BC15794F8 /* CollectionListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionListView.swift; sourceTree = "<group>"; };5155D141EF812A3FE9ADF59C /* SkillParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillParser.swift; sourceTree = "<group>"; };5487D9027B97F7E9EE9A1F4A /* ToolSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolSource.swift; sourceTree = "<group>"; };60E0F71982C4AF0045962380 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };+ 6797D4AC1970DB9ACB5ACA73 /* SSHService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSHService.swift; sourceTree = "<group>"; };77E332B9970E6E3D00DCFBA3 /* SkillPreviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillPreviewView.swift; sourceTree = "<group>"; };7C77C5B30E6C885B39444E5B /* FrontmatterParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrontmatterParser.swift; sourceTree = "<group>"; };7FCD6C2A8BE68F553A9CA392 /* RegistrySheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrySheet.swift; sourceTree = "<group>"; };@@ -75,6 +80,7 @@CAD26AA4787A2E0CDC86AADC /* FileWatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileWatcher.swift; sourceTree = "<group>"; };D57F2C41F08F6E1BEFC5ADD4 /* HighlightrSyntaxHighlighter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightrSyntaxHighlighter.swift; sourceTree = "<group>"; };D5D3C2567FBF8DBA4DE957B3 /* DiagnosticExporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticExporter.swift; sourceTree = "<group>"; };+ E684304D1723CA691F40335B /* RemoteServersSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteServersSettingsView.swift; sourceTree = "<group>"; };E6A5B26D335C1AFB6CDE8207 /* SkillScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillScanner.swift; sourceTree = "<group>"; };F02A00F80E4712872205EA7B /* NewSkillSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewSkillSheet.swift; sourceTree = "<group>"; };F45D5C8E8C732B2F4A867E43 /* AppLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLogger.swift; sourceTree = "<group>"; };@@ -140,6 +146,7 @@isa = PBXGroup;children = (D5D3C2567FBF8DBA4DE957B3 /* DiagnosticExporter.swift */,+ E684304D1723CA691F40335B /* RemoteServersSettingsView.swift */,A924245DDDA4C6A59BE15567 /* SettingsView.swift */,);path = Settings;@@ -175,6 +182,7 @@5155D141EF812A3FE9ADF59C /* SkillParser.swift */,9FC9D3E83D8640CC258CF361 /* SkillRegistry.swift */,E6A5B26D335C1AFB6CDE8207 /* SkillScanner.swift */,+ 6797D4AC1970DB9ACB5ACA73 /* SSHService.swift */,);path = Services;sourceTree = "<group>";@@ -184,6 +192,7 @@children = (907E59B064AB8366B60BF611 /* AgentTarget.swift */,C9AFE1AF02B0F8057791C2A9 /* Collection.swift */,+ 3314080A44DEB895223E36D5 /* RemoteServer.swift */,B1F8AA042D5D8A9F92F35CA3 /* SchemaVersions.swift */,27D6ED655F951177D2152351 /* Skill.swift */,5487D9027B97F7E9EE9A1F4A /* ToolSource.swift */,@@ -320,6 +329,9 @@7FD1DE6640F9339D5E97E09A /* MDCParser.swift in Sources */,71E92A838AB4D1D6DC6174AF /* NewSkillSheet.swift in Sources */,98434D3DDFEEC7239F6F7B79 /* RegistrySheet.swift in Sources */,+ 5B81DED237A60776ADB04134 /* RemoteServer.swift in Sources */,+ 480681BAD19F7CAF6AE154A2 /* RemoteServersSettingsView.swift in Sources */,+ AAC4A3CBF2A9B4DF50608948 /* SSHService.swift in Sources */,B5B95B9DA63A734F25470FF5 /* SchemaVersions.swift in Sources */,F98B1E8579B139FD2A801650 /* SearchService.swift in Sources */,2263A0A3B358FBA099D0086D /* SettingsView.swift in Sources */,diff --git a/Chops/App/AppState.swift b/Chops/App/AppState.swiftindex 65c2e5d..e4c3b94 100644--- a/Chops/App/AppState.swift+++ b/Chops/App/AppState.swift@@ -15,4 +15,5 @@ enum SidebarFilter: Hashable {case favoritescase tool(ToolSource)case collection(String)+ case server(String)}diff --git a/Chops/App/ChopsApp.swift b/Chops/App/ChopsApp.swiftindex 9043166..9eebd93 100644--- a/Chops/App/ChopsApp.swift+++ b/Chops/App/ChopsApp.swift@@ -16,15 +16,11 @@ struct ChopsApp: App {}var sharedModelContainer: ModelContainer = {- let schema = Schema(versionedSchema: SchemaV1.self)+ let schema = Schema([Skill.self, SkillCollection.self, RemoteServer.self])let config = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)do {- return try ModelContainer(- for: schema,- migrationPlan: ChopsMigrationPlan.self,- configurations: [config]- )+ return try ModelContainer(for: schema, configurations: [config])} catch {fatalError("Could not create ModelContainer: \(error)")}diff --git a/Chops/App/ContentView.swift b/Chops/App/ContentView.swiftindex 34cec77..6d78c57 100644--- a/Chops/App/ContentView.swift+++ b/Chops/App/ContentView.swift@@ -66,6 +66,7 @@ struct ContentView: View {AppLogger.ui.notice("App started, beginning initial scan")let scanner = SkillScanner(modelContext: modelContext)self.scanner = scanner+ scanner.removeDeletedSkills()scanner.scanAll()var allPaths: [String] = []@@ -80,5 +81,10 @@ struct ContentView: View {watcher.watchDirectories(allPaths)self.fileWatcher = watcherAppLogger.ui.notice("File watchers active on \(allPaths.count) directories")++ // Sync remote servers in the background+ Task {+ await scanner.syncAllRemoteServers()+ }}}diff --git a/Chops/Models/RemoteServer.swift b/Chops/Models/RemoteServer.swiftnew file mode 100644index 0000000..64eb231--- /dev/null+++ b/Chops/Models/RemoteServer.swift@@ -0,0 +1,42 @@+import SwiftData+import Foundation++@Model+final class RemoteServer {+ @Attribute(.unique) var id: String+ var label: String+ var host: String+ var port: Int+ var username: String+ var skillsBasePath: String+ var sshKeyPath: String?+ var lastSyncDate: Date?+ var lastSyncError: String?++ @Relationship(deleteRule: .cascade, inverse: \Skill.remoteServer)+ var skills: [Skill]++ init(+ label: String,+ host: String,+ port: Int = 22,+ username: String,+ skillsBasePath: String+ ) {+ self.id = UUID().uuidString+ self.label = label+ self.host = host+ self.port = port+ self.username = username+ self.skillsBasePath = skillsBasePath+ self.skills = []+ }++ var sshDestination: String {+ "\(username)@\(host)"+ }++ var isOpenClaw: Bool {+ skillsBasePath.contains("openclaw")+ }+}diff --git a/Chops/Models/SchemaVersions.swift b/Chops/Models/SchemaVersions.swiftindex 9e2a815..c850448 100644--- a/Chops/Models/SchemaVersions.swift+++ b/Chops/Models/SchemaVersions.swift@@ -1,24 +1,5 @@import SwiftDataimport Foundation-// MARK: - V1: Current schema (post-UI-overhaul)--enum SchemaV1: VersionedSchema {- static var versionIdentifier: Schema.Version = Schema.Version(1, 0, 0)-- static var models: [any PersistentModel.Type] {- [Skill.self, SkillCollection.self]- }-}--// MARK: - Migration Plan--enum ChopsMigrationPlan: SchemaMigrationPlan {- static var schemas: [any VersionedSchema.Type] {- [SchemaV1.self]- }-- static var stages: [MigrationStage] {- []- }-}+// No versioned schema needed — SwiftData handles additive changes+// (new optional properties + new entities) via automatic lightweight migration.diff --git a/Chops/Models/Skill.swift b/Chops/Models/Skill.swiftindex 84f5f2f..d0d5d67 100644--- a/Chops/Models/Skill.swift+++ b/Chops/Models/Skill.swift@@ -18,6 +18,11 @@ final class Skill {var fileSize: Intvar isGlobal: Bool+ var remoteServer: RemoteServer?+ var remotePath: String?++ var isRemote: Bool { remoteServer != nil }+/// Comma-separated tool raw values (e.g. "claude,cursor,codex")var toolSourcesRaw: Stringdiff --git a/Chops/Models/ToolSource.swift b/Chops/Models/ToolSource.swiftindex f591a60..a36efab 100644--- a/Chops/Models/ToolSource.swift+++ b/Chops/Models/ToolSource.swift@@ -8,6 +8,7 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {case copilotcase aidercase amp+ case openclawcase customvar id: String { rawValue }@@ -21,6 +22,7 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {case .copilot: "Copilot"case .aider: "Aider"case .amp: "Amp"+ case .openclaw: "OpenClaw"case .custom: "Custom"}}@@ -35,6 +37,7 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {case .copilot: "airplane"case .aider: "wrench.and.screwdriver"case .amp: "bolt.fill"+ case .openclaw: "server.rack"case .custom: "folder"}}@@ -60,6 +63,7 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {case .copilot: .purplecase .aider: .yellowcase .amp: .pink+ case .openclaw: .indigocase .custom: .gray}}@@ -74,6 +78,7 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {case .copilot: return []case .aider: return []case .amp: return ["\(home)/.config/amp"]+ case .openclaw: return []case .custom: return []}}diff --git a/Chops/Resources/Assets.xcassets/tool-openclaw.imageset/Contents.json b/Chops/Resources/Assets.xcassets/tool-openclaw.imageset/Contents.jsonnew file mode 100644index 0000000..1c138b6--- /dev/null+++ b/Chops/Resources/Assets.xcassets/tool-openclaw.imageset/Contents.json@@ -0,0 +1,16 @@+{+ "images" : [+ {+ "filename" : "logo.svg",+ "idiom" : "universal"+ }+ ],+ "info" : {+ "author" : "xcode",+ "version" : 1+ },+ "properties" : {+ "preserves-vector-representation" : true,+ "template-rendering-intent" : "original"+ }+}diff --git a/Chops/Resources/Assets.xcassets/tool-openclaw.imageset/logo.svg b/Chops/Resources/Assets.xcassets/tool-openclaw.imageset/logo.svgnew file mode 100644index 0000000..f3601ad--- /dev/null+++ b/Chops/Resources/Assets.xcassets/tool-openclaw.imageset/logo.svg@@ -0,0 +1,60 @@+<?xml version="1.0" encoding="utf-8"?>+<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 16 16" aria-label="Pixel lobster">+ <rect width="16" height="16" fill="none"/>++ <g fill="#3a0a0d">+ <rect x="1" y="5" width="1" height="3"/>+ <rect x="2" y="4" width="1" height="1"/>+ <rect x="2" y="8" width="1" height="1"/>+ <rect x="3" y="3" width="1" height="1"/>+ <rect x="3" y="9" width="1" height="1"/>+ <rect x="4" y="2" width="1" height="1"/>+ <rect x="4" y="10" width="1" height="1"/>+ <rect x="5" y="2" width="6" height="1"/>+ <rect x="11" y="2" width="1" height="1"/>+ <rect x="12" y="3" width="1" height="1"/>+ <rect x="12" y="9" width="1" height="1"/>+ <rect x="13" y="4" width="1" height="1"/>+ <rect x="13" y="8" width="1" height="1"/>+ <rect x="14" y="5" width="1" height="3"/>+ <rect x="5" y="11" width="6" height="1"/>+ <rect x="4" y="12" width="1" height="1"/>+ <rect x="11" y="12" width="1" height="1"/>+ <rect x="3" y="13" width="1" height="1"/>+ <rect x="12" y="13" width="1" height="1"/>+ <rect x="5" y="14" width="6" height="1"/>+ </g>+++ <g fill="#ff4f40">+ <rect x="5" y="3" width="6" height="1"/>+ <rect x="4" y="4" width="8" height="1"/>+ <rect x="3" y="5" width="10" height="1"/>+ <rect x="3" y="6" width="10" height="1"/>+ <rect x="3" y="7" width="10" height="1"/>+ <rect x="4" y="8" width="8" height="1"/>+ <rect x="5" y="9" width="6" height="1"/>+ <rect x="5" y="12" width="6" height="1"/>+ <rect x="6" y="13" width="4" height="1"/>+ </g>+++ <g fill="#ff775f">+ <rect x="1" y="6" width="2" height="1"/>+ <rect x="2" y="5" width="1" height="1"/>+ <rect x="2" y="7" width="1" height="1"/>+ <rect x="13" y="6" width="2" height="1"/>+ <rect x="13" y="5" width="1" height="1"/>+ <rect x="13" y="7" width="1" height="1"/>+ </g>+++ <g fill="#081016">+ <rect x="6" y="5" width="1" height="1"/>+ <rect x="9" y="5" width="1" height="1"/>+ </g>+ <g fill="#f5fbff">+ <rect x="6" y="4" width="1" height="1"/>+ <rect x="9" y="4" width="1" height="1"/>+ </g>+</svg>\ No newline at end of filediff --git a/Chops/Services/SSHService.swift b/Chops/Services/SSHService.swiftnew file mode 100644index 0000000..73232e7--- /dev/null+++ b/Chops/Services/SSHService.swift@@ -0,0 +1,196 @@+import Foundation++enum SSHError: LocalizedError {+ case connectionFailed(String)+ case commandFailed(String)++ var errorDescription: String? {+ switch self {+ case .connectionFailed(let msg): "SSH connection failed: \(msg)"+ case .commandFailed(let msg): "SSH command failed: \(msg)"+ }+ }+}++enum SSHService {+ private static let sshPath = "/usr/bin/ssh"++ private static func baseArgs(for server: RemoteServer) -> [String] {+ let home = FileManager.default.homeDirectoryForCurrentUser.path+ var args = [+ "-p", "\(server.port)",+ "-o", "ConnectTimeout=10",+ "-o", "BatchMode=yes",+ "-o", "StrictHostKeyChecking=accept-new",+ ]++ if let keyPath = server.sshKeyPath, !keyPath.isEmpty {+ // User-specified key path (expand ~ if present)+ let resolved = keyPath.hasPrefix("~/")+ ? home + keyPath.dropFirst(1)+ : keyPath+ args += ["-i", resolved]+ } else {+ // Auto-discover common default key names+ let defaultKeys = ["id_ed25519", "id_rsa", "id_ecdsa"]+ for name in defaultKeys {+ let path = "\(home)/.ssh/\(name)"+ if FileManager.default.fileExists(atPath: path) {+ args += ["-i", path]+ break+ }+ }+ }++ args.append(server.sshDestination)+ return args+ }++ /// Escapes a string for safe use inside single quotes in a shell command.+ private static func shellEscape(_ value: String) -> String {+ "'" + value.replacingOccurrences(of: "'", with: "'\\''") + "'"+ }++ // MARK: - Public API++ static func testConnection(_ server: RemoteServer) async throws {+ let (_, stderr, code) = try await run(+ args: baseArgs(for: server) + ["echo", "ok"]+ )+ if code != 0 {+ throw SSHError.connectionFailed(stderr)+ }+ }++ /// Escapes a path for the remote shell, handling tilde expansion.+ /// Uses double quotes so `$HOME` expands while spaces are preserved.+ private static func shellQuotePath(_ path: String) -> String {+ var expanded = path+ if expanded.hasPrefix("~/") {+ expanded = "$HOME/" + expanded.dropFirst(2)+ } else if expanded == "~" {+ expanded = "$HOME"+ }+ // Double-quote: preserves $HOME expansion, protects spaces and globs+ let escaped = expanded.replacingOccurrences(of: "\"", with: "\\\"")+ return "\"\(escaped)\""+ }++ static func findSkills(_ server: RemoteServer) async throws -> [(path: String, content: String)] {+ let basePath = shellQuotePath(server.skillsBasePath)++ // Find all SKILL.md files under the base path+ let findCmd = "find \(basePath) -name 'SKILL.md' -type f 2>/dev/null"+ let (stdout, stderr, code) = try await run(+ args: baseArgs(for: server) + [findCmd]+ )++ if code != 0 {+ throw SSHError.connectionFailed(stderr.isEmpty ? "Connection failed (exit code \(code))" : stderr)+ }++ let paths = stdout.split(separator: "\n").map(String.init).filter { !$0.isEmpty }+ if paths.isEmpty { return [] }++ // Read all files in a single SSH call+ let catCmds = paths.map { "echo '---CHOPS_DELIM:\($0)---' && cat \(shellEscape($0))" }+ let combined = catCmds.joined(separator: " && ")+ let (content, _, _) = try await run(+ args: baseArgs(for: server) + [combined]+ )++ return parseDelimitedOutput(content)+ }++ static func readFile(_ server: RemoteServer, path: String) async throws -> String {+ let (stdout, stderr, code) = try await run(+ args: baseArgs(for: server) + ["cat \(shellEscape(path))"]+ )+ if code != 0 {+ throw SSHError.commandFailed(stderr)+ }+ return stdout+ }++ static func writeFile(_ server: RemoteServer, path: String, content: String) async throws {+ // Ensure parent directory exists, then write via stdin+ let escaped = shellEscape(path)+ let mkdirCmd = "mkdir -p \"$(dirname \(escaped))\" && cat > \(escaped)"+ let (_, stderr, code) = try await run(+ args: baseArgs(for: server) + [mkdirCmd],+ stdin: content+ )+ if code != 0 {+ throw SSHError.commandFailed(stderr)+ }+ }++ // MARK: - Private++ private static func run(args: [String], stdin stdinContent: String? = nil) async throws -> (stdout: String, stderr: String, exitCode: Int32) {+ try await withCheckedThrowingContinuation { continuation in+ DispatchQueue.global(qos: .userInitiated).async {+ let process = Process()+ process.executableURL = URL(fileURLWithPath: sshPath)+ process.arguments = args++ let stdoutPipe = Pipe()+ let stderrPipe = Pipe()+ process.standardOutput = stdoutPipe+ process.standardError = stderrPipe++ if let stdinContent {+ let stdinPipe = Pipe()+ process.standardInput = stdinPipe+ let data = stdinContent.data(using: .utf8) ?? Data()+ stdinPipe.fileHandleForWriting.write(data)+ stdinPipe.fileHandleForWriting.closeFile()+ }++ do {+ try process.run()+ process.waitUntilExit()++ let stdoutData = stdoutPipe.fileHandleForReading.readDataToEndOfFile()+ let stderrData = stderrPipe.fileHandleForReading.readDataToEndOfFile()+ let stdout = String(data: stdoutData, encoding: .utf8) ?? ""+ let stderr = String(data: stderrData, encoding: .utf8) ?? ""++ continuation.resume(returning: (stdout, stderr, process.terminationStatus))+ } catch {+ continuation.resume(throwing: SSHError.connectionFailed(error.localizedDescription))+ }+ }+ }+ }++ private static func parseDelimitedOutput(_ output: String) -> [(path: String, content: String)] {+ var results: [(path: String, content: String)] = []+ let lines = output.components(separatedBy: "\n")+ var currentPath: String?+ var currentLines: [String] = []++ for line in lines {+ if line.hasPrefix("---CHOPS_DELIM:") && line.hasSuffix("---") {+ // Save previous block+ if let path = currentPath {+ results.append((path: path, content: currentLines.joined(separator: "\n")))+ }+ // Extract path from delimiter+ let start = line.index(line.startIndex, offsetBy: 15)+ let end = line.index(line.endIndex, offsetBy: -3)+ currentPath = String(line[start..<end])+ currentLines = []+ } else {+ currentLines.append(line)+ }+ }++ // Save last block+ if let path = currentPath {+ results.append((path: path, content: currentLines.joined(separator: "\n")))+ }++ return results+ }+}diff --git a/Chops/Services/SkillParser.swift b/Chops/Services/SkillParser.swiftindex a9af814..2facce9 100644--- a/Chops/Services/SkillParser.swift+++ b/Chops/Services/SkillParser.swift@@ -12,7 +12,7 @@ enum SkillParser {return MDCParser.parse(content)}return FrontmatterParser.parse(content)- case .codex, .amp, .windsurf, .copilot, .aider, .custom:+ case .codex, .amp, .windsurf, .copilot, .aider, .openclaw, .custom:// Try frontmatter first, fall back to headinglet parsed = FrontmatterParser.parse(content)if !parsed.name.isEmpty { return parsed }diff --git a/Chops/Services/SkillScanner.swift b/Chops/Services/SkillScanner.swiftindex 3155b4e..fb79fd0 100644--- a/Chops/Services/SkillScanner.swift+++ b/Chops/Services/SkillScanner.swift@@ -263,12 +263,98 @@ final class SkillScanner {try? modelContext.save()}+ // MARK: - Remote Server Scanning++ func syncAllRemoteServers() async {+ let descriptor = FetchDescriptor<RemoteServer>()+ guard let servers = try? modelContext.fetch(descriptor) else { return }+ for server in servers {+ await scanRemoteServer(server)+ }+ }++ /// Scans a remote server for skills. Sets lastSyncError on failure.+ func scanRemoteServer(_ server: RemoteServer) async {+ do {+ let remoteSkills = try await SSHService.findSkills(server)+ var foundPaths = Set<String>()++ for (path, content) in remoteSkills {+ let resolvedPath = "remote://\(server.id)/\(path)"+ foundPaths.insert(resolvedPath)++ let parsed = FrontmatterParser.parse(content)+ let name: String+ if !parsed.name.isEmpty {+ name = parsed.name+ } else {+ // Derive name from parent directory+ let components = path.components(separatedBy: "/")+ let skillDirIndex = components.lastIndex(of: "SKILL.md").map { components.index(before: $0) }+ name = skillDirIndex.map { components[$0] } ?? "Unknown"+ }++ let predicate = #Predicate<Skill> { $0.resolvedPath == resolvedPath }+ let fetchDescriptor = FetchDescriptor<Skill>(predicate: predicate)++ if let existing = try? modelContext.fetch(fetchDescriptor).first {+ existing.content = parsed.content+ existing.name = name+ existing.skillDescription = parsed.description+ existing.frontmatter = parsed.frontmatter+ } else {+ let skill = Skill(+ filePath: resolvedPath,+ toolSource: .openclaw,+ isDirectory: true,+ name: name,+ skillDescription: parsed.description,+ content: parsed.content,+ frontmatter: parsed.frontmatter,+ isGlobal: true,+ resolvedPath: resolvedPath+ )+ skill.remoteServer = server+ skill.remotePath = path+ modelContext.insert(skill)+ }+ }++ // Remove skills that no longer exist on the server+ let serverID = server.id+ let remotePredicate = #Predicate<Skill> { $0.resolvedPath.starts(with: "remote://") }+ if let existingRemoteSkills = try? modelContext.fetch(FetchDescriptor<Skill>(predicate: remotePredicate)) {+ for skill in existingRemoteSkills {+ guard skill.remoteServer?.id == serverID else { continue }+ if !foundPaths.contains(skill.resolvedPath) {+ modelContext.delete(skill)+ }+ }+ }++ server.lastSyncDate = .now+ server.lastSyncError = nil+ try? modelContext.save()+ } catch {+ server.lastSyncError = error.localizedDescription+ try? modelContext.save()+ }+ }+func removeDeletedSkills() {let descriptor = FetchDescriptor<Skill>()guard let skills = try? modelContext.fetch(descriptor) else { return }let fm = FileManager.defaultfor skill in skills {+ // Remove orphaned remote skills (server was deleted)+ if skill.resolvedPath.hasPrefix("remote://") && skill.remoteServer == nil {+ modelContext.delete(skill)+ continue+ }++ // Remote skills are managed by scanRemoteServer(), skip here+ if skill.isRemote { continue }let validPaths = skill.installedPaths.filter { fm.fileExists(atPath: $0) }if validPaths.isEmpty {modelContext.delete(skill)diff --git a/Chops/Views/Detail/SkillDetailView.swift b/Chops/Views/Detail/SkillDetailView.swiftindex a39c499..672bed3 100644--- a/Chops/Views/Detail/SkillDetailView.swift+++ b/Chops/Views/Detail/SkillDetailView.swift@@ -67,13 +67,15 @@ struct SkillDetailView: View {.foregroundStyle(skill.isFavorite ? .yellow : .secondary)}}- ToolbarItem {- Button {- NSWorkspace.shared.selectFile(skill.filePath, inFileViewerRootedAtPath: "")- } label: {- Image(systemName: "folder")+ if !skill.isRemote {+ ToolbarItem {+ Button {+ NSWorkspace.shared.selectFile(skill.filePath, inFileViewerRootedAtPath: "")+ } label: {+ Image(systemName: "folder")+ }+ .help("Show in Finder")}- .help("Show in Finder")}ToolbarItem {Button {diff --git a/Chops/Views/Detail/SkillEditorView.swift b/Chops/Views/Detail/SkillEditorView.swiftindex 32543e3..86285ad 100644--- a/Chops/Views/Detail/SkillEditorView.swift+++ b/Chops/Views/Detail/SkillEditorView.swift@@ -11,6 +11,8 @@ final class SkillEditorDocument {}}var hasUnsavedChanges = false+ var isLoadingRemote = false+ var isSavingRemote = falsevar showingSaveError = falsevar saveErrorMessage = ""@@ -20,6 +22,24 @@ final class SkillEditorDocument {private var loadGeneration = 0func load(from skill: Skill) {+ if skill.isRemote {+ loadRemote(skill)+ } else {+ loadLocal(skill)+ }+ }++ func save(to skill: Skill) {+ if skill.isRemote {+ saveRemote(skill)+ } else {+ saveLocal(skill)+ }+ }++ // MARK: - Local++ private func loadLocal(_ skill: Skill) {isLoading = trueloadTask?.cancel()loadGeneration += 1@@ -53,7 +73,7 @@ final class SkillEditorDocument {}}- func save(to skill: Skill) {+ private func saveLocal(_ skill: Skill) {do {try editorContent.write(toFile: skill.filePath, atomically: true, encoding: .utf8)fullFileContent = editorContent@@ -78,6 +98,90 @@ final class SkillEditorDocument {}}+ // MARK: - Remote++ private func loadRemote(_ skill: Skill) {+ guard let server = skill.remoteServer, let remotePath = skill.remotePath else {+ editorContent = skill.content+ fullFileContent = skill.content+ return+ }++ loadTask?.cancel()+ loadGeneration += 1+ let generation = loadGeneration+ let fallbackContent = skill.content++ isLoading = true+ isLoadingRemote = true++ loadTask = Task {+ do {+ let content = try await SSHService.readFile(server, path: remotePath)+ guard !Task.isCancelled, loadGeneration == generation else { return }+ await MainActor.run {+ guard self.loadGeneration == generation else { return }+ editorContent = content+ fullFileContent = content+ isLoading = false+ isLoadingRemote = false+ hasUnsavedChanges = false+ showingSaveError = false+ saveErrorMessage = ""+ }+ } catch {+ guard !Task.isCancelled, loadGeneration == generation else { return }+ await MainActor.run {+ guard self.loadGeneration == generation else { return }+ editorContent = fallbackContent+ fullFileContent = fallbackContent+ isLoading = false+ isLoadingRemote = false+ hasUnsavedChanges = false+ saveErrorMessage = "Failed to load from server: \(error.localizedDescription)"+ showingSaveError = true+ }+ }+ }+ }++ private func saveRemote(_ skill: Skill) {+ guard let server = skill.remoteServer, let remotePath = skill.remotePath else {+ saveErrorMessage = "Missing remote server or path"+ showingSaveError = true+ return+ }++ isSavingRemote = true++ Task {+ do {+ try await SSHService.writeFile(server, path: remotePath, content: editorContent)+ await MainActor.run {+ fullFileContent = editorContent+ hasUnsavedChanges = false+ isSavingRemote = false++ let parsed = FrontmatterParser.parse(editorContent)+ if !parsed.name.isEmpty {+ skill.name = parsed.name+ }+ skill.skillDescription = parsed.description+ skill.content = parsed.content+ skill.frontmatter = parsed.frontmatter+ skill.fileModifiedDate = .now+ skill.fileSize = editorContent.utf8.count+ }+ } catch {+ await MainActor.run {+ saveErrorMessage = error.localizedDescription+ showingSaveError = true+ isSavingRemote = false+ }+ }+ }+ }+deinit {loadTask?.cancel()}@@ -88,17 +192,35 @@ struct SkillEditorView: View {var body: some View {ZStack(alignment: .topTrailing) {- HighlightedTextEditor(text: $document.editorContent)-- if document.hasUnsavedChanges {- Text("Modified")- .font(.caption)- .padding(.horizontal, 8)- .padding(.vertical, 4)- .background(.orange.opacity(0.2), in: Capsule())- .foregroundStyle(.orange)- .padding(12)+ if document.isLoadingRemote {+ VStack {+ ProgressView("Loading from server...")+ .padding()+ }+ .frame(maxWidth: .infinity, maxHeight: .infinity)+ } else {+ HighlightedTextEditor(text: $document.editorContent)+ }++ HStack(spacing: 6) {+ if document.isSavingRemote {+ ProgressView()+ .controlSize(.small)+ Text("Saving...")+ .font(.caption)+ .foregroundStyle(.secondary)+ }++ if document.hasUnsavedChanges {+ Text("Modified")+ .font(.caption)+ .padding(.horizontal, 8)+ .padding(.vertical, 4)+ .background(.orange.opacity(0.2), in: Capsule())+ .foregroundStyle(.orange)+ }}+ .padding(12)}}}diff --git a/Chops/Views/Detail/SkillMetadataBar.swift b/Chops/Views/Detail/SkillMetadataBar.swiftindex 8665642..34d10ef 100644--- a/Chops/Views/Detail/SkillMetadataBar.swift+++ b/Chops/Views/Detail/SkillMetadataBar.swift@@ -18,12 +18,24 @@ struct SkillMetadataBar: View {Divider().frame(height: 16)- Text(abbreviatedPath)+ if skill.isRemote, let server = skill.remoteServer {+ Label {+ Text(server.label)+ } icon: {+ Image(systemName: "server.rack")+ }+ .font(.caption)+ .foregroundStyle(.indigo)++ Divider().frame(height: 16)+ }++ Text(skill.isRemote ? (skill.remotePath ?? "") : abbreviatedPath).font(.caption).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle)- .help(installedPathsSummary)+ .help(skill.isRemote ? (skill.remotePath ?? "") : installedPathsSummary)Divider().frame(height: 16)diff --git a/Chops/Views/Settings/RemoteServersSettingsView.swift b/Chops/Views/Settings/RemoteServersSettingsView.swiftnew file mode 100644index 0000000..a17504a--- /dev/null+++ b/Chops/Views/Settings/RemoteServersSettingsView.swift@@ -0,0 +1,398 @@+import SwiftUI+import SwiftData++struct RemoteServersSettingsView: View {+ @Environment(\.modelContext) private var modelContext+ @Query(sort: \RemoteServer.label) private var servers: [RemoteServer]++ @State private var showingAddSheet = false++ var body: some View {+ VStack(alignment: .leading, spacing: 12) {+ Text("Remote Servers")+ .font(.headline)++ Text("Connect to remote servers to browse and edit skills via SSH. Requires key-based authentication.")+ .font(.caption)+ .foregroundStyle(.secondary)++ ScrollView {+ VStack(spacing: 8) {+ ForEach(servers) { server in+ ServerRow(server: server)+ if server.id != servers.last?.id {+ Divider()+ }+ }+ }+ }+ .frame(minHeight: 120)++ HStack {+ Spacer()+ Button("Add Server...") {+ showingAddSheet = true+ }+ }+ }+ .padding()+ .sheet(isPresented: $showingAddSheet) {+ AddServerSheet()+ }+ }+}++// MARK: - Server Row++private struct ServerRow: View {+ @Bindable var server: RemoteServer+ @Environment(\.modelContext) private var modelContext+ @State private var isTesting = false+ @State private var isSyncing = false+ @State private var testResult: TestResult?+ @State private var syncLog: String?+ @State private var showingEditSheet = false++ enum TestResult {+ case success+ case failure(String)+ }++ var body: some View {+ VStack(alignment: .leading, spacing: 6) {+ HStack {+ VStack(alignment: .leading, spacing: 2) {+ Text(server.label)+ .font(.body)+ Text("\(server.username)@\(server.host):\(server.port)")+ .font(.caption)+ .foregroundStyle(.secondary)+ .fontDesign(.monospaced)+ Text("Path: \(server.skillsBasePath)")+ .font(.caption2)+ .foregroundStyle(.tertiary)+ .fontDesign(.monospaced)+ if let lastSync = server.lastSyncDate {+ Text("Synced \(lastSync.formatted(.relative(presentation: .named)))")+ .font(.caption2)+ .foregroundStyle(.tertiary)+ }+ }++ Spacer()++ if let result = testResult {+ switch result {+ case .success:+ Image(systemName: "checkmark.circle.fill")+ .foregroundStyle(.green)+ case .failure:+ Image(systemName: "xmark.circle.fill")+ .foregroundStyle(.red)+ }+ }++ Button {+ testConnection()+ } label: {+ if isTesting {+ ProgressView()+ .controlSize(.small)+ } else {+ Text("Test")+ }+ }+ .disabled(isTesting)++ Button {+ syncNow()+ } label: {+ if isSyncing {+ ProgressView()+ .controlSize(.small)+ } else {+ Text("Sync")+ }+ }+ .disabled(isSyncing)++ Button {+ showingEditSheet = true+ } label: {+ Text("Edit")+ }++ Button(role: .destructive) {+ modelContext.delete(server)+ try? modelContext.save()+ } label: {+ Image(systemName: "minus.circle.fill")+ .foregroundStyle(.red)+ }+ .buttonStyle(.plain)+ }++ if let error = server.lastSyncError {+ Text("Error: \(error)")+ .font(.caption)+ .foregroundStyle(.red)+ .textSelection(.enabled)+ }++ if let log = syncLog {+ Text(log)+ .font(.caption)+ .fontDesign(.monospaced)+ .foregroundStyle(.secondary)+ .textSelection(.enabled)+ .padding(6)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(.quaternary.opacity(0.5))+ .clipShape(RoundedRectangle(cornerRadius: 4))+ }+ }+ .sheet(isPresented: $showingEditSheet) {+ EditServerSheet(server: server)+ }+ }++ private func testConnection() {+ isTesting = true+ testResult = nil+ Task {+ do {+ try await SSHService.testConnection(server)+ await MainActor.run {+ testResult = .success+ isTesting = false+ }+ } catch {+ await MainActor.run {+ testResult = .failure(error.localizedDescription)+ isTesting = false+ }+ }+ }+ }++ private func syncNow() {+ isSyncing = true+ syncLog = "Connecting to \(server.sshDestination)..."+ Task { @MainActor in+ do {+ let skills = try await SSHService.findSkills(server)+ if skills.isEmpty {+ syncLog = "find returned 0 results.\nPath searched: \(server.skillsBasePath)\nCommand: find <path> -name 'SKILL.md' -type f"+ } else {+ let scanner = SkillScanner(modelContext: modelContext)+ await scanner.scanRemoteServer(server)+ syncLog = "Found \(skills.count) skill(s):\n" + skills.map { " \($0.path)" }.joined(separator: "\n")+ }+ } catch {+ syncLog = "Sync failed: \(error.localizedDescription)"+ }+ isSyncing = false+ }+ }+}++// MARK: - Add Server Sheet++private struct AddServerSheet: View {+ @Environment(\.modelContext) private var modelContext+ @Environment(\.dismiss) private var dismiss++ @State private var label = ""+ @State private var host = ""+ @State private var port = "22"+ @State private var username = ""+ @State private var basePath = ""+ @State private var sshKeyPath = ""+ @State private var isTesting = false+ @State private var testPassed = false+ @State private var testError: String?++ var body: some View {+ VStack(spacing: 16) {+ Text("Add Remote Server")+ .font(.headline)++ Form {+ TextField("Label", text: $label, prompt: Text("Production Server"))+ TextField("Host", text: $host, prompt: Text("192.168.1.100"))+ TextField("Port", text: $port, prompt: Text("22"))+ TextField("Username", text: $username, prompt: Text("root"))+ TextField("Skills Base Path", text: $basePath, prompt: Text("e.g. ~/.openclaw, ~/skills"))+ TextField("SSH Key Path", text: $sshKeyPath, prompt: Text("Optional — e.g. ~/.ssh/id_ed25519"))+ }+ .formStyle(.grouped)++ if let testError {+ Text(testError)+ .font(.caption)+ .foregroundStyle(.red)+ }++ if testPassed {+ Label("Connection successful", systemImage: "checkmark.circle.fill")+ .foregroundStyle(.green)+ .font(.caption)+ }++ HStack {+ Button("Cancel") {+ dismiss()+ }+ .keyboardShortcut(.cancelAction)++ Spacer()++ Button("Test Connection") {+ testConnection()+ }+ .disabled(host.isEmpty || username.isEmpty || isTesting)++ Button("Add") {+ addServer()+ dismiss()+ }+ .keyboardShortcut(.defaultAction)+ .disabled(label.isEmpty || host.isEmpty || username.isEmpty || basePath.isEmpty)+ }+ }+ .padding()+ .frame(width: 400)+ }++ private func testConnection() {+ isTesting = true+ testPassed = false+ testError = nil++ let server = RemoteServer(+ label: label,+ host: host,+ port: Int(port) ?? 22,+ username: username,+ skillsBasePath: basePath+ )+ server.sshKeyPath = sshKeyPath.isEmpty ? nil : sshKeyPath++ Task {+ do {+ try await SSHService.testConnection(server)+ await MainActor.run {+ testPassed = true+ isTesting = false+ }+ } catch {+ await MainActor.run {+ testError = error.localizedDescription+ isTesting = false+ }+ }+ }+ }++ private func addServer() {+ let server = RemoteServer(+ label: label,+ host: host,+ port: Int(port) ?? 22,+ username: username,+ skillsBasePath: basePath+ )+ server.sshKeyPath = sshKeyPath.isEmpty ? nil : sshKeyPath+ modelContext.insert(server)+ try? modelContext.save()++ Task {+ let scanner = SkillScanner(modelContext: modelContext)+ await scanner.scanRemoteServer(server)+ }+ }+}++// MARK: - Edit Server Sheet++private struct EditServerSheet: View {+ @Bindable var server: RemoteServer+ @Environment(\.modelContext) private var modelContext+ @Environment(\.dismiss) private var dismiss++ @State private var label: String = ""+ @State private var host: String = ""+ @State private var port: String = ""+ @State private var username: String = ""+ @State private var basePath: String = ""+ @State private var sshKeyPath: String = ""++ var body: some View {+ VStack(spacing: 16) {+ Text("Edit Server")+ .font(.headline)++ Form {+ TextField("Label", text: $label, prompt: Text("Production Server"))+ TextField("Host", text: $host, prompt: Text("192.168.1.100"))+ TextField("Port", text: $port, prompt: Text("22"))+ TextField("Username", text: $username, prompt: Text("root"))+ TextField("Skills Base Path", text: $basePath, prompt: Text("e.g. ~/.openclaw, ~/skills"))+ TextField("SSH Key Path", text: $sshKeyPath, prompt: Text("Optional — e.g. ~/.ssh/id_ed25519"))+ }+ .formStyle(.grouped)++ HStack {+ Button("Cancel") {+ dismiss()+ }+ .keyboardShortcut(.cancelAction)++ Spacer()++ Button("Save") {+ let connectionChanged = server.host != host+ || server.username != username+ || server.skillsBasePath != basePath+ || server.port != (Int(port) ?? 22)++ server.label = label+ server.host = host+ server.port = Int(port) ?? 22+ server.username = username+ server.skillsBasePath = basePath+ server.sshKeyPath = sshKeyPath.isEmpty ? nil : sshKeyPath++ if connectionChanged {+ // Purge stale skills — they may point to files on the old target+ for skill in server.skills {+ modelContext.delete(skill)+ }+ }++ try? modelContext.save()+ dismiss()++ if connectionChanged {+ Task {+ let scanner = SkillScanner(modelContext: modelContext)+ await scanner.scanRemoteServer(server)+ }+ }+ }+ .keyboardShortcut(.defaultAction)+ .disabled(label.isEmpty || host.isEmpty || username.isEmpty || basePath.isEmpty)+ }+ }+ .padding()+ .frame(width: 400)+ .onAppear {+ label = server.label+ host = server.host+ port = "\(server.port)"+ username = server.username+ basePath = server.skillsBasePath+ sshKeyPath = server.sshKeyPath ?? ""+ }+ }+}diff --git a/Chops/Views/Settings/SettingsView.swift b/Chops/Views/Settings/SettingsView.swiftindex c0348d2..cb10d14 100644--- a/Chops/Views/Settings/SettingsView.swift+++ b/Chops/Views/Settings/SettingsView.swift@@ -22,12 +22,17 @@ struct SettingsView: View {Label("Scan Directories", systemImage: "folder.badge.gearshape")}+ RemoteServersSettingsView()+ .tabItem {+ Label("Servers", systemImage: "server.rack")+ }+aboutView.tabItem {Label("About", systemImage: "info.circle")}}- .frame(width: 480, height: 320)+ .frame(width: 480, height: 380).onAppear {loadCustomPaths()}diff --git a/Chops/Views/Shared/ToolBadge.swift b/Chops/Views/Shared/ToolBadge.swiftindex 15992d7..d1f5137 100644--- a/Chops/Views/Shared/ToolBadge.swift+++ b/Chops/Views/Shared/ToolBadge.swift@@ -43,6 +43,7 @@ extension ToolSource {case .copilot: "CP"case .aider: "AI"case .amp: "AM"+ case .openclaw: "OC"case .custom: "?"}}diff --git a/Chops/Views/Sidebar/SidebarView.swift b/Chops/Views/Sidebar/SidebarView.swiftindex 866c367..06de72a 100644--- a/Chops/Views/Sidebar/SidebarView.swift+++ b/Chops/Views/Sidebar/SidebarView.swift@@ -3,8 +3,13 @@ import SwiftDatastruct SidebarView: View {@Environment(AppState.self) private var appState+ @Environment(\.modelContext) private var modelContext@Query(sort: \Skill.name) private var allSkills: [Skill]@Query(sort: \SkillCollection.sortOrder) private var collections: [SkillCollection]+ @Query(sort: \RemoteServer.label) private var servers: [RemoteServer]+ @State private var syncingServerIDs: Set<String> = []+ @State private var serverErrors: [String: String] = [:]+ @State private var showingErrorForServer: String?private var activeSources: [ToolSource] {ToolSource.allCases.filter { tool in@@ -42,6 +47,59 @@ struct SidebarView: View {}}+ if !servers.isEmpty {+ Section("Servers") {+ ForEach(servers) { server in+ HStack {+ Label {+ Text(server.label)+ } icon: {+ Image(systemName: "server.rack")+ .foregroundStyle(.secondary)+ }++ Spacer()++ if let error = serverErrors[server.id] {+ Image(systemName: "exclamationmark.triangle.fill")+ .font(.caption)+ .foregroundStyle(.red)+ .popover(isPresented: Binding(+ get: { showingErrorForServer == server.id },+ set: { if !$0 { showingErrorForServer = nil } }+ )) {+ Text(error)+ .font(.caption)+ .padding()+ .frame(maxWidth: 250)+ }+ .onTapGesture {+ showingErrorForServer = server.id+ }+ }++ Button {+ syncServer(server)+ } label: {+ if syncingServerIDs.contains(server.id) {+ ProgressView()+ .controlSize(.small)+ } else {+ Image(systemName: "arrow.triangle.2.circlepath")+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ }+ .buttonStyle(.plain)+ .help("Sync skills from server")+ .disabled(syncingServerIDs.contains(server.id))+ }+ .badge(server.skills.count)+ .tag(SidebarFilter.server(server.id))+ }+ }+ }+Section("Collections") {CollectionListView()}@@ -49,4 +107,19 @@ struct SidebarView: View {.listStyle(.sidebar).navigationTitle("Chops")}++ private func syncServer(_ server: RemoteServer) {+ syncingServerIDs.insert(server.id)+ serverErrors.removeValue(forKey: server.id)+ Task {+ let scanner = SkillScanner(modelContext: modelContext)+ await scanner.scanRemoteServer(server)+ await MainActor.run {+ syncingServerIDs.remove(server.id)+ if let error = server.lastSyncError {+ serverErrors[server.id] = error+ }+ }+ }+ }}diff --git a/Chops/Views/Sidebar/SkillListView.swift b/Chops/Views/Sidebar/SkillListView.swiftindex 8113fa3..5f0c558 100644--- a/Chops/Views/Sidebar/SkillListView.swift+++ b/Chops/Views/Sidebar/SkillListView.swift@@ -35,6 +35,8 @@ struct SkillListView: View {result = result.filter { skill inskill.collections.contains { $0.name == collName }}+ case .server(let serverID):+ result = result.filter { $0.remoteServer?.id == serverID }}if !appState.searchText.isEmpty {@@ -54,6 +56,8 @@ struct SkillListView: View {case .favorites: "Favorites"case .tool(let tool): tool.displayNamecase .collection(let name): name+ case .server(let id):+ allSkills.first(where: { $0.remoteServer?.id == id })?.remoteServer?.label ?? "Remote Skills"}}@@ -82,9 +86,11 @@ struct SkillListView: View {skill.isFavorite.toggle()try? modelContext.save()}- Divider()- Button("Show in Finder") {- NSWorkspace.shared.selectFile(skill.filePath, inFileViewerRootedAtPath: "")+ if !skill.isRemote {+ Divider()+ Button("Show in Finder") {+ NSWorkspace.shared.selectFile(skill.filePath, inFileViewerRootedAtPath: "")+ }}Divider()Button("Delete", role: .destructive) {@@ -141,7 +147,12 @@ struct SkillRow: View {Spacer()- if let project = skill.projectName {+ if skill.isRemote, let serverLabel = skill.remoteServer?.label {+ Text(serverLabel)+ .font(.caption)+ .foregroundStyle(.tertiary)+ .lineLimit(1)+ } else if let project = skill.projectName {Text(project).font(.caption).foregroundStyle(.tertiary)