Skip to content

armgit / chops

Public Imported from GitHub
0

Your AI agent skills, finally organized. A macOS app to browse, edit, and manage skills across Claude Code, Cursor, Codex, Windsurf, and Amp.

feat: Add OpenClaw local skill detection (#75)

hnshahef6c61471339
diff --git a/Chops/Models/Skill.swift b/Chops/Models/Skill.swift
index c37d6b7..95f5f37 100644
--- a/Chops/Models/Skill.swift
+++ b/Chops/Models/Skill.swift
@@ -59,6 +59,10 @@ final class Skill {
toolSources.contains(.claudeDesktop)
}
+ var isReadOnly: Bool {
+ isPlugin || isBundledOpenClawSkill
+ }
+
/// Comma-separated tool raw values (e.g. "claude,cursor,codex")
var toolSourcesRaw: String
@@ -131,6 +135,11 @@ final class Skill {
/// How many tools this skill is installed for
var installCount: Int { toolSources.count }
+ private var isBundledOpenClawSkill: Bool {
+ filePath.hasPrefix("/opt/homebrew/lib/node_modules/openclaw/skills/")
+ || filePath.hasPrefix("/usr/local/lib/node_modules/openclaw/skills/")
+ }
+
/// For project-level skills, extracts the project name from the path.
/// e.g. ~/Development/every-expert/.claude/skills/foo/SKILL.md → "every-expert"
var projectName: String? {
diff --git a/Chops/Models/ToolSource.swift b/Chops/Models/ToolSource.swift
index be6b0c2..d303bd5 100644
--- a/Chops/Models/ToolSource.swift
+++ b/Chops/Models/ToolSource.swift
@@ -22,7 +22,7 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {
/// Whether this tool should appear in the sidebar tools list.
var listable: Bool {
switch self {
- case .custom, .openclaw, .claudeDesktop, .agents, .aider:
+ case .custom, .claudeDesktop, .agents, .aider:
return false
default:
return true
@@ -134,7 +134,35 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {
case .copilot: return ["\(home)/.copilot/skills"]
case .aider: return []
case .amp: return ["\(configHome)/amp/skills"]
- case .openclaw: return []
+ case .openclaw:
+ var paths: [String] = []
+ // Main skills directory
+ if FileManager.default.fileExists(atPath: "\(home)/.openclaw/skills") {
+ paths.append("\(home)/.openclaw/skills")
+ }
+ // Workspace skills (search all workspace dirs)
+ let openclawDir = URL(fileURLWithPath: "\(home)/.openclaw")
+ if let workspaces = try? FileManager.default.contentsOfDirectory(
+ at: openclawDir,
+ includingPropertiesForKeys: [.isDirectoryKey],
+ options: [.skipsHiddenFiles]
+ ) {
+ for workspace in workspaces {
+ let skillsPath = workspace.appendingPathComponent("skills")
+ if FileManager.default.fileExists(atPath: skillsPath.path) {
+ paths.append(skillsPath.path)
+ }
+ }
+ }
+ // NPM global installation (ARM Mac)
+ if FileManager.default.fileExists(atPath: "/opt/homebrew/lib/node_modules/openclaw/skills") {
+ paths.append("/opt/homebrew/lib/node_modules/openclaw/skills")
+ }
+ // NPM global installation (Intel Mac)
+ if FileManager.default.fileExists(atPath: "/usr/local/lib/node_modules/openclaw/skills") {
+ paths.append("/usr/local/lib/node_modules/openclaw/skills")
+ }
+ return paths
case .opencode: return ["\(configHome)/opencode/skills"]
case .pi: return ["\(home)/.pi/agent/skills"]
case .agents: return ["\(home)/.agents/skills"]
@@ -217,7 +245,13 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {
|| globalPaths.contains { fm.fileExists(atPath: $0) }
case .claudeDesktop:
return Self.appBundleExists("Claude")
- case .aider, .openclaw, .custom:
+ case .openclaw:
+ return fm.fileExists(atPath: "\(home)/.openclaw")
+ || Self.cliBinaryExists("openclaw")
+ || fm.fileExists(atPath: "/opt/homebrew/lib/node_modules/openclaw")
+ || fm.fileExists(atPath: "/usr/local/lib/node_modules/openclaw")
+ || globalPaths.contains { fm.fileExists(atPath: $0) }
+ case .aider, .custom:
return true
}
}
diff --git a/Chops/Views/Detail/SkillDetailView.swift b/Chops/Views/Detail/SkillDetailView.swift
index a0ddb7f..79ba6fd 100644
--- a/Chops/Views/Detail/SkillDetailView.swift
+++ b/Chops/Views/Detail/SkillDetailView.swift
@@ -91,10 +91,10 @@ struct SkillDetailView: View {
if preferPreview {
SkillPreviewView(content: document.editorContent)
} else {
- SkillEditorView(document: document, isEditable: !skill.isPlugin)
+ SkillEditorView(document: document, isEditable: !skill.isReadOnly)
}
- if !showingComposePanel && !skill.isPlugin {
+ if !showingComposePanel && !skill.isReadOnly {
composeFloatingButton
}
}
@@ -128,7 +128,7 @@ struct SkillDetailView: View {
document.load(from: skill)
}
.onChange(of: document.editorContent) {
- guard !skill.isPlugin else { return }
+ guard !skill.isReadOnly else { return }
autoSaveTask?.cancel()
autoSaveTask = Task {
try? await Task.sleep(for: .seconds(1))
@@ -140,6 +140,7 @@ struct SkillDetailView: View {
autoSaveTask?.cancel()
}
.onReceive(NotificationCenter.default.publisher(for: .saveCurrentSkill)) { _ in
+ guard !skill.isReadOnly else { return }
document.save(to: skill)
}
.alert("Save Error", isPresented: $document.showingSaveError) {
@@ -174,13 +175,15 @@ struct SkillDetailView: View {
.help("Show in Finder")
}
}
- ToolbarItem {
- Button {
- activeAlert = .confirmDelete
- } label: {
- Image(systemName: "trash")
+ if !skill.isReadOnly {
+ ToolbarItem {
+ Button {
+ activeAlert = .confirmDelete
+ } label: {
+ Image(systemName: "trash")
+ }
+ .help("Delete \(skill.displayTypeName)")
}
- .help("Delete \(skill.displayTypeName)")
}
}
.alert(item: $activeAlert) { alert in
@@ -217,6 +220,7 @@ struct SkillDetailView: View {
}
private func deleteSkill() {
+ guard !skill.isReadOnly else { return }
do {
try skill.deleteFromDisk()
appState.selectedSkill = nil
diff --git a/Chops/Views/Sidebar/SkillListView.swift b/Chops/Views/Sidebar/SkillListView.swift
index 88b7702..9b97ebe 100644
--- a/Chops/Views/Sidebar/SkillListView.swift
+++ b/Chops/Views/Sidebar/SkillListView.swift
@@ -140,13 +140,16 @@ struct SkillListView: View {
NSWorkspace.shared.selectFile(skill.filePath, inFileViewerRootedAtPath: "")
}
}
- Divider()
- Button("Delete", role: .destructive) {
- activeAlert = .confirmDelete(skill)
+ if !skill.isReadOnly {
+ Divider()
+ Button("Delete", role: .destructive) {
+ activeAlert = .confirmDelete(skill)
+ }
}
}
private func deleteSkill(_ skill: Skill) {
+ guard !skill.isReadOnly else { return }
do {
try skill.deleteFromDisk()
if appState.selectedSkill == skill {