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: drag and drop skills into sidebar collections (#49)

Josh Pigford5cec1a6a3c08
diff --git a/Chops/Views/Sidebar/CollectionListView.swift b/Chops/Views/Sidebar/CollectionListView.swift
index b3fb872..9d393b4 100644
--- a/Chops/Views/Sidebar/CollectionListView.swift
+++ b/Chops/Views/Sidebar/CollectionListView.swift
@@ -80,6 +80,21 @@ struct CollectionListView: View {
}
}
+ private func handleDrop(_ resolvedPaths: [String], onto collection: SkillCollection) -> Bool {
+ var added = false
+ for path in resolvedPaths {
+ let descriptor = FetchDescriptor<Skill>(
+ predicate: #Predicate { $0.resolvedPath == path }
+ )
+ guard let skill = try? modelContext.fetch(descriptor).first else { continue }
+ guard !collection.skills.contains(where: { $0.resolvedPath == path }) else { continue }
+ collection.skills.append(skill)
+ added = true
+ }
+ if added { try? modelContext.save() }
+ return added
+ }
+
private let availableIcons = [
"folder", "star", "bookmark", "tag", "tray",
"archivebox", "doc.text", "gearshape", "wrench",
@@ -110,6 +125,9 @@ struct CollectionListView: View {
Label(collection.name, systemImage: collection.icon)
.badge(collection.skills.count)
.tag(SidebarFilter.collection(collection.name))
+ .dropDestination(for: String.self) { resolvedPaths, _ in
+ handleDrop(resolvedPaths, onto: collection)
+ }
.contextMenu {
Button("Rename") {
errorMessage = nil
diff --git a/Chops/Views/Sidebar/SkillListView.swift b/Chops/Views/Sidebar/SkillListView.swift
index 5f0c558..7b49781 100644
--- a/Chops/Views/Sidebar/SkillListView.swift
+++ b/Chops/Views/Sidebar/SkillListView.swift
@@ -81,6 +81,7 @@ struct SkillListView: View {
ForEach(filteredSkills) { skill in
SkillRow(skill: skill)
.tag(skill)
+ .draggable(skill.resolvedPath)
.contextMenu {
Button(skill.isFavorite ? "Unfavorite" : "Favorite") {
skill.isFavorite.toggle()