Your AI agent skills, finally organized. A macOS app to browse, edit, and manage skills across Claude Code, Cursor, Codex, Windsurf, and Amp.
feat: auto-save skill files after 1 second of inactivity (#62)
Josh Pigforddf3cdfd1e97a
diff --git a/Chops/Views/Detail/SkillDetailView.swift b/Chops/Views/Detail/SkillDetailView.swiftindex c857dcd..57984b5 100644--- a/Chops/Views/Detail/SkillDetailView.swift+++ b/Chops/Views/Detail/SkillDetailView.swift@@ -22,6 +22,7 @@ struct SkillDetailView: View {@AppStorage("preferPreview") private var preferPreview = false@State private var document = SkillEditorDocument()@State private var activeAlert: ActiveAlert?+ @State private var autoSaveTask: Task<Void, Never>?var body: some View {@Bindable var document = document@@ -42,8 +43,20 @@ struct SkillDetailView: View {document.load(from: skill)}.onChange(of: skill.filePath) {+ autoSaveTask?.cancel()document.load(from: skill)}+ .onChange(of: document.editorContent) {+ autoSaveTask?.cancel()+ autoSaveTask = Task {+ try? await Task.sleep(for: .seconds(1))+ guard !Task.isCancelled, document.hasUnsavedChanges else { return }+ document.save(to: skill)+ }+ }+ .onDisappear {+ autoSaveTask?.cancel()+ }.onReceive(NotificationCenter.default.publisher(for: .saveCurrentSkill)) { _ indocument.save(to: skill)}diff --git a/Chops/Views/Detail/SkillEditorView.swift b/Chops/Views/Detail/SkillEditorView.swiftindex deed9f1..596b0ed 100644--- a/Chops/Views/Detail/SkillEditorView.swift+++ b/Chops/Views/Detail/SkillEditorView.swift@@ -211,14 +211,6 @@ struct SkillEditorView: View {.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)}