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.

fix: Discover skills directly inside custom scan directories (#79)

Josh Pigford247f5008e2e8
diff --git a/Chops/App/ContentView.swift b/Chops/App/ContentView.swift
index a1ec7d1..963e704 100644
--- a/Chops/App/ContentView.swift
+++ b/Chops/App/ContentView.swift
@@ -57,6 +57,7 @@ struct ContentView: View {
for tool in ToolSource.allCases {
allPaths.append(contentsOf: tool.globalPaths)
allPaths.append(contentsOf: tool.globalAgentPaths)
+ allPaths.append(contentsOf: tool.globalRulePaths)
}
let fm = FileManager.default
let home = fm.homeDirectoryForCurrentUser.path
diff --git a/Chops/Services/SkillScanner.swift b/Chops/Services/SkillScanner.swift
index 9f71deb..5d3b556 100644
--- a/Chops/Services/SkillScanner.swift
+++ b/Chops/Services/SkillScanner.swift
@@ -131,6 +131,9 @@ final class SkillScanner {
private static func collectFromCustomDirectory(_ directory: URL, into results: inout [ScannedSkillData]) {
let fm = FileManager.default
+
+ collectDirectSkillsFromCustomDirectory(directory, into: &results)
+
guard let projects = try? fm.contentsOfDirectory(
at: directory,
includingPropertiesForKeys: [.isDirectoryKey],
@@ -161,6 +164,55 @@ final class SkillScanner {
}
}
+ /// Custom scan paths serve two different jobs:
+ /// - parent dirs like ~/Development that contain projects with tool-specific folders
+ /// - library dirs that contain skills directly as child folders/files
+ ///
+ /// Only scan direct skill-style entries here so repo-level AGENTS.md files do not become
+ /// bogus custom skills when the user adds a generic project parent directory.
+ private static func collectDirectSkillsFromCustomDirectory(_ directory: URL, into results: inout [ScannedSkillData]) {
+ let fm = FileManager.default
+
+ guard let contents = try? fm.contentsOfDirectory(
+ at: directory,
+ includingPropertiesForKeys: [.isDirectoryKey],
+ options: [.skipsHiddenFiles]
+ ) else { return }
+
+ for item in contents {
+ guard !Task.isCancelled else { return }
+
+ var isDirectory: ObjCBool = false
+ fm.fileExists(atPath: item.path, isDirectory: &isDirectory)
+
+ if isDirectory.boolValue {
+ let skillFile = item.appendingPathComponent("SKILL.md")
+ guard fm.fileExists(atPath: skillFile.path) else { continue }
+ if let data = collectSkillData(
+ at: skillFile,
+ toolSource: .custom,
+ isDirectory: true,
+ isGlobal: false,
+ kind: .skill
+ ) {
+ results.append(data)
+ }
+ } else {
+ guard ["md", "mdc", "toml"].contains(item.pathExtension) else { continue }
+ guard !shouldIgnoreLooseMarkdownFile(named: item.lastPathComponent) else { continue }
+ if let data = collectSkillData(
+ at: item,
+ toolSource: .custom,
+ isDirectory: false,
+ isGlobal: false,
+ kind: .skill
+ ) {
+ results.append(data)
+ }
+ }
+ }
+ }
+
private static func collectFromDirectory(_ directory: URL, toolSource: ToolSource, isGlobal: Bool, kind: ItemKind = .skill, into results: inout [ScannedSkillData]) {
let fm = FileManager.default
diff --git a/Chops/Views/Shared/NewSkillSheet.swift b/Chops/Views/Shared/NewSkillSheet.swift
index 037946e..35601a1 100644
--- a/Chops/Views/Shared/NewSkillSheet.swift
+++ b/Chops/Views/Shared/NewSkillSheet.swift
@@ -74,12 +74,6 @@ struct NewSkillSheet: View {
private func createItem() {
let fm = FileManager.default
- let configHome: String = {
- if let xdg = ProcessInfo.processInfo.environment["XDG_CONFIG_HOME"], !xdg.isEmpty {
- return xdg
- }
- return "\(fm.homeDirectoryForCurrentUser.path)/.config"
- }()
let sanitizedName = skillName
.lowercased()
.replacingOccurrences(of: " ", with: "-")