From 6cc10220be7e7eb5e91ebdd98cf7116d9370e3d1 Mon Sep 17 00:00:00 2001 From: Willie Date: Sun, 4 Oct 2026 19:34:24 +0800 Subject: [PATCH 1/3] fix(ui): make the mixed folder switch read as partly on The tree pane's folder switch showed a partial state by only centering the knob on the off-colored track. On a 34px track that looked like a stuck or broken off switch. Give the mixed state a half-tone track and a dash in the knob, the way an indeterminate checkbox reads. --- ui/src/components.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/src/components.css b/ui/src/components.css index 2e5b359a5..a5d0cf197 100644 --- a/ui/src/components.css +++ b/ui/src/components.css @@ -158,12 +158,15 @@ svg.lucide { flex: none; stroke-width: var(--isw); } .ss-sw i { width: 16px; height: 16px; border-radius: 99px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); } .ss-sw.on { background: var(--ink); justify-content: flex-end; } .ss-sw.on i { background: var(--surface); } -/* Some of the items it covers are on: knob in the middle, track as for off. */ -.ss-sw.mix { justify-content: center; } +/* Some of the items it covers are on: half-tone track, centered knob with a dash. */ +.ss-sw.mix { justify-content: center; background: var(--ink-3); } +.ss-sw.mix i { display: grid; place-items: center; } +.ss-sw.mix i::after { content: ''; width: 8px; height: 2px; border-radius: 1px; background: var(--ink-3); } :root[data-theme="playful"] .ss-sw { width: 38px; height: 22px; background: var(--surface); border: 2px solid var(--line); padding: 2px; } :root[data-theme="playful"] .ss-sw i { width: 14px; height: 14px; background: var(--ink-3); box-shadow: none; } :root[data-theme="playful"] .ss-sw.on { background: var(--ok-bg); } :root[data-theme="playful"] .ss-sw.on i { background: var(--ok); } +:root[data-theme="playful"] .ss-sw.mix i::after { width: 6px; background: var(--surface); } .ss-st { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; } .ss-st::before { content: ''; width: 7px; height: 7px; border-radius: 99px; background: var(--ink-3); } .ss-st.ok::before { background: var(--ok); } From d4c2f6e9a091fe6b291275ec78deddce94e197e3 Mon Sep 17 00:00:00 2001 From: Willie Date: Sun, 4 Oct 2026 19:34:24 +0800 Subject: [PATCH 2/3] fix(server): report toggles that .local ignore rules override Disabling a skill only checked that its path was written to .skillignore. A "!" rule in .skillignore.local is applied after that file, and an unanchored one such as "!feature-radar" re-includes every path segment with that name, so the skill stayed enabled while the dashboard reported success. The dashboard also never showed the .local file, so nothing explained why. Single and batch toggles now re-discover after writing and report an item that did not reach the requested state as failed, naming the overriding file; the batch toast shows the first failure's reason. GET /api/skillignore and /api/agentignore return the .local file, and Settings > Files shows its rules above the editor. --- internal/server/handler_agentignore.go | 2 + internal/server/handler_skillignore.go | 19 +++++++ internal/server/handler_skillignore_test.go | 43 +++++++++++++++ internal/server/handler_toggle.go | 55 +++++++++++++++++++- internal/server/handler_toggle_batch.go | 53 +++++++++++++++---- internal/server/handler_toggle_batch_test.go | 28 ++++++++++ internal/server/handler_toggle_test.go | 21 ++++++++ ui/src/api/types/config.ts | 8 +++ ui/src/i18n/locales/de.json | 1 + ui/src/i18n/locales/en.json | 1 + ui/src/i18n/locales/es.json | 1 + ui/src/i18n/locales/fa.json | 1 + ui/src/i18n/locales/fr.json | 1 + ui/src/i18n/locales/id.json | 1 + ui/src/i18n/locales/ja.json | 1 + ui/src/i18n/locales/ko.json | 1 + ui/src/i18n/locales/pt-BR.json | 1 + ui/src/i18n/locales/zh-CN.json | 1 + ui/src/i18n/locales/zh-TW.json | 1 + ui/src/pages/ConfigPage.tsx | 12 +++++ ui/src/pages/ResourcesPage.test.tsx | 2 +- ui/src/pages/ResourcesPage.tsx | 7 ++- website/docs/reference/commands/ui.md | 6 +-- website/docs/reference/filtering.md | 2 +- 24 files changed, 250 insertions(+), 19 deletions(-) create mode 100644 internal/server/handler_skillignore_test.go create mode 100644 internal/server/handler_toggle_test.go diff --git a/internal/server/handler_agentignore.go b/internal/server/handler_agentignore.go index ab968dda9..17ead6942 100644 --- a/internal/server/handler_agentignore.go +++ b/internal/server/handler_agentignore.go @@ -23,6 +23,7 @@ type agentignoreResponse struct { Exists bool `json:"exists"` Path string `json:"path"` Raw string `json:"raw"` + Local *ignoreLocalFile `json:"local,omitempty"` Stats *agentignoreStats `json:"stats,omitempty"` } @@ -45,6 +46,7 @@ func (s *Server) handleGetAgentignore(w http.ResponseWriter, _ *http.Request) { Exists: err == nil, Path: ignorePath, Raw: string(raw), + Local: readIgnoreLocal(ignorePath), } // Discover agents to compute ignore stats diff --git a/internal/server/handler_skillignore.go b/internal/server/handler_skillignore.go index 6da5cc08e..85ffbd217 100644 --- a/internal/server/handler_skillignore.go +++ b/internal/server/handler_skillignore.go @@ -21,9 +21,27 @@ type skillignoreResponse struct { Exists bool `json:"exists"` Path string `json:"path"` Raw string `json:"raw"` + Local *ignoreLocalFile `json:"local,omitempty"` Stats *skillignoreStats `json:"stats,omitempty"` } +// ignoreLocalFile is the machine-only .local companion of an ignore file. +// Its rules apply after the shared file and can override it. +type ignoreLocalFile struct { + Path string `json:"path"` + Raw string `json:"raw"` +} + +// readIgnoreLocal returns ignorePath's .local companion, or nil when absent. +func readIgnoreLocal(ignorePath string) *ignoreLocalFile { + localPath := ignorePath + ".local" + raw, err := os.ReadFile(localPath) + if err != nil { + return nil + } + return &ignoreLocalFile{Path: localPath, Raw: string(raw)} +} + func (s *Server) handleGetSkillignore(w http.ResponseWriter, r *http.Request) { // Snapshot source path under RLock, then release before I/O. s.mu.RLock() @@ -38,6 +56,7 @@ func (s *Server) handleGetSkillignore(w http.ResponseWriter, r *http.Request) { Exists: err == nil, Path: ignorePath, Raw: string(raw), // empty if file doesn't exist + Local: readIgnoreLocal(ignorePath), } // Always discover stats — tracked repos may have their own .skillignore diff --git a/internal/server/handler_skillignore_test.go b/internal/server/handler_skillignore_test.go new file mode 100644 index 000000000..d52ed5fe3 --- /dev/null +++ b/internal/server/handler_skillignore_test.go @@ -0,0 +1,43 @@ +package server + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "testing" +) + +func TestHandleGetSkillignore_IncludesLocalFile(t *testing.T) { + s, src := newTestServer(t) + if err := os.WriteFile(filepath.Join(src, ".skillignore.local"), []byte("!feature-radar\n"), 0644); err != nil { + t.Fatalf("seed .skillignore.local: %v", err) + } + + rr := httptest.NewRecorder() + s.handler.ServeHTTP(rr, httptest.NewRequest(http.MethodGet, "/api/skillignore", nil)) + + var resp skillignoreResponse + if err := json.Unmarshal(rr.Body.Bytes(), &resp); err != nil { + t.Fatalf("decode: %v (body=%s)", err, rr.Body.String()) + } + if resp.Local == nil || resp.Local.Raw != "!feature-radar\n" { + t.Fatalf("expected local file contents, got %+v", resp.Local) + } +} + +func TestHandleGetSkillignore_NoLocalFile(t *testing.T) { + s, _ := newTestServer(t) + + rr := httptest.NewRecorder() + s.handler.ServeHTTP(rr, httptest.NewRequest(http.MethodGet, "/api/skillignore", nil)) + + var resp skillignoreResponse + if err := json.Unmarshal(rr.Body.Bytes(), &resp); err != nil { + t.Fatalf("decode: %v (body=%s)", err, rr.Body.String()) + } + if resp.Local != nil { + t.Fatalf("expected no local file, got %+v", resp.Local) + } +} diff --git a/internal/server/handler_toggle.go b/internal/server/handler_toggle.go index 2fa6dd6f8..dd773f7a9 100644 --- a/internal/server/handler_toggle.go +++ b/internal/server/handler_toggle.go @@ -6,6 +6,7 @@ import ( "path/filepath" "time" + "skillshare/internal/resource" "skillshare/internal/skillignore" ssync "skillshare/internal/sync" ) @@ -87,12 +88,24 @@ func (s *Server) handleToggleSkill(w http.ResponseWriter, r *http.Request, enabl writeError(w, http.StatusInternalServerError, "failed to update .skillignore: "+err.Error()) return } - if !added { + if !added && isDisabled { writeJSON(w, map[string]any{"success": true, "name": name, "disabled": true, "message": "already disabled"}) return } } + // The file write alone does not decide the outcome: a later rule, such as a + // "!" line in the .local file, can still override it. + states, err := s.disabledByRelPath(kind, source, agentsSource) + if err != nil { + writeError(w, http.StatusInternalServerError, err.Error()) + return + } + if msg := toggleOverrideError(kind, enable, states[relPath]); msg != "" { + writeError(w, http.StatusConflict, msg) + return + } + s.writeOpsLog(action, "ok", start, map[string]any{ "name": name, "kind": kind, @@ -102,6 +115,46 @@ func (s *Server) handleToggleSkill(w http.ResponseWriter, r *http.Request, enabl writeJSON(w, map[string]any{"success": true, "name": name, "disabled": disabled}) } +// disabledByRelPath re-discovers skills or agents and reports, by relPath, +// whether each is disabled under the merged ignore and .local rules. +func (s *Server) disabledByRelPath(kind, source, agentsSource string) (map[string]bool, error) { + states := map[string]bool{} + if kind == "agent" { + discovered, err := resource.AgentKind{}.Discover(agentsSource) + if err != nil { + return nil, fmt.Errorf("failed to discover agents: %w", err) + } + for _, d := range discovered { + states[d.RelPath] = d.Disabled + } + return states, nil + } + discovered, err := ssync.DiscoverSourceSkillsAll(source) + if err != nil { + return nil, fmt.Errorf("failed to discover skills: %w", err) + } + for _, d := range discovered { + states[d.RelPath] = d.Disabled + } + return states, nil +} + +// toggleOverrideError explains why a toggle did not take effect, or returns "" +// when the resource ended up in the requested state. +func toggleOverrideError(kind string, enable, disabled bool) string { + file := ".skillignore" + if kind == "agent" { + file = ".agentignore" + } + switch { + case !enable && !disabled: + return fmt.Sprintf("still enabled: a \"!\" rule in %[1]s.local or %[1]s re-includes it — remove that rule to disable it", file) + case enable && disabled: + return fmt.Sprintf("still disabled: another rule in %[1]s or %[1]s.local matches it — remove that rule to enable it", file) + } + return "" +} + // resolveSkillRelPath finds a skill's relPath by flatName or baseName. // Searches all skills including disabled ones. Caller must provide source path. func (s *Server) resolveSkillRelPath(source, name string) (string, error) { diff --git a/internal/server/handler_toggle_batch.go b/internal/server/handler_toggle_batch.go index 021553e2d..508aab4b8 100644 --- a/internal/server/handler_toggle_batch.go +++ b/internal/server/handler_toggle_batch.go @@ -109,8 +109,23 @@ func (s *Server) handleBatchToggleSkills(w http.ResponseWriter, r *http.Request) var resp batchToggleResponse resp.Results = make([]batchToggleItemResult, 0, len(req.Names)) + // Each successful result, so its outcome can be checked after writing. + type pending struct { + relPath string + updated bool + } + written := map[int]pending{} + succeed := func(name, relPath string, updated bool) { + written[len(resp.Results)] = pending{relPath, updated} + resp.Results = append(resp.Results, batchToggleItemResult{Name: name, Success: true, Disabled: !req.Enable}) + if updated { + resp.Summary.Updated++ + } else { + resp.Summary.Unchanged++ + } + } - // Acquire the write lock only for the file-write loop. + // Hold the write lock while writing and re-checking the outcome. s.mu.Lock() for _, name := range req.Names { e, ok := lookup[name] @@ -122,8 +137,7 @@ func (s *Server) handleBatchToggleSkills(w http.ResponseWriter, r *http.Request) if req.Enable { if !e.disabled { - resp.Results = append(resp.Results, batchToggleItemResult{Name: name, Success: true, Disabled: false}) - resp.Summary.Unchanged++ + succeed(name, e.relPath, false) continue } removed, err := skillignore.RemovePattern(ignorePath, e.relPath) @@ -141,8 +155,7 @@ func (s *Server) handleBatchToggleSkills(w http.ResponseWriter, r *http.Request) resp.Summary.Failed++ continue } - resp.Results = append(resp.Results, batchToggleItemResult{Name: name, Success: true, Disabled: false}) - resp.Summary.Updated++ + succeed(name, e.relPath, true) continue } @@ -152,13 +165,31 @@ func (s *Server) handleBatchToggleSkills(w http.ResponseWriter, r *http.Request) resp.Summary.Failed++ continue } - if !added { - resp.Results = append(resp.Results, batchToggleItemResult{Name: name, Success: true, Disabled: true}) - resp.Summary.Unchanged++ - continue + succeed(name, e.relPath, added) + } + + // A written rule can still be overridden by a later one, such as a "!" line + // in the .local file, so re-check the outcome the way discovery sees it. + if len(written) > 0 { + states, err := s.disabledByRelPath(req.Kind, source, agentsSource) + if err != nil { + s.mu.Unlock() + writeError(w, http.StatusInternalServerError, err.Error()) + return + } + for i, p := range written { + msg := toggleOverrideError(req.Kind, req.Enable, states[p.relPath]) + if msg == "" { + continue + } + if p.updated { + resp.Summary.Updated-- + } else { + resp.Summary.Unchanged-- + } + resp.Results[i] = batchToggleItemResult{Name: resp.Results[i].Name, Disabled: req.Enable, Error: msg} + resp.Summary.Failed++ } - resp.Results = append(resp.Results, batchToggleItemResult{Name: name, Success: true, Disabled: true}) - resp.Summary.Updated++ } s.mu.Unlock() diff --git a/internal/server/handler_toggle_batch_test.go b/internal/server/handler_toggle_batch_test.go index 9de99c8b3..4013e7ab9 100644 --- a/internal/server/handler_toggle_batch_test.go +++ b/internal/server/handler_toggle_batch_test.go @@ -159,3 +159,31 @@ func TestHandleBatchToggle_InvalidKind(t *testing.T) { t.Errorf("expected 400 for invalid kind, got %d", rr.Code) } } + +// A "!name" rule in .skillignore.local re-includes every path segment called +// name, so writing the skill's path to .skillignore does not disable it. +func seedLocalNegation(t *testing.T, src string) { + t.Helper() + addSkill(t, src, "feature-radar/feature-radar") + addSkill(t, src, "feature-radar/feature-radar-scan") + if err := os.WriteFile(filepath.Join(src, ".skillignore.local"), []byte("!feature-radar\n"), 0644); err != nil { + t.Fatalf("seed .skillignore.local: %v", err) + } +} + +func TestHandleBatchToggle_DisableOverriddenByLocalNegation_Fails(t *testing.T) { + s, src := newTestServer(t) + seedLocalNegation(t, src) + + rr, resp := postBatchToggle(t, s, `{"names":["feature-radar__feature-radar","feature-radar__feature-radar-scan"],"kind":"skill","enable":false}`) + if rr.Code != http.StatusOK { + t.Fatalf("expected 200, got %d: %s", rr.Code, rr.Body.String()) + } + if resp.Summary.Updated != 1 || resp.Summary.Failed != 1 { + t.Fatalf("expected updated=1 failed=1, got %+v", resp.Summary) + } + r := resp.Results[0] + if r.Success || r.Disabled || !strings.Contains(r.Error, ".skillignore.local") { + t.Errorf("expected overridden skill to fail naming .skillignore.local, got %+v", r) + } +} diff --git a/internal/server/handler_toggle_test.go b/internal/server/handler_toggle_test.go new file mode 100644 index 000000000..e8e70c679 --- /dev/null +++ b/internal/server/handler_toggle_test.go @@ -0,0 +1,21 @@ +package server + +import ( + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func TestHandleDisableSkill_OverriddenByLocalNegation_Conflict(t *testing.T) { + s, src := newTestServer(t) + seedLocalNegation(t, src) + + req := httptest.NewRequest(http.MethodPost, "/api/resources/feature-radar__feature-radar/disable", nil) + rr := httptest.NewRecorder() + s.handler.ServeHTTP(rr, req) + + if rr.Code != http.StatusConflict || !strings.Contains(rr.Body.String(), ".skillignore.local") { + t.Fatalf("expected 409 naming .skillignore.local, got %d: %s", rr.Code, rr.Body.String()) + } +} diff --git a/ui/src/api/types/config.ts b/ui/src/api/types/config.ts index d76679e72..69de4dcd2 100644 --- a/ui/src/api/types/config.ts +++ b/ui/src/api/types/config.ts @@ -21,6 +21,12 @@ export interface AvailableTarget { readBy?: string[]; } +// Machine-only .local companion of an ignore file; its rules override the shared file. +export interface IgnoreLocalFile { + path: string; + raw: string; +} + // Skillignore types export interface SkillignoreStats { pattern_count: number; @@ -33,6 +39,7 @@ export interface SkillignoreResponse { exists: boolean; path: string; raw: string; + local?: IgnoreLocalFile; stats?: SkillignoreStats; } @@ -48,5 +55,6 @@ export interface AgentignoreResponse { exists: boolean; path: string; raw: string; + local?: IgnoreLocalFile; stats?: AgentignoreStats; } diff --git a/ui/src/i18n/locales/de.json b/ui/src/i18n/locales/de.json index 19acfc37b..5b402b656 100644 --- a/ui/src/i18n/locales/de.json +++ b/ui/src/i18n/locales/de.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "Noch keine Skills ignoriert.", "config.ignore.noneAgents": "Noch keine Agents ignoriert.", "config.ignore.syntaxNote": "Gleiche Syntax wie .gitignore.", + "config.ignore.localNote": "Auf diesem Rechner gilt zusätzlich {path}. Seine Regeln werden nach dieser Datei angewendet und können sie überschreiben.", "config.revert.confirmText": "Zurücksetzen", "config.revert.message": "Editor auf die zuletzt gespeicherte Version zurücksetzen? Dies kann nicht rückgängig gemacht werden.", "config.revert.title": "Änderungen zurücksetzen", diff --git a/ui/src/i18n/locales/en.json b/ui/src/i18n/locales/en.json index 854f4d3b5..473a0d3ff 100644 --- a/ui/src/i18n/locales/en.json +++ b/ui/src/i18n/locales/en.json @@ -207,6 +207,7 @@ "config.ignore.noneSkills": "No skills ignored yet.", "config.ignore.noneAgents": "No agents ignored yet.", "config.ignore.syntaxNote": "Same syntax as .gitignore.", + "config.ignore.localNote": "{path} also applies on this machine. Its rules run after this file and can override it.", "config.revert.confirmText": "Revert", "config.revert.message": "Reset editor to the last saved version? This cannot be undone.", "config.revert.title": "Revert Changes", diff --git a/ui/src/i18n/locales/es.json b/ui/src/i18n/locales/es.json index dc81f478b..eb4e40a9e 100644 --- a/ui/src/i18n/locales/es.json +++ b/ui/src/i18n/locales/es.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "Aún no hay skills ignorados.", "config.ignore.noneAgents": "Aún no hay agents ignorados.", "config.ignore.syntaxNote": "Misma sintaxis que .gitignore.", + "config.ignore.localNote": "En este equipo también se aplica {path}. Sus reglas se evalúan después de este archivo y pueden anularlo.", "config.revert.confirmText": "Revertir", "config.revert.message": "¿Restablecer el editor a la última versión guardada? Esta acción no se puede deshacer.", "config.revert.title": "Revertir cambios", diff --git a/ui/src/i18n/locales/fa.json b/ui/src/i18n/locales/fa.json index 000ed8056..82a7fd3d0 100644 --- a/ui/src/i18n/locales/fa.json +++ b/ui/src/i18n/locales/fa.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "هنوز اسکیلی نادیده گرفته نشده است.", "config.ignore.noneAgents": "هنوز ایجنتی نادیده گرفته نشده است.", "config.ignore.syntaxNote": "همان نحو .gitignore.", + "config.ignore.localNote": "در این دستگاه {path} هم اعمال می‌شود. قوانین آن بعد از این فایل اجرا می‌شوند و ممکن است آن را نادیده بگیرند.", "config.revert.confirmText": "بازگشت", "config.revert.message": "ویرایشگر را به آخرین نسخه ذخیره‌شده بازنشانی کنید؟ این عمل قابل بازگشت نیست.", "config.revert.title": "بازگشت تغییرات", diff --git a/ui/src/i18n/locales/fr.json b/ui/src/i18n/locales/fr.json index 27696973f..3075dc5c9 100644 --- a/ui/src/i18n/locales/fr.json +++ b/ui/src/i18n/locales/fr.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "Aucun skill ignoré pour l’instant.", "config.ignore.noneAgents": "Aucun agent ignoré pour l’instant.", "config.ignore.syntaxNote": "Même syntaxe que .gitignore.", + "config.ignore.localNote": "Sur cette machine, {path} s’applique aussi. Ses règles passent après ce fichier et peuvent le remplacer.", "config.revert.confirmText": "Rétablir", "config.revert.message": "Réinitialiser l'éditeur à la dernière version enregistrée ? Cette action est irréversible.", "config.revert.title": "Annuler les modifications", diff --git a/ui/src/i18n/locales/id.json b/ui/src/i18n/locales/id.json index 84fc1b374..bb644e4a2 100644 --- a/ui/src/i18n/locales/id.json +++ b/ui/src/i18n/locales/id.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "Belum ada skill yang diabaikan.", "config.ignore.noneAgents": "Belum ada agent yang diabaikan.", "config.ignore.syntaxNote": "Sintaksnya sama dengan .gitignore.", + "config.ignore.localNote": "Di mesin ini, {path} juga berlaku. Aturannya dijalankan setelah file ini dan bisa menimpanya.", "config.revert.confirmText": "Kembalikan", "config.revert.message": "Reset editor ke versi yang terakhir disimpan? Tindakan ini tidak dapat dibatalkan.", "config.revert.title": "Kembalikan Perubahan", diff --git a/ui/src/i18n/locales/ja.json b/ui/src/i18n/locales/ja.json index eb46f1d61..c1c95dc68 100644 --- a/ui/src/i18n/locales/ja.json +++ b/ui/src/i18n/locales/ja.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "除外中のスキルはまだありません。", "config.ignore.noneAgents": "除外中のエージェントはまだありません。", "config.ignore.syntaxNote": ".gitignore と同じ書式です。", + "config.ignore.localNote": "このマシンでは {path} も適用されます。そのルールはこのファイルの後に評価され、ここでの設定を上書きすることがあります。", "config.revert.confirmText": "元に戻す", "config.revert.message": "エディターを最後に保存したバージョンにリセットしますか?この操作は元に戻せません。", "config.revert.title": "変更を元に戻す", diff --git a/ui/src/i18n/locales/ko.json b/ui/src/i18n/locales/ko.json index 187a7d8a3..1e4f79f1e 100644 --- a/ui/src/i18n/locales/ko.json +++ b/ui/src/i18n/locales/ko.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "아직 무시된 스킬이 없습니다.", "config.ignore.noneAgents": "아직 무시된 에이전트가 없습니다.", "config.ignore.syntaxNote": ".gitignore와 문법이 같습니다.", + "config.ignore.localNote": "이 기기에서는 {path}도 적용됩니다. 이 파일 다음에 적용되므로 여기 설정을 덮어쓸 수 있습니다.", "config.revert.confirmText": "되돌리기", "config.revert.message": "편집기를 마지막 저장 버전으로 되돌리시겠습니까? 이 작업은 취소할 수 없습니다.", "config.revert.title": "변경사항 되돌리기", diff --git a/ui/src/i18n/locales/pt-BR.json b/ui/src/i18n/locales/pt-BR.json index bcf675031..075bb1c6e 100644 --- a/ui/src/i18n/locales/pt-BR.json +++ b/ui/src/i18n/locales/pt-BR.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "Nenhum skill ignorado ainda.", "config.ignore.noneAgents": "Nenhum agent ignorado ainda.", "config.ignore.syntaxNote": "Mesma sintaxe do .gitignore.", + "config.ignore.localNote": "Nesta máquina, {path} também é aplicado. As regras dele vêm depois deste arquivo e podem substituí-lo.", "config.revert.confirmText": "Reverter", "config.revert.message": "Redefinir o editor para a última versão salva? Esta ação não pode ser desfeita.", "config.revert.title": "Reverter Alterações", diff --git a/ui/src/i18n/locales/zh-CN.json b/ui/src/i18n/locales/zh-CN.json index 6427577fb..c3acb5935 100644 --- a/ui/src/i18n/locales/zh-CN.json +++ b/ui/src/i18n/locales/zh-CN.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "目前没有忽略任何 skill。", "config.ignore.noneAgents": "目前没有忽略任何 agent。", "config.ignore.syntaxNote": "语法与 .gitignore 相同。", + "config.ignore.localNote": "这台机器上还会应用 {path}。它的规则在此文件之后执行,可能会覆盖这里的设置。", "config.revert.confirmText": "恢复", "config.revert.message": "将编辑器重置为上次保存的版本?此操作无法撤销。", "config.revert.title": "恢复更改", diff --git a/ui/src/i18n/locales/zh-TW.json b/ui/src/i18n/locales/zh-TW.json index 407fae128..c9499c385 100644 --- a/ui/src/i18n/locales/zh-TW.json +++ b/ui/src/i18n/locales/zh-TW.json @@ -226,6 +226,7 @@ "config.ignore.noneSkills": "目前沒有忽略任何 skill。", "config.ignore.noneAgents": "目前沒有忽略任何 agent。", "config.ignore.syntaxNote": "語法與 .gitignore 相同。", + "config.ignore.localNote": "這台機器上也會套用 {path}。它的規則在這個檔案之後執行,可能會覆蓋這裡的設定。", "config.revert.confirmText": "還原", "config.revert.message": "重設編輯器至最後儲存的版本?此動作無法復原。", "config.revert.title": "還原變更", diff --git a/ui/src/pages/ConfigPage.tsx b/ui/src/pages/ConfigPage.tsx index c8d8e5a58..d18132c00 100644 --- a/ui/src/pages/ConfigPage.tsx +++ b/ui/src/pages/ConfigPage.tsx @@ -299,9 +299,21 @@ export default function ConfigPage() { ); } + // The .local file is not editable here, but its rules can override this one. + const localIgnore = tab === 'skillignore' ? ignoreData?.local : tab === 'agentignore' ? agentIgnoreData?.local : undefined; + // Rendered inline or inside the expanded dialog, never both: CodeMirror owns editorRef. const editorBlock = (
+ {localIgnore && ( +
+ +
+ {t('config.ignore.localNote', { path: shortenHome(localIgnore.path) })} +
{localIgnore.raw.trimEnd()}
+
+
+ )}
{ vi.mocked(api.listTargets).mockResolvedValue({ targets: [], sourceSkillCount: 0 }); vi.mocked(api.listTrash).mockResolvedValue({ items: [] } as unknown as Awaited>); vi.mocked(api.getSyncMatrix).mockResolvedValue({ entries: [] } as unknown as Awaited>); - vi.mocked(api.batchToggleResources).mockResolvedValue({ summary: { updated: 1, unchanged: 0, failed: 0 } } as Awaited>); + vi.mocked(api.batchToggleResources).mockResolvedValue({ results: [], summary: { updated: 1, unchanged: 0, failed: 0 } } as Awaited>); vi.mocked(api.batchSetTargets).mockResolvedValue({ updated: 2, skipped: 0, errors: [] }); vi.mocked(api.availableTargets).mockResolvedValue({ targets: [{ name: 'claude', installed: true }] } as Awaited>); }); diff --git a/ui/src/pages/ResourcesPage.tsx b/ui/src/pages/ResourcesPage.tsx index a3639ac78..862499dee 100644 --- a/ui/src/pages/ResourcesPage.tsx +++ b/ui/src/pages/ResourcesPage.tsx @@ -366,8 +366,11 @@ export default function ResourcesPage({ kind }: { kind: Kind }) { }, onSuccess: (res, { enable }) => { const { updated, unchanged, failed } = res.summary; - if (failed > 0 && updated > 0) toast(t('resources.batchToggle.toast.partial', { updated, failed }), 'warning'); - else if (failed > 0) toast(t(failed === 1 ? 'resources.batchToggle.toast.failed.one' : 'resources.batchToggle.toast.failed.other', { count: failed }), 'error'); + // Name the first failure: the count alone hides why an item stayed as it was. + const firstError = res.results.find((r) => r.error); + const reason = firstError ? ` — ${firstError.name}: ${firstError.error}` : ''; + if (failed > 0 && updated > 0) toast(t('resources.batchToggle.toast.partial', { updated, failed }) + reason, 'warning'); + else if (failed > 0) toast(t(failed === 1 ? 'resources.batchToggle.toast.failed.one' : 'resources.batchToggle.toast.failed.other', { count: failed }) + reason, 'error'); else if (updated === 0 && unchanged > 0) toast(t('resources.batchToggle.toast.noChange'), 'info', { key: TOGGLE_TOAST }); else toast(t(`resources.batchToggle.toast.${enable ? 'enabled' : 'disabled'}.${updated === 1 ? 'one' : 'other'}`, { count: updated }), 'success', { key: TOGGLE_TOAST }); setSelected(new Set()); diff --git a/website/docs/reference/commands/ui.md b/website/docs/reference/commands/ui.md index 21677e414..83a4f1afc 100644 --- a/website/docs/reference/commands/ui.md +++ b/website/docs/reference/commands/ui.md @@ -90,14 +90,14 @@ Some pages show a count in the sidebar when they need attention. The counts refr | **Sync** | Preview every change per target before writing. Choose which parts to include (Skills, Agents, Extras, MCP). Files edited inside a target are kept unless **Force** is on. Items that exist only in a target can be collected back to source from here. Each sync backs up target folders first. When a target fails, the others still sync: the page lists each failed target with its part (Skills, Agents, Extras or Config), a plain-language explanation when the cause is a common one (a symlink that points elsewhere, permission denied, a read-only file system, a missing file or folder, invalid target settings) and the error, above the other warnings, offers **Turn on Force** for a skills symlink that points elsewhere, and marks the target in the change list. Even when every target fails, the page lists them the same way. The **Last sync** card names the targets that failed in the latest sync | | **Git Sync** | Commit and push the source repo, push commits that aren't on the remote yet, and pull. Opening the page fetches from the remote, so **Pull** shows how many commits the remote has. When both computers have new commits, **Pull and merge** preserves both histories before you push. With uncommitted changes and remote updates, **Commit and pull** saves your changes first. Pull syncs what the repo scope holds (`skills`, `agents`, `extras`, or `root`), like [`pull`](/docs/reference/commands/pull). **Sync both ways** commits local changes, pulls and merges, syncs targets, then pushes, like [`push --pull`](/docs/reference/commands/push#push-and-pull-together); a conflict stops it before pushing. Conflicting files open a version comparison; choose the local or remote version of each whole file, then **Apply choices and pull**. Cancel leaves your files unchanged. When a first pull can't merge with the remote, it offers a force pull that replaces local files with the remote branch | | **Hubs** | Reached from the Skills page. Lists the built-in hub, saved hubs, and your own Hubs (**Mine**); pick one to filter its skills and install them. **Add or create a Hub** adds an existing hub, creates a new Hub, or imports a `skillshare-hub.json`. Your own Hubs are changed with **Edit**; **Share** downloads the index and builds the `hub add` command. See [`hub`](/docs/reference/commands/hub) | -| **Skills** / **Agents** | Installed items, the **Updates** tab, and the **Trash** tab. Skills also have an **Analyze** tab that estimates how many tokens each skill adds to a target's context. **Install** searches GitHub or installs from a URL or path. **+ New Skill** opens the creation wizard. The list and card views can filter by **Folder** (a tracked repo, a folder such as `frontend/react`, or **Root**) and group by **Folder**, with the root first and folders A→Z. The **tree** view shows the source folders on the left and details on the right: click a folder or skill to select it, Cmd/Ctrl-click to add to the selection, Shift-click for a range, and double-click a skill to open it. The right side turns everything selected on or off with one switch, sets its targets (tracked repos and their subfolders included), and lists each skill with its own switch; a tracked repo also offers **Update repo** and **Uninstall repo**. A skill with `disable-model-invocation: true` carries a **manual only** tag in the list, on its tile and on its detail page, the same state [`list`](/docs/reference/commands/list) toggles with `m`. In the skill editor, **Add field** describes what each frontmatter field does. **Sync skills** / **Sync agents** previews, then syncs only that kind to every target; the same dialog opens from **Sync Now** after an update, an uninstall or a collect | +| **Skills** / **Agents** | Installed items, the **Updates** tab, and the **Trash** tab. Skills also have an **Analyze** tab that estimates how many tokens each skill adds to a target's context. **Install** searches GitHub or installs from a URL or path. **+ New Skill** opens the creation wizard. The list and card views can filter by **Folder** (a tracked repo, a folder such as `frontend/react`, or **Root**) and group by **Folder**, with the root first and folders A→Z. The **tree** view shows the source folders on the left and details on the right: click a folder or skill to select it, Cmd/Ctrl-click to add to the selection, Shift-click for a range, and double-click a skill to open it. The right side turns everything selected on or off with one switch (an item that a `!` rule in `.skillignore.local` keeps on is reported as failed, with the reason), sets its targets (tracked repos and their subfolders included), and lists each skill with its own switch; a tracked repo also offers **Update repo** and **Uninstall repo**. A skill with `disable-model-invocation: true` carries a **manual only** tag in the list, on its tile and on its detail page, the same state [`list`](/docs/reference/commands/list) toggles with `m`. In the skill editor, **Add field** describes what each frontmatter field does. **Sync skills** / **Sync agents** previews, then syncs only that kind to every target; the same dialog opens from **Sync Now** after an update, an uninstall or a collect | | **Extras** | **Folders & files**: rules, commands, and other files synced alongside skills. **AGENTS.md**: in global mode, shared `AGENTS.md` files and which targets use them; in a project, the project's `./AGENTS.md` and whether each target reads it. See [Share one AGENTS.md across your tools](../../how-to/daily-tasks/sharing-instructions.md). **Memory**: browse, search, preview, edit, and delete shared Markdown notes; add INDEX links, preserve drafts on conflicts, open Backup Files history, and connect agents through reviewed instruction-file changes. Configured status does not prove a read. See the [Memory walkthrough](../../how-to/daily-tasks/sharing-memory.md) | | **MCP** | One row per server, with the Agents it syncs to as chips; the count button on the row opens their toggles. **Add server** takes a URL, a command, a pasted snippet or a file; **Import from a target** reads what an installed Agent already has. Each server's menu has **View what each Agent gets**, which lists the source and every Agent's file and shows the one you pick, including unsaved edits. Conflicts offer **Import from** the Agent or **Replace with source**. The server dialog's **Tools** section sets the [tool policy](./mcp.md#tool-policy): **Load tools**, which starts the server once with the dialog's settings, saved or not, and lists its tools to tick; an **Exclude rules** row for `*` patterns; it lists each selected Agent that does not apply part of the policy, and the row shows a tag when a policy is set. For a Pi server, the dialog also has [Pi's built-in MCP](./mcp.md#pi) settings: tool exposure and other Pi settings, which take [`piOptions`](./mcp.md#pi-options) as JSON, with their help in info tooltips. **Defaults** edits `mcp.targets`. **Sync MCP**, in the Sync box, lists the pending changes and writes only the MCP config files, keeping a backup of each; below it, [**Check**](./mcp.md#check-servers-before-an-agent-starts-them) checks the servers and **Backups and restore** previews and restores those backups. | | **Plugins** | One row per plugin, with its Agents as toggles. Expanding a row also lists the other Agents the source supports; ticking one previews an install. The row menu syncs, updates, removes, or opens **View files**, a read-only browser of the local copy Skillshare reviewed. **Share** copies one command that adds the ticked plugins from their HTTPS sources. See [Manage plugins across tools](/docs/how-to/daily-tasks/sharing-plugins) | | **Targets** | Target list with status. **Add target** also takes **Another account**: a second config folder of an Agent you already use, with a preview of where it writes. Each target's page edits include/exclude filters and collects local-only skills back to source. The list also counts the MCP servers each Agent gets. A target that has an MCP config file gets an **MCP** tab with one row per server; a click saves at once, and **Sync all targets** writes the MCP files of every target. Each target also has a tab named after its instruction file (**CLAUDE.md**, **GEMINI.md**, **AGENTS.md**, ...) that shows the read order, edits the file and converts it to `AGENTS.md` | | **Projects** | Global mode only. Project folders that the global config syncs into, from [`projects`](/docs/reference/targets/configuration#projects) and [`mcp.projects`](./mcp.md#projects-in-the-dashboard). **Add project** takes a folder, its targets and what to sync. Each project has **Skills** and **Agents** tabs with filters, a preview and the folders that get written, and an **MCP** tab that turns global servers off in that folder or gives it servers of its own, with **Check** for those servers. **Sync project** previews, then syncs only that project's skills, agents and MCP. Targets that already point into a project folder can be converted | | **Audit** | Security scan of skills and agents, with findings by severity. The **Rules** tab browses every rule by category: switch one off, change its severity, apply a severity to a whole category, pick the scan profile (`default`, `strict`, `permissive`), or open the editor for custom `audit-rules.yaml` | -| **Settings** | Tabbed: **General** (source paths, sync mode, appearance), **Backup** (target folder snapshots, earlier versions of files such as `AGENTS.md`, and MCP config backups; see [`backup`](./backup.md#dashboard)), **Log** (operation history), **Health** (the same checks as [`doctor`](/docs/reference/commands/doctor)), **Extensions** (sync-time file transforms), **Files** (direct editors for `config.yaml`, `.skillignore`, and `.agentignore`) | +| **Settings** | Tabbed: **General** (source paths, sync mode, appearance), **Backup** (target folder snapshots, earlier versions of files such as `AGENTS.md`, and MCP config backups; see [`backup`](./backup.md#dashboard)), **Log** (operation history), **Health** (the same checks as [`doctor`](/docs/reference/commands/doctor)), **Extensions** (sync-time file transforms), **Files** (direct editors for `config.yaml`, `.skillignore`, and `.agentignore`; when a `.skillignore.local` or `.agentignore.local` exists, the editor shows its rules above the file, since they apply after it and can override it) | **Discard changes** beside the change list restores all tracked files and the index in the selected Git scope to the last commit and deletes untracked files and folders, after confirmation. Ignored files, nested Git repositories, and root-scope `config.yaml` are kept. It does not change commits or push; the action cannot be undone. **Dry run** previews without changing files. A first commit is required. @@ -182,7 +182,7 @@ The web dashboard exposes a REST API at `/api/`. All endpoints return JSON. | GET | `/api/log` | List log entries with optional filters | | GET | `/api/config` | Get config as YAML | | PUT | `/api/config` | Update config YAML | -| GET | `/api/skillignore` | Get `.skillignore` content + ignore stats | +| GET | `/api/skillignore` | Get `.skillignore` content, `.skillignore.local` content when present, and ignore stats | | PUT | `/api/skillignore` | Update `.skillignore` content | | GET | `/api/doctor` | Run all health checks (JSON) | | GET | `/api/health` | Liveness probe; returns `200` once the server is ready | diff --git a/website/docs/reference/filtering.md b/website/docs/reference/filtering.md index 7d4a2447c..495255481 100644 --- a/website/docs/reference/filtering.md +++ b/website/docs/reference/filtering.md @@ -40,7 +40,7 @@ A skill must pass **all** layers to reach a target: **Syntax:** Full [gitignore](https://git-scm.com/docs/gitignore) — `*` (single segment), `**` (any depth), `?`, `[abc]`, `!pattern` (negation), `/pattern` (anchored), `pattern/` (directory-only). -**`.skillignore.local`:** Place alongside `.skillignore`. Patterns are appended after the base file — last matching rule wins. Use `!pattern` to un-ignore. Don't commit this file. +**`.skillignore.local`:** Place alongside `.skillignore`. Patterns are appended after the base file — last matching rule wins. Use `!pattern` to un-ignore. Don't commit this file. A pattern without `/` matches that name at any depth, so `!feature-radar` also re-enables `feature-radar/feature-radar`; write `!/feature-radar` to match only the top-level folder. The dashboard shows this file's rules in **Settings → Files** and reports a toggle that it overrides as failed. **CLI visibility:** From af7654712c466fc369a4ace6531f39a736894153 Mon Sep 17 00:00:00 2001 From: Willie Date: Sun, 4 Oct 2026 19:40:44 +0800 Subject: [PATCH 3/3] fix(server): log a disable that a .local rule overrides When a "!" rule in .skillignore.local overrode a single disable, the handler returned 409 before its only ops log call, although AddPattern had already written the pattern to .skillignore. The shared file changed with no trace in the log. Log the attempt with status "error" and the reason before returning. --- internal/server/handler_toggle.go | 13 ++++++++----- internal/server/handler_toggle_test.go | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/internal/server/handler_toggle.go b/internal/server/handler_toggle.go index dd773f7a9..bc6161b5a 100644 --- a/internal/server/handler_toggle.go +++ b/internal/server/handler_toggle.go @@ -101,16 +101,19 @@ func (s *Server) handleToggleSkill(w http.ResponseWriter, r *http.Request, enabl writeError(w, http.StatusInternalServerError, err.Error()) return } + logArgs := map[string]any{ + "name": name, + "kind": kind, + "scope": "ui", + } if msg := toggleOverrideError(kind, enable, states[relPath]); msg != "" { + // The ignore file may already have changed, so the attempt is still logged. + s.writeOpsLog(action, "error", start, logArgs, msg) writeError(w, http.StatusConflict, msg) return } - s.writeOpsLog(action, "ok", start, map[string]any{ - "name": name, - "kind": kind, - "scope": "ui", - }, "") + s.writeOpsLog(action, "ok", start, logArgs, "") writeJSON(w, map[string]any{"success": true, "name": name, "disabled": disabled}) } diff --git a/internal/server/handler_toggle_test.go b/internal/server/handler_toggle_test.go index e8e70c679..fb9769533 100644 --- a/internal/server/handler_toggle_test.go +++ b/internal/server/handler_toggle_test.go @@ -5,6 +5,8 @@ import ( "net/http/httptest" "strings" "testing" + + "skillshare/internal/oplog" ) func TestHandleDisableSkill_OverriddenByLocalNegation_Conflict(t *testing.T) { @@ -19,3 +21,17 @@ func TestHandleDisableSkill_OverriddenByLocalNegation_Conflict(t *testing.T) { t.Fatalf("expected 409 naming .skillignore.local, got %d: %s", rr.Code, rr.Body.String()) } } + +// The conflict still leaves the pattern in .skillignore, so the change must be logged. +func TestHandleDisableSkill_OverriddenByLocalNegation_LogsError(t *testing.T) { + s, src := newTestServer(t) + seedLocalNegation(t, src) + + rr := httptest.NewRecorder() + s.handler.ServeHTTP(rr, httptest.NewRequest(http.MethodPost, "/api/resources/feature-radar__feature-radar/disable", nil)) + + entries, _ := oplog.Read(s.configPath(), oplog.OpsFile, 10) + if len(entries) != 1 || entries[0].Command != "disable" || entries[0].Status != "error" { + t.Fatalf("expected one disable error entry, got %+v", entries) + } +}