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: major UI overhaul — 3-column layout, dedup, tool logos, Icon Composer

Josh Pigforda9a22307cdc7
diff --git a/Chops.xcodeproj/project.pbxproj b/Chops.xcodeproj/project.pbxproj
index 6ca51a4..070f286 100644
--- a/Chops.xcodeproj/project.pbxproj
+++ b/Chops.xcodeproj/project.pbxproj
@@ -8,12 +8,10 @@
/* Begin PBXBuildFile section */
09D3F065191A83BDEE922789 /* SkillDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 168E103488DEA623E712852B /* SkillDetailView.swift */; };
- 0AAAAE8C1D513060798C174A /* TagFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B6645CCA31FE509667D24CE /* TagFilterView.swift */; };
2263A0A3B358FBA099D0086D /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924245DDDA4C6A59BE15567 /* SettingsView.swift */; };
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 */; };
- 3E82E1FC990847E9A0C22AF9 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F4D700DBF6267A1D940943 /* Tag.swift */; };
53C393C13E30EC439317509F /* ToolBadge.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B6AE242CAD6A285DD57079 /* ToolBadge.swift */; };
60A6711BAB0C3B8A3ACBF985 /* SkillParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5155D141EF812A3FE9ADF59C /* SkillParser.swift */; };
6A8E0927D95BB14C9F377F4E /* SkillScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A5B26D335C1AFB6CDE8207 /* SkillScanner.swift */; };
@@ -26,20 +24,21 @@
99EE8F6124FE91AC9576D6FD /* FileWatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAD26AA4787A2E0CDC86AADC /* FileWatcher.swift */; };
BD584933CCE2B650345C4CF1 /* ToolSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5487D9027B97F7E9EE9A1F4A /* ToolSource.swift */; };
C30BEAE03E54BD36F257A925 /* ToolFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5774429CCE83C2AFBE046C /* ToolFilterView.swift */; };
- CAB16E444FFF8F149CB1421F /* DirectoryBrowserView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24274B19D8EA97BFA5C50EA1 /* DirectoryBrowserView.swift */; };
+ C6CFF37CC0B155E8846344A4 /* ChopsIcon.icon in Resources */ = {isa = PBXBuildFile; fileRef = 04C3C644B72DD508A7CBC403 /* ChopsIcon.icon */; };
CBD8FECF1C5A453C8B021665 /* FrontmatterParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C77C5B30E6C885B39444E5B /* FrontmatterParser.swift */; };
CCD92CB102DFA0965D6AFDB5 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF7822031FD82A28978D9C5 /* SidebarView.swift */; };
CECE9BEEC1D933C543B66A4E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 17F7FE50C96124BA4EE43A6F /* Assets.xcassets */; };
D4C107BE303FC07CAF9C66AF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60E0F71982C4AF0045962380 /* ContentView.swift */; };
+ E98F7490B18A194F82ED2C0E /* SkillListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA64A368BBF950CD36C4F495 /* SkillListView.swift */; };
F98B1E8579B139FD2A801650 /* SearchService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FFC47BDE92105F4736B379F /* SearchService.swift */; };
FB295303DD30AED03290C726 /* SkillEditorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31B4DB87833D5160A11E39C9 /* SkillEditorView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ 04C3C644B72DD508A7CBC403 /* ChopsIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = wrapper.icon; path = ChopsIcon.icon; sourceTree = "<group>"; };
168E103488DEA623E712852B /* SkillDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillDetailView.swift; sourceTree = "<group>"; };
17F7FE50C96124BA4EE43A6F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
231C267216AF1BCA8628B667 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
- 24274B19D8EA97BFA5C50EA1 /* DirectoryBrowserView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DirectoryBrowserView.swift; sourceTree = "<group>"; };
2787064DC7DF112E70C4E4D0 /* ChopsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChopsApp.swift; sourceTree = "<group>"; };
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>"; };
@@ -48,15 +47,14 @@
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>"; };
- 5B6645CCA31FE509667D24CE /* TagFilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagFilterView.swift; sourceTree = "<group>"; };
60E0F71982C4AF0045962380 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7C77C5B30E6C885B39444E5B /* FrontmatterParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrontmatterParser.swift; sourceTree = "<group>"; };
7FFC47BDE92105F4736B379F /* SearchService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchService.swift; sourceTree = "<group>"; };
- 84F4D700DBF6267A1D940943 /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = "<group>"; };
8C812515FD8DC222B89745F2 /* SkillMetadataBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillMetadataBar.swift; sourceTree = "<group>"; };
9A5774429CCE83C2AFBE046C /* ToolFilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolFilterView.swift; sourceTree = "<group>"; };
A7B6AE242CAD6A285DD57079 /* ToolBadge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolBadge.swift; sourceTree = "<group>"; };
A924245DDDA4C6A59BE15567 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
+ AA64A368BBF950CD36C4F495 /* SkillListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillListView.swift; sourceTree = "<group>"; };
B3F5CF5BB1FC8455FDDB004A /* Chops.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Chops.app; sourceTree = BUILT_PRODUCTS_DIR; };
C9AFE1AF02B0F8057791C2A9 /* Collection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Collection.swift; sourceTree = "<group>"; };
CAD26AA4787A2E0CDC86AADC /* FileWatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileWatcher.swift; sourceTree = "<group>"; };
@@ -96,6 +94,7 @@
198DFCB0614727F57F6D073D /* Chops */ = {
isa = PBXGroup;
children = (
+ 04C3C644B72DD508A7CBC403 /* ChopsIcon.icon */,
55B50A6F7E2143E2A7160C6D /* App */,
75334DE5CD1545A8E1E63699 /* Models */,
D17AEFDEFE1C95D34F0F5771 /* Resources */,
@@ -160,7 +159,6 @@
children = (
C9AFE1AF02B0F8057791C2A9 /* Collection.swift */,
27D6ED655F951177D2152351 /* Skill.swift */,
- 84F4D700DBF6267A1D940943 /* Tag.swift */,
5487D9027B97F7E9EE9A1F4A /* ToolSource.swift */,
);
path = Models;
@@ -171,7 +169,7 @@
children = (
4CA102A49ACFB23BC15794F8 /* CollectionListView.swift */,
2CF7822031FD82A28978D9C5 /* SidebarView.swift */,
- 5B6645CCA31FE509667D24CE /* TagFilterView.swift */,
+ AA64A368BBF950CD36C4F495 /* SkillListView.swift */,
9A5774429CCE83C2AFBE046C /* ToolFilterView.swift */,
);
path = Sidebar;
@@ -180,7 +178,6 @@
96A2A820C082754BBFB0237D /* Detail */ = {
isa = PBXGroup;
children = (
- 24274B19D8EA97BFA5C50EA1 /* DirectoryBrowserView.swift */,
168E103488DEA623E712852B /* SkillDetailView.swift */,
31B4DB87833D5160A11E39C9 /* SkillEditorView.swift */,
8C812515FD8DC222B89745F2 /* SkillMetadataBar.swift */,
@@ -266,6 +263,7 @@
buildActionMask = 2147483647;
files = (
CECE9BEEC1D933C543B66A4E /* Assets.xcassets in Resources */,
+ C6CFF37CC0B155E8846344A4 /* ChopsIcon.icon in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -281,7 +279,6 @@
7A17C99C5EFAE3AA9E788D50 /* Collection.swift in Sources */,
7EC6156934D559226BC78859 /* CollectionListView.swift in Sources */,
D4C107BE303FC07CAF9C66AF /* ContentView.swift in Sources */,
- CAB16E444FFF8F149CB1421F /* DirectoryBrowserView.swift in Sources */,
99EE8F6124FE91AC9576D6FD /* FileWatcher.swift in Sources */,
CBD8FECF1C5A453C8B021665 /* FrontmatterParser.swift in Sources */,
7FD1DE6640F9339D5E97E09A /* MDCParser.swift in Sources */,
@@ -292,11 +289,10 @@
95163AEB7980654C901EC693 /* Skill.swift in Sources */,
09D3F065191A83BDEE922789 /* SkillDetailView.swift in Sources */,
FB295303DD30AED03290C726 /* SkillEditorView.swift in Sources */,
+ E98F7490B18A194F82ED2C0E /* SkillListView.swift in Sources */,
87A469B631CC80C89B14B1C7 /* SkillMetadataBar.swift in Sources */,
60A6711BAB0C3B8A3ACBF985 /* SkillParser.swift in Sources */,
6A8E0927D95BB14C9F377F4E /* SkillScanner.swift in Sources */,
- 3E82E1FC990847E9A0C22AF9 /* Tag.swift in Sources */,
- 0AAAAE8C1D513060798C174A /* TagFilterView.swift in Sources */,
53C393C13E30EC439317509F /* ToolBadge.swift in Sources */,
C30BEAE03E54BD36F257A925 /* ToolFilterView.swift in Sources */,
BD584933CCE2B650345C4CF1 /* ToolSource.swift in Sources */,
@@ -365,7 +361,7 @@
52738EE717474F8671BFB266 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_APPICON_NAME = ChopsIcon;
CODE_SIGN_ENTITLEMENTS = Chops/Chops.entitlements;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
@@ -386,7 +382,7 @@
58C6E63A67ADDC4C7CB7ED9D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_APPICON_NAME = ChopsIcon;
CODE_SIGN_ENTITLEMENTS = Chops/Chops.entitlements;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
diff --git a/Chops/App/AppState.swift b/Chops/App/AppState.swift
index b9a58e7..a926760 100644
--- a/Chops/App/AppState.swift
+++ b/Chops/App/AppState.swift
@@ -13,6 +13,5 @@ enum SidebarFilter: Hashable {
case all
case favorites
case tool(ToolSource)
- case tag(String)
case collection(String)
}
diff --git a/Chops/App/ChopsApp.swift b/Chops/App/ChopsApp.swift
index 38e42e1..1e14fd0 100644
--- a/Chops/App/ChopsApp.swift
+++ b/Chops/App/ChopsApp.swift
@@ -18,7 +18,6 @@ struct ChopsApp: App {
var sharedModelContainer: ModelContainer = {
let schema = Schema([
Skill.self,
- Tag.self,
SkillCollection.self,
])
let config = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
diff --git a/Chops/App/ContentView.swift b/Chops/App/ContentView.swift
index 0152f60..8272cd1 100644
--- a/Chops/App/ContentView.swift
+++ b/Chops/App/ContentView.swift
@@ -14,6 +14,8 @@ struct ContentView: View {
NavigationSplitView(columnVisibility: $columnVisibility) {
SidebarView()
+ } content: {
+ SkillListView()
} detail: {
if let skill = appState.selectedSkill {
SkillDetailView(skill: skill)
@@ -41,7 +43,10 @@ struct ContentView: View {
}
}
}
- .frame(minWidth: 800, minHeight: 500)
+ .frame(minWidth: 900, minHeight: 500)
+ .onReceive(NotificationCenter.default.publisher(for: .customScanPathsChanged)) { _ in
+ scanner?.scanAll()
+ }
}
private func startScanning() {
@@ -49,7 +54,6 @@ struct ContentView: View {
self.scanner = scanner
scanner.scanAll()
- // Set up file watching
var allPaths: [String] = []
for tool in ToolSource.allCases {
allPaths.append(contentsOf: tool.globalPaths)
diff --git a/Chops/ChopsIcon.icon/Assets/blocks.svg b/Chops/ChopsIcon.icon/Assets/blocks.svg
new file mode 100644
index 0000000..a07fdbb
--- /dev/null
+++ b/Chops/ChopsIcon.icon/Assets/blocks.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-blocks-icon lucide-blocks"><path d="M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2"/><rect x="14" y="2" width="8" height="8" rx="1"/></svg>
\ No newline at end of file
diff --git a/Chops/ChopsIcon.icon/icon.json b/Chops/ChopsIcon.icon/icon.json
new file mode 100644
index 0000000..df88c31
--- /dev/null
+++ b/Chops/ChopsIcon.icon/icon.json
@@ -0,0 +1,56 @@
+{
+ "fill" : {
+ "linear-gradient" : [
+ "extended-srgb:0.20392,0.78039,0.34902,1.00000",
+ "extended-srgb:0.00000,0.78431,0.70196,1.00000"
+ ],
+ "orientation" : {
+ "start" : {
+ "x" : 0.5,
+ "y" : 0
+ },
+ "stop" : {
+ "x" : 0.5,
+ "y" : 0.7
+ }
+ }
+ },
+ "groups" : [
+ {
+ "layers" : [
+ {
+ "blend-mode" : "normal",
+ "fill" : {
+ "solid" : "extended-gray:1.00000,1.00000"
+ },
+ "glass" : true,
+ "hidden" : false,
+ "image-name" : "blocks.svg",
+ "name" : "blocks",
+ "opacity" : 1,
+ "position" : {
+ "scale" : 30,
+ "translation-in-points" : [
+ 0,
+ 0
+ ]
+ }
+ }
+ ],
+ "shadow" : {
+ "kind" : "neutral",
+ "opacity" : 0.5
+ },
+ "translucency" : {
+ "enabled" : true,
+ "value" : 0.5
+ }
+ }
+ ],
+ "supported-platforms" : {
+ "circles" : [
+ "watchOS"
+ ],
+ "squares" : "shared"
+ }
+}
\ No newline at end of file
diff --git a/Chops/Info.plist b/Chops/Info.plist
index 7297ff3..44ed081 100644
--- a/Chops/Info.plist
+++ b/Chops/Info.plist
@@ -18,6 +18,10 @@
<string>$(EXECUTABLE_NAME)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>CFBundleIconFile</key>
+ <string>ChopsIcon</string>
+ <key>CFBundleIconName</key>
+ <string>ChopsIcon</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 Josh Pigford. All rights reserved.</string>
<key>SUFeedURL</key>
diff --git a/Chops/Models/Skill.swift b/Chops/Models/Skill.swift
index e996faa..58ffbd1 100644
--- a/Chops/Models/Skill.swift
+++ b/Chops/Models/Skill.swift
@@ -3,25 +3,54 @@ import Foundation
@Model
final class Skill {
- @Attribute(.unique) var filePath: String
- var toolSourceRaw: String
+ @Attribute(.unique) var resolvedPath: String
+ var filePath: String
var isDirectory: Bool
var name: String
var skillDescription: String
var content: String
var frontmatterData: Data?
- var tags: [Tag]
+
var collections: [SkillCollection]
var isFavorite: Bool
var lastOpened: Date?
var fileModifiedDate: Date
var fileSize: Int
var isGlobal: Bool
- var resolvedPath: String
+ /// Comma-separated tool raw values (e.g. "claude,cursor,codex")
+ var toolSourcesRaw: String
+
+ /// All file paths where this skill is installed (JSON-encoded array)
+ var installedPathsData: Data?
+
+ // MARK: - Computed
+
+ var toolSources: [ToolSource] {
+ get {
+ toolSourcesRaw
+ .split(separator: ",")
+ .compactMap { ToolSource(rawValue: String($0)) }
+ }
+ set {
+ let unique = Array(Set(newValue.map(\.rawValue))).sorted()
+ toolSourcesRaw = unique.joined(separator: ",")
+ }
+ }
+
+ /// Primary tool source (first one added)
var toolSource: ToolSource {
- get { ToolSource(rawValue: toolSourceRaw) ?? .custom }
- set { toolSourceRaw = newValue.rawValue }
+ toolSources.first ?? .custom
+ }
+
+ var installedPaths: [String] {
+ get {
+ guard let data = installedPathsData else { return [filePath] }
+ return (try? JSONDecoder().decode([String].self, from: data)) ?? [filePath]
+ }
+ set {
+ installedPathsData = try? JSONEncoder().encode(Array(Set(newValue)))
+ }
}
var frontmatter: [String: String] {
@@ -34,6 +63,25 @@ final class Skill {
}
}
+ /// How many tools this skill is installed for
+ var installCount: Int { toolSources.count }
+
+ /// 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? {
+ guard !isGlobal else { return nil }
+ let components = filePath.components(separatedBy: "/")
+ // Find the component before a dotfile directory (.claude, .cursor, .codex, etc.)
+ for (i, component) in components.enumerated() {
+ if component.hasPrefix(".") && i > 0 {
+ return components[i - 1]
+ }
+ }
+ return nil
+ }
+
+ // MARK: - Init
+
init(
filePath: String,
toolSource: ToolSource,
@@ -42,7 +90,7 @@ final class Skill {
skillDescription: String = "",
content: String = "",
frontmatter: [String: String] = [:],
- tags: [Tag] = [],
+
collections: [SkillCollection] = [],
isFavorite: Bool = false,
lastOpened: Date? = nil,
@@ -51,20 +99,37 @@ final class Skill {
isGlobal: Bool = true,
resolvedPath: String = ""
) {
+ self.resolvedPath = resolvedPath.isEmpty ? filePath : resolvedPath
self.filePath = filePath
- self.toolSourceRaw = toolSource.rawValue
+ self.toolSourcesRaw = toolSource.rawValue
+ self.installedPathsData = try? JSONEncoder().encode([filePath])
self.isDirectory = isDirectory
self.name = name
self.skillDescription = skillDescription
self.content = content
self.frontmatterData = try? JSONEncoder().encode(frontmatter)
- self.tags = tags
+
self.collections = collections
self.isFavorite = isFavorite
self.lastOpened = lastOpened
self.fileModifiedDate = fileModifiedDate
self.fileSize = fileSize
self.isGlobal = isGlobal
- self.resolvedPath = resolvedPath
+ }
+
+ // MARK: - Merge
+
+ /// Merge another location/tool into this skill
+ func addInstallation(path: String, tool: ToolSource) {
+ var paths = installedPaths
+ if !paths.contains(path) {
+ paths.append(path)
+ installedPaths = paths
+ }
+ var tools = toolSources
+ if !tools.contains(tool) {
+ tools.append(tool)
+ toolSources = tools
+ }
}
}
diff --git a/Chops/Models/Tag.swift b/Chops/Models/Tag.swift
deleted file mode 100644
index 1bf3294..0000000
--- a/Chops/Models/Tag.swift
+++ /dev/null
@@ -1,17 +0,0 @@
-import SwiftData
-import Foundation
-
-@Model
-final class Tag {
- @Attribute(.unique) var name: String
- var color: String
-
- @Relationship(inverse: \Skill.tags)
- var skills: [Skill]
-
- init(name: String, color: String = "#808080", skills: [Skill] = []) {
- self.name = name
- self.color = color
- self.skills = skills
- }
-}
diff --git a/Chops/Models/ToolSource.swift b/Chops/Models/ToolSource.swift
index 59a489b..f591a60 100644
--- a/Chops/Models/ToolSource.swift
+++ b/Chops/Models/ToolSource.swift
@@ -25,6 +25,7 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {
}
}
+ /// SF Symbol fallback icon name
var iconName: String {
switch self {
case .claude: "brain.head.profile"
@@ -38,6 +39,18 @@ enum ToolSource: String, Codable, CaseIterable, Identifiable {
}
}
+ /// Asset catalog image name, nil if no custom logo
+ var logoAssetName: String? {
+ switch self {
+ case .claude: "tool-claude"
+ case .cursor: "tool-cursor"
+ case .codex: "tool-codex"
+ case .windsurf: "tool-windsurf"
+ case .amp: "tool-amp"
+ default: nil
+ }
+ }
+
var color: Color {
switch self {
case .claude: .orange
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
deleted file mode 100644
index 64dc11e..0000000
--- a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- "images" : [
- {
- "filename" : "icon_16x16.png",
- "idiom" : "mac",
- "scale" : "1x",
- "size" : "16x16"
- },
- {
- "filename" : "[email protected]",
- "idiom" : "mac",
- "scale" : "2x",
- "size" : "16x16"
- },
- {
- "filename" : "icon_32x32.png",
- "idiom" : "mac",
- "scale" : "1x",
- "size" : "32x32"
- },
- {
- "filename" : "[email protected]",
- "idiom" : "mac",
- "scale" : "2x",
- "size" : "32x32"
- },
- {
- "filename" : "icon_128x128.png",
- "idiom" : "mac",
- "scale" : "1x",
- "size" : "128x128"
- },
- {
- "filename" : "[email protected]",
- "idiom" : "mac",
- "scale" : "2x",
- "size" : "128x128"
- },
- {
- "filename" : "icon_256x256.png",
- "idiom" : "mac",
- "scale" : "1x",
- "size" : "256x256"
- },
- {
- "filename" : "[email protected]",
- "idiom" : "mac",
- "scale" : "2x",
- "size" : "256x256"
- },
- {
- "filename" : "icon_512x512.png",
- "idiom" : "mac",
- "scale" : "1x",
- "size" : "512x512"
- },
- {
- "filename" : "[email protected]",
- "idiom" : "mac",
- "scale" : "2x",
- "size" : "512x512"
- }
- ],
- "info" : {
- "author" : "xcode",
- "version" : 1
- }
-}
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128.png
deleted file mode 100644
index dddf26e..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128.png and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected]
deleted file mode 100644
index d6a3900..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16.png
deleted file mode 100644
index 0a004c4..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16.png and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected]
deleted file mode 100644
index f4f7e8d..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256.png
deleted file mode 100644
index d6a3900..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256.png and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected]
deleted file mode 100644
index 16ff97c..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32.png
deleted file mode 100644
index f4f7e8d..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32.png and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected]
deleted file mode 100644
index 70f2b83..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512.png
deleted file mode 100644
index 16ff97c..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512.png and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] b/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected]
deleted file mode 100644
index 4c022bf..0000000
Binary files a/Chops/Resources/Assets.xcassets/AppIcon.appiconset/[email protected] and /dev/null differ
diff --git a/Chops/Resources/Assets.xcassets/tool-amp.imageset/Contents.json b/Chops/Resources/Assets.xcassets/tool-amp.imageset/Contents.json
new file mode 100644
index 0000000..69c1978
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-amp.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" : "template"
+ }
+}
diff --git a/Chops/Resources/Assets.xcassets/tool-amp.imageset/logo.svg b/Chops/Resources/Assets.xcassets/tool-amp.imageset/logo.svg
new file mode 100644
index 0000000..683e16c
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-amp.imageset/logo.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Amp</title><path d="M15.087 23.18L12.03 24l-2.097-7.823-5.738 5.738-2.251-2.251 5.718-5.719-7.769-2.082.82-3.057 11.294 3.08 3.08 11.295z"></path><path d="M19.505 18.762l-3.057.82-2.564-9.573-9.572-2.564.819-3.057 11.295 3.079 3.08 11.295z"></path><path d="M23.893 14.374l-3.057.82-2.565-9.572L8.7 3.057 9.52 0l11.295 3.08 3.079 11.294z"></path></svg>
\ No newline at end of file
diff --git a/Chops/Resources/Assets.xcassets/tool-claude.imageset/Contents.json b/Chops/Resources/Assets.xcassets/tool-claude.imageset/Contents.json
new file mode 100644
index 0000000..69c1978
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-claude.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" : "template"
+ }
+}
diff --git a/Chops/Resources/Assets.xcassets/tool-claude.imageset/logo.svg b/Chops/Resources/Assets.xcassets/tool-claude.imageset/logo.svg
new file mode 100644
index 0000000..1411717
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-claude.imageset/logo.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Antigravity</title><path clip-rule="evenodd" d="M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"></path></svg>
\ No newline at end of file
diff --git a/Chops/Resources/Assets.xcassets/tool-codex.imageset/Contents.json b/Chops/Resources/Assets.xcassets/tool-codex.imageset/Contents.json
new file mode 100644
index 0000000..69c1978
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-codex.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" : "template"
+ }
+}
diff --git a/Chops/Resources/Assets.xcassets/tool-codex.imageset/logo.svg b/Chops/Resources/Assets.xcassets/tool-codex.imageset/logo.svg
new file mode 100644
index 0000000..ad3ea8b
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-codex.imageset/logo.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12">
+ <defs>
+ <style>
+ .cls-1 {
+ fill-rule: evenodd;
+ }
+ </style>
+ </defs>
+ <g id="Layer_1-2" data-name="Layer 1">
+ <path class="cls-1" d="M4.04.23C4.52.03,5.05-.04,5.57.02c.67.08,1.26.36,1.78.85.01.01.03.02.05.01.7-.17,1.38-.11,2.03.18h.03s.08.05.08.05c.68.35,1.16.88,1.46,1.6.14.34.21.69.21,1.06,0,.27-.02.55-.09.82,0,.03,0,.06.02.08.39.4.67.9.79,1.45.19.95,0,1.81-.59,2.57l-.09.11c-.39.44-.9.77-1.47.93-.03,0-.05.03-.05.05-.13.37-.26.68-.49,1-.6.79-1.48,1.23-2.47,1.23-.79,0-1.49-.29-2.11-.87-.02-.02-.05-.02-.07-.02-.26.08-.52.1-.8.09-.45,0-.89-.11-1.3-.31-.42-.21-.79-.51-1.07-.89-.1-.13-.2-.26-.28-.41-.1-.21-.18-.42-.25-.64-.13-.5-.14-1.03,0-1.53,0-.01,0-.02,0-.04,0-.01,0-.02-.02-.03-.31-.31-.54-.69-.69-1.1-.1-.25-.15-.52-.17-.79-.02-.36,0-.72.09-1.07.22-.74.65-1.32,1.29-1.75.14-.09.27-.17.4-.22.14-.06.29-.11.43-.15.02,0,.04-.02.04-.04.11-.39.3-.76.55-1.08.34-.42.75-.73,1.23-.93ZM3.64,4.15c-.12-.2-.38-.27-.58-.16-.2.12-.27.38-.16.58l.85,1.48-.84,1.42c-.11.21-.03.46.17.57.19.1.44.04.56-.14l.97-1.64c.08-.13.08-.29,0-.43,0,0-.97-1.7-.97-1.7ZM6.36,7.27c-.23.01-.41.21-.4.45.01.21.18.39.4.4h2.42c.23-.01.41-.21.4-.44-.01-.22-.19-.39-.4-.4h-2.42Z"/>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/Chops/Resources/Assets.xcassets/tool-cursor.imageset/Contents.json b/Chops/Resources/Assets.xcassets/tool-cursor.imageset/Contents.json
new file mode 100644
index 0000000..69c1978
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-cursor.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" : "template"
+ }
+}
diff --git a/Chops/Resources/Assets.xcassets/tool-cursor.imageset/logo.svg b/Chops/Resources/Assets.xcassets/tool-cursor.imageset/logo.svg
new file mode 100644
index 0000000..a5b2ee3
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-cursor.imageset/logo.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Cursor</title><path d="M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"></path></svg>
\ No newline at end of file
diff --git a/Chops/Resources/Assets.xcassets/tool-windsurf.imageset/Contents.json b/Chops/Resources/Assets.xcassets/tool-windsurf.imageset/Contents.json
new file mode 100644
index 0000000..69c1978
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-windsurf.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" : "template"
+ }
+}
diff --git a/Chops/Resources/Assets.xcassets/tool-windsurf.imageset/logo.svg b/Chops/Resources/Assets.xcassets/tool-windsurf.imageset/logo.svg
new file mode 100644
index 0000000..4df8f33
--- /dev/null
+++ b/Chops/Resources/Assets.xcassets/tool-windsurf.imageset/logo.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Windsurf</title><path clip-rule="evenodd" d="M23.78 5.004h-.228a2.187 2.187 0 00-2.18 2.196v4.912c0 .98-.804 1.775-1.76 1.775a1.818 1.818 0 01-1.472-.773L13.168 5.95a2.197 2.197 0 00-1.81-.95c-1.134 0-2.154.972-2.154 2.173v4.94c0 .98-.797 1.775-1.76 1.775-.57 0-1.136-.289-1.472-.773L.408 5.098C.282 4.918 0 5.007 0 5.228v4.284c0 .216.066.426.188.604l5.475 7.889c.324.466.8.812 1.351.938 1.377.316 2.645-.754 2.645-2.117V11.89c0-.98.787-1.775 1.76-1.775h.002c.586 0 1.135.288 1.472.773l4.972 7.163a2.15 2.15 0 001.81.95c1.158 0 2.151-.973 2.151-2.173v-4.939c0-.98.787-1.775 1.76-1.775h.194c.122 0 .22-.1.22-.222V5.225a.221.221 0 00-.22-.222z"></path></svg>
\ No newline at end of file
diff --git a/Chops/Services/SkillScanner.swift b/Chops/Services/SkillScanner.swift
index 65d563c..43d999f 100644
--- a/Chops/Services/SkillScanner.swift
+++ b/Chops/Services/SkillScanner.swift
@@ -9,24 +9,67 @@ final class SkillScanner {
self.modelContext = modelContext
}
+ /// Project-level paths to probe inside each project directory
+ private static let projectProbes: [(subpath: String, tool: ToolSource)] = [
+ (".claude/skills", .claude),
+ (".cursor/skills", .cursor),
+ (".cursor/rules", .cursor),
+ (".codex", .codex),
+ (".windsurf/rules", .windsurf),
+ (".github", .copilot),
+ (".config/amp", .amp),
+ ]
+
func scanAll() {
for tool in ToolSource.allCases where tool != .custom {
scanTool(tool)
}
let customPaths = UserDefaults.standard.stringArray(forKey: "customScanPaths") ?? []
for path in customPaths {
- scanDirectory(URL(fileURLWithPath: path), toolSource: .custom)
+ scanCustomDirectory(URL(fileURLWithPath: path))
+ }
+ }
+
+ /// Scans a custom directory by iterating its subdirectories (projects)
+ /// and probing each for tool-specific skill locations.
+ private func scanCustomDirectory(_ directory: URL) {
+ let fm = FileManager.default
+ guard let projects = try? fm.contentsOfDirectory(
+ at: directory,
+ includingPropertiesForKeys: [.isDirectoryKey],
+ options: [.skipsHiddenFiles]
+ ) else { return }
+
+ for project in projects {
+ var isDir: ObjCBool = false
+ fm.fileExists(atPath: project.path, isDirectory: &isDir)
+ guard isDir.boolValue else { continue }
+
+ for probe in Self.projectProbes {
+ let probePath = project.appendingPathComponent(probe.subpath)
+ guard fm.fileExists(atPath: probePath.path) else { continue }
+
+ if probe.tool == .copilot {
+ // Copilot: single file
+ let file = probePath.appendingPathComponent("copilot-instructions.md")
+ if fm.fileExists(atPath: file.path) {
+ upsertSkill(at: file, toolSource: .copilot, isDirectory: false, isGlobal: false)
+ }
+ } else {
+ scanDirectory(probePath, toolSource: probe.tool, isGlobal: false)
+ }
+ }
}
}
func scanTool(_ tool: ToolSource) {
for path in tool.globalPaths {
let url = URL(fileURLWithPath: path)
- scanDirectory(url, toolSource: tool)
+ scanDirectory(url, toolSource: tool, isGlobal: true)
}
}
- private func scanDirectory(_ directory: URL, toolSource: ToolSource) {
+ private func scanDirectory(_ directory: URL, toolSource: ToolSource, isGlobal: Bool = true) {
let fm = FileManager.default
var isDir: ObjCBool = false
@@ -36,7 +79,7 @@ final class SkillScanner {
if toolSource == .codex || toolSource == .amp {
let agentsMD = directory.appendingPathComponent("AGENTS.md")
if fm.fileExists(atPath: agentsMD.path) {
- upsertSkill(at: agentsMD, toolSource: toolSource, isDirectory: false)
+ upsertSkill(at: agentsMD, toolSource: toolSource, isDirectory: false, isGlobal: isGlobal)
}
// Also scan subdirectories for skills
if let contents = try? fm.contentsOfDirectory(
@@ -50,7 +93,7 @@ final class SkillScanner {
if itemIsDir.boolValue {
let skillFile = item.appendingPathComponent("AGENTS.md")
if fm.fileExists(atPath: skillFile.path) {
- upsertSkill(at: skillFile, toolSource: toolSource, isDirectory: true)
+ upsertSkill(at: skillFile, toolSource: toolSource, isDirectory: true, isGlobal: isGlobal)
}
}
}
@@ -76,24 +119,24 @@ final class SkillScanner {
let agentsFile = item.appendingPathComponent("AGENTS.md")
if fm.fileExists(atPath: skillFile.path) {
- upsertSkill(at: skillFile, toolSource: toolSource, isDirectory: true)
+ upsertSkill(at: skillFile, toolSource: toolSource, isDirectory: true, isGlobal: isGlobal)
} else if fm.fileExists(atPath: agentsFile.path) {
- upsertSkill(at: agentsFile, toolSource: toolSource, isDirectory: true)
+ upsertSkill(at: agentsFile, toolSource: toolSource, isDirectory: true, isGlobal: isGlobal)
}
} else if item.pathExtension == "md" || item.pathExtension == "mdc" {
- upsertSkill(at: item, toolSource: toolSource, isDirectory: false)
+ upsertSkill(at: item, toolSource: toolSource, isDirectory: false, isGlobal: isGlobal)
}
}
}
- private func upsertSkill(at fileURL: URL, toolSource: ToolSource, isDirectory: Bool) {
+ private func upsertSkill(at fileURL: URL, toolSource: ToolSource, isDirectory: Bool, isGlobal: Bool = true) {
let fm = FileManager.default
let path = fileURL.path
- let resolvedPath = fileURL.resolvingSymlinksInPath().path
+ let resolved = fileURL.resolvingSymlinksInPath().path
guard let parsed = SkillParser.parse(fileURL: fileURL, toolSource: toolSource) else { return }
- let attrs = try? fm.attributesOfItem(atPath: resolvedPath)
+ let attrs = try? fm.attributesOfItem(atPath: resolved)
let modDate = (attrs?[.modificationDate] as? Date) ?? .now
let fileSize = (attrs?[.size] as? Int) ?? 0
@@ -106,17 +149,19 @@ final class SkillScanner {
name = fileURL.deletingPathExtension().lastPathComponent
}
- let predicate = #Predicate<Skill> { $0.filePath == path }
+ // Dedup: look up by resolved path first
+ let predicate = #Predicate<Skill> { $0.resolvedPath == resolved }
let descriptor = FetchDescriptor<Skill>(predicate: predicate)
if let existing = try? modelContext.fetch(descriptor).first {
+ // Same physical file — merge this tool/path into the existing entry
existing.content = parsed.content
existing.name = name
existing.skillDescription = parsed.description
existing.frontmatter = parsed.frontmatter
existing.fileModifiedDate = modDate
existing.fileSize = fileSize
- existing.resolvedPath = resolvedPath
+ existing.addInstallation(path: path, tool: toolSource)
} else {
let skill = Skill(
filePath: path,
@@ -128,8 +173,8 @@ final class SkillScanner {
frontmatter: parsed.frontmatter,
fileModifiedDate: modDate,
fileSize: fileSize,
- isGlobal: true,
- resolvedPath: resolvedPath
+ isGlobal: isGlobal,
+ resolvedPath: resolved
)
modelContext.insert(skill)
}
@@ -143,8 +188,16 @@ final class SkillScanner {
let fm = FileManager.default
for skill in skills {
- if !fm.fileExists(atPath: skill.filePath) {
+ // Remove paths that no longer exist
+ let validPaths = skill.installedPaths.filter { fm.fileExists(atPath: $0) }
+ if validPaths.isEmpty {
modelContext.delete(skill)
+ } else {
+ skill.installedPaths = validPaths
+ // Update primary filePath if it was deleted
+ if !fm.fileExists(atPath: skill.filePath), let first = validPaths.first {
+ skill.filePath = first
+ }
}
}
try? modelContext.save()
diff --git a/Chops/Views/Detail/DirectoryBrowserView.swift b/Chops/Views/Detail/DirectoryBrowserView.swift
deleted file mode 100644
index 3feca64..0000000
--- a/Chops/Views/Detail/DirectoryBrowserView.swift
+++ /dev/null
@@ -1,88 +0,0 @@
-import SwiftUI
-
-struct DirectoryBrowserView: View {
- let skill: Skill
- @State private var files: [FileItem] = []
- @State private var selectedFile: FileItem?
-
- struct FileItem: Identifiable, Hashable {
- let id = UUID()
- let name: String
- let path: String
- let isDirectory: Bool
- let children: [FileItem]
- }
-
- var body: some View {
- VStack(alignment: .leading, spacing: 0) {
- Text("Files")
- .font(.caption)
- .foregroundStyle(.secondary)
- .padding(.horizontal, 12)
- .padding(.vertical, 8)
-
- Divider()
-
- List(files, children: \.optionalChildren) { item in
- HStack(spacing: 6) {
- Image(systemName: item.isDirectory ? "folder.fill" : fileIcon(for: item.name))
- .font(.caption)
- .foregroundStyle(item.isDirectory ? .blue : .secondary)
- Text(item.name)
- .font(.caption)
- .lineLimit(1)
- }
- .tag(item)
- }
- .listStyle(.sidebar)
- }
- .onAppear {
- loadFiles()
- }
- }
-
- private func loadFiles() {
- let skillDir = URL(fileURLWithPath: skill.filePath).deletingLastPathComponent()
- files = scanDirectory(skillDir)
- }
-
- private func scanDirectory(_ url: URL) -> [FileItem] {
- let fm = FileManager.default
- guard let contents = try? fm.contentsOfDirectory(
- at: url,
- includingPropertiesForKeys: [.isDirectoryKey],
- options: [.skipsHiddenFiles]
- ) else { return [] }
-
- return contents.sorted { $0.lastPathComponent < $1.lastPathComponent }.map { item in
- var isDir: ObjCBool = false
- fm.fileExists(atPath: item.path, isDirectory: &isDir)
- let children = isDir.boolValue ? scanDirectory(item) : []
- return FileItem(
- name: item.lastPathComponent,
- path: item.path,
- isDirectory: isDir.boolValue,
- children: children
- )
- }
- }
-
- private func fileIcon(for name: String) -> String {
- let ext = (name as NSString).pathExtension.lowercased()
- switch ext {
- case "md", "markdown": return "doc.text"
- case "yml", "yaml": return "doc.badge.gearshape"
- case "json": return "curlybraces"
- case "swift": return "swift"
- case "py": return "chevron.left.forwardslash.chevron.right"
- case "sh", "bash", "zsh": return "terminal"
- default: return "doc"
- }
- }
-}
-
-extension DirectoryBrowserView.FileItem {
- var optionalChildren: [DirectoryBrowserView.FileItem]? {
- isDirectory ? children : nil
- }
-}
diff --git a/Chops/Views/Detail/SkillDetailView.swift b/Chops/Views/Detail/SkillDetailView.swift
index 03f6a7f..9894fa0 100644
--- a/Chops/Views/Detail/SkillDetailView.swift
+++ b/Chops/Views/Detail/SkillDetailView.swift
@@ -6,21 +6,12 @@ struct SkillDetailView: View {
@Environment(\.modelContext) private var modelContext
var body: some View {
- HSplitView {
- // If directory-based, show file browser on the left
- if skill.isDirectory {
- DirectoryBrowserView(skill: skill)
- .frame(minWidth: 180, maxWidth: 220)
- }
-
- // Main editor area
- VStack(spacing: 0) {
- SkillEditorView(skill: skill)
+ VStack(spacing: 0) {
+ SkillEditorView(skill: skill)
- Divider()
+ Divider()
- SkillMetadataBar(skill: skill)
- }
+ SkillMetadataBar(skill: skill)
}
.navigationTitle(skill.name)
.toolbar {
diff --git a/Chops/Views/Detail/SkillEditorView.swift b/Chops/Views/Detail/SkillEditorView.swift
index 1bd967e..24b97ae 100644
--- a/Chops/Views/Detail/SkillEditorView.swift
+++ b/Chops/Views/Detail/SkillEditorView.swift
@@ -1,4 +1,5 @@
import SwiftUI
+import AppKit
struct SkillEditorView: View {
@Bindable var skill: Skill
@@ -6,13 +7,11 @@ struct SkillEditorView: View {
@State private var hasUnsavedChanges = false
@State private var showingSaveError = false
@State private var saveErrorMessage = ""
+ @State private var fullFileContent: String = ""
var body: some View {
ZStack(alignment: .topTrailing) {
- TextEditor(text: $editorContent)
- .font(.system(.body, design: .monospaced))
- .scrollContentBackground(.hidden)
- .padding(8)
+ HighlightedTextEditor(text: $editorContent)
if hasUnsavedChanges {
Text("Modified")
@@ -41,8 +40,6 @@ struct SkillEditorView: View {
}
}
- @State private var fullFileContent: String = ""
-
private func loadContent() {
if let data = try? String(contentsOfFile: skill.filePath, encoding: .utf8) {
editorContent = data
@@ -90,3 +87,169 @@ extension FocusedValues {
set { self[SaveActionKey.self] = newValue }
}
}
+
+// MARK: - Syntax-highlighted NSTextView wrapper
+
+struct HighlightedTextEditor: NSViewRepresentable {
+ @Binding var text: String
+
+ func makeCoordinator() -> Coordinator {
+ Coordinator(self)
+ }
+
+ func makeNSView(context: Context) -> NSScrollView {
+ let scrollView = NSTextView.scrollableTextView()
+ let textView = scrollView.documentView as! NSTextView
+
+ textView.font = NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
+ textView.isEditable = true
+ textView.isSelectable = true
+ textView.allowsUndo = true
+ textView.isRichText = false
+ textView.usesFindBar = true
+ textView.isIncrementalSearchingEnabled = true
+ textView.isAutomaticQuoteSubstitutionEnabled = false
+ textView.isAutomaticDashSubstitutionEnabled = false
+ textView.isAutomaticTextReplacementEnabled = false
+ textView.isAutomaticSpellingCorrectionEnabled = false
+ textView.textContainerInset = NSSize(width: 12, height: 12)
+ textView.backgroundColor = .clear
+
+ textView.delegate = context.coordinator
+ context.coordinator.textView = textView
+
+ textView.string = text
+ MarkdownHighlighter.highlight(textView)
+
+ return scrollView
+ }
+
+ func updateNSView(_ scrollView: NSScrollView, context: Context) {
+ let textView = scrollView.documentView as! NSTextView
+ if textView.string != text {
+ let selectedRanges = textView.selectedRanges
+ textView.string = text
+ MarkdownHighlighter.highlight(textView)
+ textView.selectedRanges = selectedRanges
+ }
+ }
+
+ final class Coordinator: NSObject, NSTextViewDelegate {
+ var parent: HighlightedTextEditor
+ weak var textView: NSTextView?
+ private var isUpdating = false
+
+ init(_ parent: HighlightedTextEditor) {
+ self.parent = parent
+ }
+
+ func textDidChange(_ notification: Notification) {
+ guard !isUpdating, let textView else { return }
+ isUpdating = true
+ parent.text = textView.string
+ MarkdownHighlighter.highlight(textView)
+ isUpdating = false
+ }
+ }
+}
+
+// MARK: - Markdown + YAML Frontmatter Highlighter
+
+enum MarkdownHighlighter {
+ private static let muted = NSColor.secondaryLabelColor
+ private static let faintBg = NSColor.quaternaryLabelColor
+
+ static func highlight(_ textView: NSTextView) {
+ let text = textView.string
+ let fullRange = NSRange(location: 0, length: (text as NSString).length)
+ guard let storage = textView.textStorage else { return }
+
+ storage.beginEditing()
+
+ let baseFont = NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
+ storage.setAttributes([
+ .font: baseFont,
+ .foregroundColor: NSColor.labelColor
+ ], range: fullRange)
+
+ let lines = text.components(separatedBy: "\n")
+ var offset = 0
+ var inFrontmatter = false
+ var inCodeBlock = false
+
+ for (index, line) in lines.enumerated() {
+ let lineRange = NSRange(location: offset, length: (line as NSString).length)
+
+ // Frontmatter — just dim the whole block
+ if line.trimmingCharacters(in: .whitespaces) == "---" {
+ if index == 0 {
+ inFrontmatter = true
+ storage.addAttribute(.foregroundColor, value: muted, range: lineRange)
+ offset += line.count + 1
+ continue
+ } else if inFrontmatter {
+ inFrontmatter = false
+ storage.addAttribute(.foregroundColor, value: muted, range: lineRange)
+ offset += line.count + 1
+ continue
+ }
+ }
+
+ if inFrontmatter {
+ storage.addAttribute(.foregroundColor, value: muted, range: lineRange)
+ offset += line.count + 1
+ continue
+ }
+
+ // Code blocks — subtle background, no color change
+ if line.hasPrefix("```") {
+ inCodeBlock.toggle()
+ storage.addAttribute(.foregroundColor, value: muted, range: lineRange)
+ offset += line.count + 1
+ continue
+ }
+
+ if inCodeBlock {
+ storage.addAttribute(.backgroundColor, value: faintBg, range: lineRange)
+ offset += line.count + 1
+ continue
+ }
+
+ // Headings — just bold + sized, same color
+ if line.hasPrefix("#") {
+ let level = line.prefix(while: { $0 == "#" }).count
+ if level <= 6 && (line.count == level || line[line.index(line.startIndex, offsetBy: level)] == " ") {
+ let size: CGFloat = [18, 16, 14, 13, 13, 13][min(level - 1, 5)]
+ storage.addAttribute(.font, value: NSFont.monospacedSystemFont(ofSize: size, weight: .bold), range: lineRange)
+ offset += line.count + 1
+ continue
+ }
+ }
+
+ // Inline: bold gets bold, inline code gets faint bg, that's it
+ let nsLine = line as NSString
+ applyRegex(#"\*\*(.+?)\*\*"#, to: nsLine, lineOffset: lineRange.location, storage: storage, attrs: [
+ .font: NSFont.monospacedSystemFont(ofSize: 13, weight: .bold)
+ ])
+ applyRegex(#"__(.+?)__"#, to: nsLine, lineOffset: lineRange.location, storage: storage, attrs: [
+ .font: NSFont.monospacedSystemFont(ofSize: 13, weight: .bold)
+ ])
+ applyRegex(#"`([^`]+)`"#, to: nsLine, lineOffset: lineRange.location, storage: storage, attrs: [
+ .backgroundColor: faintBg
+ ])
+
+ offset += line.count + 1
+ }
+
+ storage.endEditing()
+ }
+
+ private static func applyRegex(_ pattern: String, to nsLine: NSString, lineOffset: Int, storage: NSTextStorage, attrs: [NSAttributedString.Key: Any]) {
+ guard let regex = try? NSRegularExpression(pattern: pattern) else { return }
+ let lineRange = NSRange(location: 0, length: nsLine.length)
+ for match in regex.matches(in: nsLine as String, range: lineRange) {
+ let matchRange = NSRange(location: lineOffset + match.range.location, length: match.range.length)
+ storage.addAttributes(attrs, range: matchRange)
+ }
+ }
+}
diff --git a/Chops/Views/Detail/SkillMetadataBar.swift b/Chops/Views/Detail/SkillMetadataBar.swift
index d374b25..8665642 100644
--- a/Chops/Views/Detail/SkillMetadataBar.swift
+++ b/Chops/Views/Detail/SkillMetadataBar.swift
@@ -4,81 +4,49 @@ import SwiftData
struct SkillMetadataBar: View {
@Bindable var skill: Skill
@Environment(\.modelContext) private var modelContext
- @Query(sort: \Tag.name) private var allTags: [Tag]
@Query(sort: \SkillCollection.sortOrder) private var allCollections: [SkillCollection]
- @State private var showingTagPicker = false
@State private var showingCollectionPicker = false
var body: some View {
HStack(spacing: 16) {
- // Tool badge
- HStack(spacing: 4) {
- ToolBadge(tool: skill.toolSource, size: .small)
- Text(skill.toolSource.displayName)
- .font(.caption)
- .foregroundStyle(.secondary)
+ HStack(spacing: 6) {
+ ForEach(skill.toolSources) { tool in
+ ToolIcon(tool: tool, size: 14)
+ }
}
+ .help(installedPathsSummary)
Divider().frame(height: 16)
- // File path
Text(abbreviatedPath)
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
.truncationMode(.middle)
- .help(skill.filePath)
+ .help(installedPathsSummary)
Divider().frame(height: 16)
- // File size
Text(formattedSize)
.font(.caption)
.foregroundStyle(.secondary)
Divider().frame(height: 16)
- // Tags
- HStack(spacing: 4) {
- ForEach(skill.tags) { tag in
- Text(tag.name)
- .font(.caption2)
- .padding(.horizontal, 6)
- .padding(.vertical, 2)
- .background(Color(hex: tag.color)?.opacity(0.2) ?? Color.gray.opacity(0.2), in: Capsule())
- }
-
- Button {
- showingTagPicker.toggle()
- } label: {
- Image(systemName: "tag")
- .font(.caption)
- .foregroundStyle(.secondary)
- }
- .buttonStyle(.plain)
- .popover(isPresented: $showingTagPicker) {
- tagPickerContent
- }
+ Button {
+ showingCollectionPicker.toggle()
+ } label: {
+ Image(systemName: "tray")
+ .font(.caption)
+ .foregroundStyle(.secondary)
}
-
- // Collections
- HStack(spacing: 4) {
- Button {
- showingCollectionPicker.toggle()
- } label: {
- Image(systemName: "tray")
- .font(.caption)
- .foregroundStyle(.secondary)
- }
- .buttonStyle(.plain)
- .popover(isPresented: $showingCollectionPicker) {
- collectionPickerContent
- }
+ .buttonStyle(.plain)
+ .popover(isPresented: $showingCollectionPicker) {
+ collectionPickerContent
}
Spacer()
- // Modified date
Text(skill.fileModifiedDate.formatted(.relative(presentation: .named)))
.font(.caption)
.foregroundStyle(.secondary)
@@ -99,40 +67,11 @@ struct SkillMetadataBar: View {
ByteCountFormatter.string(fromByteCount: Int64(skill.fileSize), countStyle: .file)
}
- private var tagPickerContent: some View {
- VStack(alignment: .leading, spacing: 4) {
- Text("Tags").font(.headline).padding(.bottom, 4)
- ForEach(allTags) { tag in
- let isAssigned = skill.tags.contains(where: { $0.name == tag.name })
- Button {
- if isAssigned {
- skill.tags.removeAll { $0.name == tag.name }
- } else {
- skill.tags.append(tag)
- }
- try? modelContext.save()
- } label: {
- HStack {
- Circle()
- .fill(Color(hex: tag.color) ?? .gray)
- .frame(width: 8, height: 8)
- Text(tag.name)
- Spacer()
- if isAssigned {
- Image(systemName: "checkmark")
- }
- }
- }
- .buttonStyle(.plain)
- }
- if allTags.isEmpty {
- Text("No tags yet")
- .foregroundStyle(.secondary)
- .font(.caption)
- }
- }
- .padding()
- .frame(width: 200)
+ private var installedPathsSummary: String {
+ let home = FileManager.default.homeDirectoryForCurrentUser.path
+ return skill.installedPaths
+ .map { $0.replacingOccurrences(of: home, with: "~") }
+ .joined(separator: "\n")
}
private var collectionPickerContent: some View {
diff --git a/Chops/Views/Settings/SettingsView.swift b/Chops/Views/Settings/SettingsView.swift
index dcd58e4..d393e59 100644
--- a/Chops/Views/Settings/SettingsView.swift
+++ b/Chops/Views/Settings/SettingsView.swift
@@ -1,7 +1,10 @@
import SwiftUI
+extension Notification.Name {
+ static let customScanPathsChanged = Notification.Name("customScanPathsChanged")
+}
+
struct SettingsView: View {
- @AppStorage("customScanPaths") private var customScanPathsData: Data = Data()
@State private var customPaths: [String] = []
@State private var defaultTool: ToolSource = .claude
@@ -40,7 +43,7 @@ struct SettingsView: View {
Text("Custom Scan Directories")
.font(.headline)
- Text("Add directories to scan for skills beyond the default tool locations.")
+ Text("Add a parent directory (e.g. ~/Development) and Chops will scan each project inside it for tool-specific skills.")
.font(.caption)
.foregroundStyle(.secondary)
@@ -92,5 +95,6 @@ struct SettingsView: View {
private func saveCustomPaths() {
UserDefaults.standard.set(customPaths, forKey: "customScanPaths")
+ NotificationCenter.default.post(name: .customScanPathsChanged, object: nil)
}
}
diff --git a/Chops/Views/Shared/ToolBadge.swift b/Chops/Views/Shared/ToolBadge.swift
index 2e99a02..057699e 100644
--- a/Chops/Views/Shared/ToolBadge.swift
+++ b/Chops/Views/Shared/ToolBadge.swift
@@ -1,34 +1,48 @@
import SwiftUI
+/// Small text badge for the metadata bar
struct ToolBadge: View {
let tool: ToolSource
- var size: BadgeSize = .regular
- enum BadgeSize {
- case small, regular, large
+ var body: some View {
+ Text(tool.shortLabel)
+ .font(.system(size: 9, weight: .semibold, design: .rounded))
+ .foregroundStyle(.secondary)
+ .padding(.horizontal, 4)
+ .padding(.vertical, 2)
+ .background(.quaternary, in: RoundedRectangle(cornerRadius: 3))
+ }
+}
- var iconFont: Font {
- switch self {
- case .small: .caption2
- case .regular: .caption
- case .large: .body
- }
- }
+/// Icon for the sidebar — uses custom logo asset or SF Symbol fallback
+struct ToolIcon: View {
+ let tool: ToolSource
+ var size: CGFloat = 16
- var padding: CGFloat {
- switch self {
- case .small: 3
- case .regular: 4
- case .large: 6
- }
+ var body: some View {
+ if let assetName = tool.logoAssetName {
+ Image(assetName)
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: size, height: size)
+ } else {
+ Image(systemName: tool.iconName)
+ .frame(width: size, height: size)
}
}
+}
- var body: some View {
- Image(systemName: tool.iconName)
- .font(size.iconFont)
- .foregroundStyle(.white)
- .padding(size.padding)
- .background(tool.color, in: RoundedRectangle(cornerRadius: 4))
+extension ToolSource {
+ var shortLabel: String {
+ switch self {
+ case .claude: "CC"
+ case .cursor: "CU"
+ case .windsurf: "WS"
+ case .codex: "CX"
+ case .copilot: "CP"
+ case .aider: "AI"
+ case .amp: "AM"
+ case .custom: "?"
+ }
}
}
diff --git a/Chops/Views/Sidebar/CollectionListView.swift b/Chops/Views/Sidebar/CollectionListView.swift
index 9f8875a..cfab2b4 100644
--- a/Chops/Views/Sidebar/CollectionListView.swift
+++ b/Chops/Views/Sidebar/CollectionListView.swift
@@ -2,7 +2,6 @@ import SwiftUI
import SwiftData
struct CollectionListView: View {
- @Environment(AppState.self) private var appState
@Environment(\.modelContext) private var modelContext
@Query(sort: \SkillCollection.sortOrder) private var collections: [SkillCollection]
@State private var showingNewCollection = false
@@ -18,36 +17,15 @@ struct CollectionListView: View {
var body: some View {
ForEach(collections) { collection in
- Button {
- if appState.sidebarFilter == .collection(collection.name) {
- appState.sidebarFilter = .all
- } else {
- appState.sidebarFilter = .collection(collection.name)
- }
- } label: {
- Label {
- HStack {
- Text(collection.name)
- Spacer()
- Text("\(collection.skills.count)")
- .foregroundStyle(.secondary)
- .font(.caption)
- }
- } icon: {
- Image(systemName: collection.icon)
- }
- }
- .buttonStyle(.plain)
- .fontWeight(appState.sidebarFilter == .collection(collection.name) ? .semibold : .regular)
- .contextMenu {
- Button("Delete", role: .destructive) {
- modelContext.delete(collection)
- try? modelContext.save()
- if appState.sidebarFilter == .collection(collection.name) {
- appState.sidebarFilter = .all
+ Label(collection.name, systemImage: collection.icon)
+ .badge(collection.skills.count)
+ .tag(SidebarFilter.collection(collection.name))
+ .contextMenu {
+ Button("Delete", role: .destructive) {
+ modelContext.delete(collection)
+ try? modelContext.save()
}
}
- }
}
Button {
diff --git a/Chops/Views/Sidebar/SidebarView.swift b/Chops/Views/Sidebar/SidebarView.swift
index 2bfd1f8..866c367 100644
--- a/Chops/Views/Sidebar/SidebarView.swift
+++ b/Chops/Views/Sidebar/SidebarView.swift
@@ -2,147 +2,51 @@ import SwiftUI
import SwiftData
struct SidebarView: View {
- @Environment(\.modelContext) private var modelContext
@Environment(AppState.self) private var appState
@Query(sort: \Skill.name) private var allSkills: [Skill]
- @Query(sort: \Tag.name) private var tags: [Tag]
@Query(sort: \SkillCollection.sortOrder) private var collections: [SkillCollection]
- private var filteredSkills: [Skill] {
- var result = allSkills
-
- switch appState.sidebarFilter {
- case .all:
- break
- case .favorites:
- result = result.filter { $0.isFavorite }
- case .tool(let tool):
- result = result.filter { $0.toolSource == tool }
- case .tag(let tagName):
- result = result.filter { skill in
- skill.tags.contains { $0.name == tagName }
- }
- case .collection(let collName):
- result = result.filter { skill in
- skill.collections.contains { $0.name == collName }
- }
- }
-
- if !appState.searchText.isEmpty {
- result = result.filter {
- $0.name.localizedCaseInsensitiveContains(appState.searchText) ||
- $0.skillDescription.localizedCaseInsensitiveContains(appState.searchText) ||
- $0.content.localizedCaseInsensitiveContains(appState.searchText)
- }
+ private var activeSources: [ToolSource] {
+ ToolSource.allCases.filter { tool in
+ allSkills.contains { $0.toolSources.contains(tool) }
}
+ }
- return result
+ private func toolCount(_ tool: ToolSource) -> Int {
+ allSkills.filter { $0.toolSources.contains(tool) }.count
}
var body: some View {
@Bindable var appState = appState
- List(selection: $appState.selectedSkill) {
- // Filter sections
+ List(selection: $appState.sidebarFilter) {
Section("Library") {
- SidebarFilterRow(label: "All Skills", icon: "tray.full", filter: .all, count: allSkills.count)
- SidebarFilterRow(label: "Favorites", icon: "star.fill", filter: .favorites, count: allSkills.filter(\.isFavorite).count)
- }
-
- Section("Tools") {
- ToolFilterView()
- }
+ Label("All Skills", systemImage: "tray.full")
+ .badge(allSkills.count)
+ .tag(SidebarFilter.all)
- if !tags.isEmpty {
- Section("Tags") {
- TagFilterView()
- }
+ Label("Favorites", systemImage: "star")
+ .badge(allSkills.filter(\.isFavorite).count)
+ .tag(SidebarFilter.favorites)
}
- if !collections.isEmpty {
- Section("Collections") {
- CollectionListView()
+ Section("Tools") {
+ ForEach(activeSources) { tool in
+ Label {
+ Text(tool.displayName)
+ } icon: {
+ ToolIcon(tool: tool)
+ }
+ .badge(toolCount(tool))
+ .tag(SidebarFilter.tool(tool))
}
}
- Section("Skills") {
- ForEach(filteredSkills) { skill in
- SkillRow(skill: skill)
- .tag(skill)
- .contextMenu {
- Button(skill.isFavorite ? "Unfavorite" : "Favorite") {
- skill.isFavorite.toggle()
- try? modelContext.save()
- }
- Divider()
- Button("Show in Finder") {
- NSWorkspace.shared.selectFile(skill.filePath, inFileViewerRootedAtPath: "")
- }
- }
- }
+ Section("Collections") {
+ CollectionListView()
}
}
.listStyle(.sidebar)
.navigationTitle("Chops")
}
}
-
-struct SidebarFilterRow: View {
- @Environment(AppState.self) private var appState
- let label: String
- let icon: String
- let filter: SidebarFilter
- let count: Int
-
- var body: some View {
- Button {
- appState.sidebarFilter = filter
- } label: {
- Label {
- HStack {
- Text(label)
- Spacer()
- Text("\(count)")
- .foregroundStyle(.secondary)
- .font(.caption)
- }
- } icon: {
- Image(systemName: icon)
- }
- }
- .buttonStyle(.plain)
- .fontWeight(appState.sidebarFilter == filter ? .semibold : .regular)
- }
-}
-
-struct SkillRow: View {
- let skill: Skill
-
- var body: some View {
- HStack(spacing: 8) {
- ToolBadge(tool: skill.toolSource, size: .small)
-
- VStack(alignment: .leading, spacing: 2) {
- Text(skill.name)
- .fontWeight(.medium)
- .lineLimit(1)
-
- if !skill.skillDescription.isEmpty {
- Text(skill.skillDescription)
- .font(.caption)
- .foregroundStyle(.secondary)
- .lineLimit(1)
- }
- }
-
- Spacer()
-
- if skill.isFavorite {
- Image(systemName: "star.fill")
- .font(.caption)
- .foregroundStyle(.yellow)
- }
- }
- .padding(.vertical, 2)
- }
-}
diff --git a/Chops/Views/Sidebar/SkillListView.swift b/Chops/Views/Sidebar/SkillListView.swift
new file mode 100644
index 0000000..3b03db8
--- /dev/null
+++ b/Chops/Views/Sidebar/SkillListView.swift
@@ -0,0 +1,102 @@
+import SwiftUI
+import SwiftData
+
+struct SkillListView: View {
+ @Environment(\.modelContext) private var modelContext
+ @Environment(AppState.self) private var appState
+ @Query(sort: \Skill.name) private var allSkills: [Skill]
+
+ private var filteredSkills: [Skill] {
+ var result = allSkills
+
+ switch appState.sidebarFilter {
+ case .all:
+ break
+ case .favorites:
+ result = result.filter { $0.isFavorite }
+ case .tool(let tool):
+ result = result.filter { $0.toolSources.contains(tool) }
+ case .collection(let collName):
+ result = result.filter { skill in
+ skill.collections.contains { $0.name == collName }
+ }
+ }
+
+ if !appState.searchText.isEmpty {
+ result = result.filter {
+ $0.name.localizedCaseInsensitiveContains(appState.searchText) ||
+ $0.skillDescription.localizedCaseInsensitiveContains(appState.searchText) ||
+ $0.content.localizedCaseInsensitiveContains(appState.searchText)
+ }
+ }
+
+ return result
+ }
+
+ private var title: String {
+ switch appState.sidebarFilter {
+ case .all: "All Skills"
+ case .favorites: "Favorites"
+ case .tool(let tool): tool.displayName
+ case .collection(let name): name
+ }
+ }
+
+ var body: some View {
+ @Bindable var appState = appState
+
+ List(selection: $appState.selectedSkill) {
+ ForEach(filteredSkills) { skill in
+ SkillRow(skill: skill)
+ .tag(skill)
+ .contextMenu {
+ Button(skill.isFavorite ? "Unfavorite" : "Favorite") {
+ skill.isFavorite.toggle()
+ try? modelContext.save()
+ }
+ Divider()
+ Button("Show in Finder") {
+ NSWorkspace.shared.selectFile(skill.filePath, inFileViewerRootedAtPath: "")
+ }
+ }
+ }
+ }
+ .navigationTitle(title)
+ .overlay {
+ if filteredSkills.isEmpty {
+ ContentUnavailableView(
+ "No Skills",
+ systemImage: "doc.text",
+ description: Text("No skills match the current filter.")
+ )
+ }
+ }
+ }
+}
+
+struct SkillRow: View {
+ let skill: Skill
+
+ var body: some View {
+ HStack {
+ Text(skill.name)
+ .lineLimit(1)
+
+ Spacer()
+
+ if let project = skill.projectName {
+ Text(project)
+ .font(.caption)
+ .foregroundStyle(.tertiary)
+ .lineLimit(1)
+ }
+
+ if skill.isFavorite {
+ Image(systemName: "star.fill")
+ .font(.caption2)
+ .foregroundStyle(.yellow)
+ }
+ }
+ .padding(.vertical, 4)
+ }
+}
diff --git a/Chops/Views/Sidebar/TagFilterView.swift b/Chops/Views/Sidebar/TagFilterView.swift
deleted file mode 100644
index 255788f..0000000
--- a/Chops/Views/Sidebar/TagFilterView.swift
+++ /dev/null
@@ -1,106 +0,0 @@
-import SwiftUI
-import SwiftData
-
-struct TagFilterView: View {
- @Environment(AppState.self) private var appState
- @Environment(\.modelContext) private var modelContext
- @Query(sort: \Tag.name) private var tags: [Tag]
- @State private var showingNewTag = false
- @State private var newTagName = ""
- @State private var newTagColor = Color.blue
-
- var body: some View {
- ForEach(tags) { tag in
- Button {
- if appState.sidebarFilter == .tag(tag.name) {
- appState.sidebarFilter = .all
- } else {
- appState.sidebarFilter = .tag(tag.name)
- }
- } label: {
- Label {
- HStack {
- Text(tag.name)
- Spacer()
- Text("\(tag.skills.count)")
- .foregroundStyle(.secondary)
- .font(.caption)
- }
- } icon: {
- Circle()
- .fill(Color(hex: tag.color) ?? .gray)
- .frame(width: 10, height: 10)
- }
- }
- .buttonStyle(.plain)
- .fontWeight(appState.sidebarFilter == .tag(tag.name) ? .semibold : .regular)
- .contextMenu {
- Button("Delete", role: .destructive) {
- modelContext.delete(tag)
- try? modelContext.save()
- if appState.sidebarFilter == .tag(tag.name) {
- appState.sidebarFilter = .all
- }
- }
- }
- }
-
- Button {
- showingNewTag = true
- } label: {
- Label("New Tag", systemImage: "plus.circle")
- .foregroundStyle(.secondary)
- }
- .buttonStyle(.plain)
- .popover(isPresented: $showingNewTag) {
- VStack(spacing: 12) {
- TextField("Tag name", text: $newTagName)
- .textFieldStyle(.roundedBorder)
- ColorPicker("Color", selection: $newTagColor)
- HStack {
- Button("Cancel") { showingNewTag = false }
- Spacer()
- Button("Create") {
- let tag = Tag(name: newTagName, color: newTagColor.hexString)
- modelContext.insert(tag)
- try? modelContext.save()
- newTagName = ""
- showingNewTag = false
- }
- .disabled(newTagName.isEmpty)
- }
- }
- .padding()
- .frame(width: 220)
- }
- }
-}
-
-// MARK: - Color Hex Helpers
-
-extension Color {
- init?(hex: String) {
- var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
- hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
- guard hexSanitized.count == 6 else { return nil }
-
- var rgb: UInt64 = 0
- Scanner(string: hexSanitized).scanHexInt64(&rgb)
-
- self.init(
- red: Double((rgb & 0xFF0000) >> 16) / 255.0,
- green: Double((rgb & 0x00FF00) >> 8) / 255.0,
- blue: Double(rgb & 0x0000FF) / 255.0
- )
- }
-
- var hexString: String {
- guard let components = NSColor(self).cgColor.components, components.count >= 3 else {
- return "#808080"
- }
- let r = Int(components[0] * 255)
- let g = Int(components[1] * 255)
- let b = Int(components[2] * 255)
- return String(format: "#%02X%02X%02X", r, g, b)
- }
-}
diff --git a/Chops/Views/Sidebar/ToolFilterView.swift b/Chops/Views/Sidebar/ToolFilterView.swift
index e585579..ffada91 100644
--- a/Chops/Views/Sidebar/ToolFilterView.swift
+++ b/Chops/Views/Sidebar/ToolFilterView.swift
@@ -6,12 +6,12 @@ struct ToolFilterView: View {
@Query(sort: \Skill.name) private var allSkills: [Skill]
private func count(for tool: ToolSource) -> Int {
- allSkills.filter { $0.toolSource == tool }.count
+ allSkills.filter { $0.toolSources.contains(tool) }.count
}
private var activeSources: [ToolSource] {
ToolSource.allCases.filter { tool in
- allSkills.contains { $0.toolSource == tool }
+ allSkills.contains { $0.toolSources.contains(tool) }
}
}
@@ -24,17 +24,12 @@ struct ToolFilterView: View {
appState.sidebarFilter = .tool(tool)
}
} label: {
- Label {
- HStack {
- Text(tool.displayName)
- Spacer()
- Text("\(count(for: tool))")
- .foregroundStyle(.secondary)
- .font(.caption)
- }
- } icon: {
- Image(systemName: tool.iconName)
- .foregroundStyle(tool.color)
+ HStack {
+ Text(tool.displayName)
+ Spacer()
+ Text("\(count(for: tool))")
+ .foregroundStyle(.tertiary)
+ .font(.caption)
}
}
.buttonStyle(.plain)
diff --git a/ChopsIcon.icon/Assets/blocks.svg b/ChopsIcon.icon/Assets/blocks.svg
new file mode 100644
index 0000000..a07fdbb
--- /dev/null
+++ b/ChopsIcon.icon/Assets/blocks.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-blocks-icon lucide-blocks"><path d="M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2"/><rect x="14" y="2" width="8" height="8" rx="1"/></svg>
\ No newline at end of file
diff --git a/ChopsIcon.icon/icon.json b/ChopsIcon.icon/icon.json
new file mode 100644
index 0000000..df88c31
--- /dev/null
+++ b/ChopsIcon.icon/icon.json
@@ -0,0 +1,56 @@
+{
+ "fill" : {
+ "linear-gradient" : [
+ "extended-srgb:0.20392,0.78039,0.34902,1.00000",
+ "extended-srgb:0.00000,0.78431,0.70196,1.00000"
+ ],
+ "orientation" : {
+ "start" : {
+ "x" : 0.5,
+ "y" : 0
+ },
+ "stop" : {
+ "x" : 0.5,
+ "y" : 0.7
+ }
+ }
+ },
+ "groups" : [
+ {
+ "layers" : [
+ {
+ "blend-mode" : "normal",
+ "fill" : {
+ "solid" : "extended-gray:1.00000,1.00000"
+ },
+ "glass" : true,
+ "hidden" : false,
+ "image-name" : "blocks.svg",
+ "name" : "blocks",
+ "opacity" : 1,
+ "position" : {
+ "scale" : 30,
+ "translation-in-points" : [
+ 0,
+ 0
+ ]
+ }
+ }
+ ],
+ "shadow" : {
+ "kind" : "neutral",
+ "opacity" : 0.5
+ },
+ "translucency" : {
+ "enabled" : true,
+ "value" : 0.5
+ }
+ }
+ ],
+ "supported-platforms" : {
+ "circles" : [
+ "watchOS"
+ ],
+ "squares" : "shared"
+ }
+}
\ No newline at end of file
diff --git a/logos/amp.svg b/logos/amp.svg
new file mode 100644
index 0000000..683e16c
--- /dev/null
+++ b/logos/amp.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Amp</title><path d="M15.087 23.18L12.03 24l-2.097-7.823-5.738 5.738-2.251-2.251 5.718-5.719-7.769-2.082.82-3.057 11.294 3.08 3.08 11.295z"></path><path d="M19.505 18.762l-3.057.82-2.564-9.573-9.572-2.564.819-3.057 11.295 3.079 3.08 11.295z"></path><path d="M23.893 14.374l-3.057.82-2.565-9.572L8.7 3.057 9.52 0l11.295 3.08 3.079 11.294z"></path></svg>
\ No newline at end of file
diff --git a/logos/claudecode.svg b/logos/claudecode.svg
new file mode 100644
index 0000000..1411717
--- /dev/null
+++ b/logos/claudecode.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Antigravity</title><path clip-rule="evenodd" d="M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"></path></svg>
\ No newline at end of file
diff --git a/logos/codex.svg b/logos/codex.svg
new file mode 100644
index 0000000..ad3ea8b
--- /dev/null
+++ b/logos/codex.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12">
+ <defs>
+ <style>
+ .cls-1 {
+ fill-rule: evenodd;
+ }
+ </style>
+ </defs>
+ <g id="Layer_1-2" data-name="Layer 1">
+ <path class="cls-1" d="M4.04.23C4.52.03,5.05-.04,5.57.02c.67.08,1.26.36,1.78.85.01.01.03.02.05.01.7-.17,1.38-.11,2.03.18h.03s.08.05.08.05c.68.35,1.16.88,1.46,1.6.14.34.21.69.21,1.06,0,.27-.02.55-.09.82,0,.03,0,.06.02.08.39.4.67.9.79,1.45.19.95,0,1.81-.59,2.57l-.09.11c-.39.44-.9.77-1.47.93-.03,0-.05.03-.05.05-.13.37-.26.68-.49,1-.6.79-1.48,1.23-2.47,1.23-.79,0-1.49-.29-2.11-.87-.02-.02-.05-.02-.07-.02-.26.08-.52.1-.8.09-.45,0-.89-.11-1.3-.31-.42-.21-.79-.51-1.07-.89-.1-.13-.2-.26-.28-.41-.1-.21-.18-.42-.25-.64-.13-.5-.14-1.03,0-1.53,0-.01,0-.02,0-.04,0-.01,0-.02-.02-.03-.31-.31-.54-.69-.69-1.1-.1-.25-.15-.52-.17-.79-.02-.36,0-.72.09-1.07.22-.74.65-1.32,1.29-1.75.14-.09.27-.17.4-.22.14-.06.29-.11.43-.15.02,0,.04-.02.04-.04.11-.39.3-.76.55-1.08.34-.42.75-.73,1.23-.93ZM3.64,4.15c-.12-.2-.38-.27-.58-.16-.2.12-.27.38-.16.58l.85,1.48-.84,1.42c-.11.21-.03.46.17.57.19.1.44.04.56-.14l.97-1.64c.08-.13.08-.29,0-.43,0,0-.97-1.7-.97-1.7ZM6.36,7.27c-.23.01-.41.21-.4.45.01.21.18.39.4.4h2.42c.23-.01.41-.21.4-.44-.01-.22-.19-.39-.4-.4h-2.42Z"/>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/logos/cursor.svg b/logos/cursor.svg
new file mode 100644
index 0000000..a5b2ee3
--- /dev/null
+++ b/logos/cursor.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Cursor</title><path d="M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"></path></svg>
\ No newline at end of file
diff --git a/logos/windsurf.svg b/logos/windsurf.svg
new file mode 100644
index 0000000..4df8f33
--- /dev/null
+++ b/logos/windsurf.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Windsurf</title><path clip-rule="evenodd" d="M23.78 5.004h-.228a2.187 2.187 0 00-2.18 2.196v4.912c0 .98-.804 1.775-1.76 1.775a1.818 1.818 0 01-1.472-.773L13.168 5.95a2.197 2.197 0 00-1.81-.95c-1.134 0-2.154.972-2.154 2.173v4.94c0 .98-.797 1.775-1.76 1.775-.57 0-1.136-.289-1.472-.773L.408 5.098C.282 4.918 0 5.007 0 5.228v4.284c0 .216.066.426.188.604l5.475 7.889c.324.466.8.812 1.351.938 1.377.316 2.645-.754 2.645-2.117V11.89c0-.98.787-1.775 1.76-1.775h.002c.586 0 1.135.288 1.472.773l4.972 7.163a2.15 2.15 0 001.81.95c1.158 0 2.151-.973 2.151-2.173v-4.939c0-.98.787-1.775 1.76-1.775h.194c.122 0 .22-.1.22-.222V5.225a.221.221 0 00-.22-.222z"></path></svg>
\ No newline at end of file
diff --git a/project.yml b/project.yml
index 7896d88..c686d43 100644
--- a/project.yml
+++ b/project.yml
@@ -32,3 +32,4 @@ targets:
MACOSX_DEPLOYMENT_TARGET: "26.0"
GENERATE_INFOPLIST_FILE: NO
SWIFT_STRICT_CONCURRENCY: minimal
+ ASSETCATALOG_COMPILER_APPICON_NAME: ChopsIcon