From e48784f16b341d6ab5be50abeef1d2b522a5c49b Mon Sep 17 00:00:00 2001 From: Willie Date: Tue, 29 Sep 2026 11:45:48 +0800 Subject: [PATCH] feat(sync): name targets that sync one folder with different filters When two targets sync skills into the same folder with different include or exclude filters, each sync adds what one wants and prunes what the other filters out, so the folder never settles and sync keeps showing the same changes. The only hint was a vague overlap count. sync, doctor and the dashboard's Sync page now name the targets and the folder, and suggest turning skills off for all but one (universal when it is among them) instead of removing a target. The Sync page offers the existing stop-syncing dialog in place. Targets with identical filters are not reported. --- cmd/skillshare/doctor_shared_paths.go | 24 +++++- cmd/skillshare/doctor_shared_paths_test.go | 25 ++++++ cmd/skillshare/sync_overlap_hint.go | 51 +++++++++++-- cmd/skillshare/sync_overlap_hint_test.go | 43 +++++++++++ internal/config/path_overlap.go | 76 ++++++++++++++++++- internal/config/path_overlap_test.go | 48 ++++++++++++ internal/server/handler_sync.go | 50 +++++++++--- internal/server/handler_sync_test.go | 39 ++++++++++ tests/integration/sync_shared_path_test.go | 31 ++++++++ ui/src/api/client.ts | 13 +++- ui/src/i18n/locales/de.json | 2 + ui/src/i18n/locales/en.json | 2 + ui/src/i18n/locales/es.json | 2 + ui/src/i18n/locales/fa.json | 2 + ui/src/i18n/locales/fr.json | 2 + ui/src/i18n/locales/id.json | 2 + ui/src/i18n/locales/ja.json | 2 + ui/src/i18n/locales/ko.json | 2 + ui/src/i18n/locales/pt-BR.json | 2 + ui/src/i18n/locales/zh-CN.json | 2 + ui/src/i18n/locales/zh-TW.json | 2 + ui/src/pages/SyncPage.test.tsx | 51 +++++++++++++ ui/src/pages/SyncPage.tsx | 34 ++++++++- website/docs/reference/commands/doctor.md | 11 ++- .../current/reference/commands/doctor.md | 11 ++- .../current/reference/commands/doctor.md | 11 ++- .../current/reference/commands/doctor.md | 11 ++- .../current/reference/commands/doctor.md | 11 ++- 28 files changed, 534 insertions(+), 28 deletions(-) create mode 100644 cmd/skillshare/sync_overlap_hint_test.go create mode 100644 ui/src/pages/SyncPage.test.tsx diff --git a/cmd/skillshare/doctor_shared_paths.go b/cmd/skillshare/doctor_shared_paths.go index b7b5445ec..6f7ac5d5a 100644 --- a/cmd/skillshare/doctor_shared_paths.go +++ b/cmd/skillshare/doctor_shared_paths.go @@ -23,6 +23,16 @@ func sharedTargetPathsSuggestion(path string, targets []string, isProject bool) path, targetRemoveDryRunCommand(isProject), strings.Join(targets, ", ")) } +// folderConflictSuggestion says which targets to stop syncing skills for when +// targets share a folder with different settings. +func folderConflictSuggestion(c config.SkillsFolderConflict, isProject bool) string { + cmds := make([]string, 0, len(c.Stop)) + for _, name := range c.Stop { + cmds = append(cmds, "`"+skillsOffCommand(name, isProject)+"`") + } + return fmt.Sprintf("Keep %s syncing skills to %s and stop the rest with %s.", c.Keep, c.Path, strings.Join(cmds, ", ")) +} + func crossTargetDiscoverySuggestion(scanner string, writers []string, isProject bool) string { // Point at the scanner first: removing it only affects that runtime, while // removing a writer also hides skills from every other tool reading its path. @@ -71,12 +81,22 @@ func checkSharedTargetPaths(cfg *config.Config, result *doctorResult, isProject return collisions[i].path < collisions[j].path }) + conflicts := make(map[string]config.SkillsFolderConflict) + for _, c := range config.SkillsFolderConflicts(cfg.Targets) { + conflicts[c.Path] = c + } + details := make([]string, 0, len(collisions)) suggestions := make([]string, 0, len(collisions)) for _, c := range collisions { - ui.Warning("Shared path %s ← %s", c.path, strings.Join(c.targets, ", ")) - details = append(details, fmt.Sprintf("%s ← %s", c.path, strings.Join(c.targets, ", "))) + detail := fmt.Sprintf("%s ← %s", c.path, strings.Join(c.targets, ", ")) suggestion := sharedTargetPathsSuggestion(c.path, c.targets, isProject) + if conflict, ok := conflicts[c.path]; ok { + detail += " (different filters, so they undo each other on every sync)" + suggestion = folderConflictSuggestion(conflict, isProject) + } + ui.Warning("Shared path %s", detail) + details = append(details, detail) fmt.Println(ui.DimText(" suggestion: " + suggestion)) suggestions = append(suggestions, suggestion) result.addWarning() diff --git a/cmd/skillshare/doctor_shared_paths_test.go b/cmd/skillshare/doctor_shared_paths_test.go index 8721af57b..742682f92 100644 --- a/cmd/skillshare/doctor_shared_paths_test.go +++ b/cmd/skillshare/doctor_shared_paths_test.go @@ -271,3 +271,28 @@ func TestDoctorPathChecks_IgnoreSkillsOffTargets(t *testing.T) { t.Errorf("targets with skills off should not overlap, got %d warning(s): %+v", r.warnings, r.checks) } } + +func TestCheckSharedTargetPaths_DifferentFiltersSuggestsSkillsOff(t *testing.T) { + cfg := &config.Config{ + Targets: map[string]config.TargetConfig{ + "universal": {Skills: &config.ResourceTargetConfig{Path: "/tmp/.agents/skills", Exclude: []string{"feature-radar*"}}}, + "codex": {Skills: &config.ResourceTargetConfig{Path: "/tmp/.agents/skills"}}, + }, + } + r := &doctorResult{} + checkSharedTargetPaths(cfg, r, true) + + if len(r.checks) != 1 || r.checks[0].Status != checkWarning { + t.Fatalf("expected single warning check, got %+v", r.checks) + } + if detail := r.checks[0].Details[0]; !strings.Contains(detail, "undo each other") { + t.Errorf("detail %q should say the targets undo each other", detail) + } + suggestion := r.checks[0].Suggestions[0] + if !strings.Contains(suggestion, "skillshare target codex --skills=false -p") { + t.Errorf("suggestion %q should turn skills off for codex", suggestion) + } + if strings.Contains(suggestion, "target remove") { + t.Errorf("suggestion %q should not suggest removing a target", suggestion) + } +} diff --git a/cmd/skillshare/sync_overlap_hint.go b/cmd/skillshare/sync_overlap_hint.go index a5fb8f10d..c75a26771 100644 --- a/cmd/skillshare/sync_overlap_hint.go +++ b/cmd/skillshare/sync_overlap_hint.go @@ -1,20 +1,57 @@ package main import ( + "fmt" + "strings" + "skillshare/internal/config" "skillshare/internal/ui" ) -// printSyncOverlapHint emits a single-line warning when enabled targets have -// overlapping skill paths (same primary path or cross-runtime discovery via -// also_scans). Quiet by design — points users at `doctor` for details. +// printSyncOverlapHint warns when enabled targets have overlapping skill paths +// (same primary path or cross-runtime discovery via also_scans). Targets that +// share a folder with different settings undo each other's sync, so they get +// a specific line and the command to keep one; any other overlap keeps the +// brief line pointing at `doctor`. func printSyncOverlapHint(targets map[string]config.TargetConfig, isProject, jsonOutput bool) { if jsonOutput { return } - involved := config.DetectPathOverlap(targets, isProject) - if len(involved) == 0 { - return + explained := map[string]bool{} + for _, c := range config.SkillsFolderConflicts(targets) { + ui.Warning("%s sync skills to %s with different filters, so each sync undoes the other", + joinAnd(c.Targets), shortenPath(c.Path)) + for _, name := range c.Stop { + fmt.Println(ui.DimText(" keep one: " + skillsOffCommand(name, isProject))) + } + for _, name := range c.Targets { + explained[name] = true + } + } + rest := 0 + for _, name := range config.DetectPathOverlap(targets, isProject) { + if !explained[name] { + rest++ + } + } + if rest > 0 { + ui.Warning("Skill path overlap across %d target(s) — run `skillshare doctor` for details", rest) } - ui.Warning("Skill path overlap across %d target(s) — run `skillshare doctor` for details", len(involved)) +} + +// skillsOffCommand is the command that stops syncing skills to target name. +func skillsOffCommand(name string, isProject bool) string { + cmd := "skillshare target " + name + " --skills=false" + if isProject { + cmd += " -p" + } + return cmd +} + +// joinAnd joins names as "a and b" or "a, b and c". +func joinAnd(names []string) string { + if len(names) < 2 { + return strings.Join(names, "") + } + return strings.Join(names[:len(names)-1], ", ") + " and " + names[len(names)-1] } diff --git a/cmd/skillshare/sync_overlap_hint_test.go b/cmd/skillshare/sync_overlap_hint_test.go new file mode 100644 index 000000000..1133f1267 --- /dev/null +++ b/cmd/skillshare/sync_overlap_hint_test.go @@ -0,0 +1,43 @@ +package main + +import ( + "strings" + "testing" + + "skillshare/internal/config" +) + +func TestPrintSyncOverlapHint_NamesConflictAndFix(t *testing.T) { + targets := map[string]config.TargetConfig{ + "universal": {Skills: &config.ResourceTargetConfig{Path: "/tmp/agents/skills", Exclude: []string{"feature-radar*"}}}, + "codex": {Skills: &config.ResourceTargetConfig{Path: "/tmp/agents/skills"}}, + } + out := captureStdout(t, func() { printSyncOverlapHint(targets, true, false) }) + + for _, want := range []string{ + "codex and universal sync skills to /tmp/agents/skills with different filters, so each sync undoes the other", + "keep one: skillshare target codex --skills=false -p", + } { + if !strings.Contains(out, want) { + t.Errorf("output missing %q:\n%s", want, out) + } + } + if strings.Contains(out, "Skill path overlap") { + t.Errorf("conflict fully explains the overlap, generic line should be gone:\n%s", out) + } +} + +func TestPrintSyncOverlapHint_SameSettingsKeepsGenericLine(t *testing.T) { + targets := map[string]config.TargetConfig{ + "universal": {Skills: &config.ResourceTargetConfig{Path: "/tmp/agents/skills"}}, + "codex": {Skills: &config.ResourceTargetConfig{Path: "/tmp/agents/skills"}}, + } + out := captureStdout(t, func() { printSyncOverlapHint(targets, false, false) }) + + if !strings.Contains(out, "Skill path overlap across 2 target(s)") { + t.Errorf("expected generic overlap line:\n%s", out) + } + if strings.Contains(out, "undoes") { + t.Errorf("same settings is not a conflict:\n%s", out) + } +} diff --git a/internal/config/path_overlap.go b/internal/config/path_overlap.go index a0aed47a4..cda1d2ce4 100644 --- a/internal/config/path_overlap.go +++ b/internal/config/path_overlap.go @@ -1,6 +1,10 @@ package config -import "path/filepath" +import ( + "path/filepath" + "slices" + "sort" +) // DetectPathOverlap returns the set of target names whose configured skill // paths overlap with another enabled target — either by sharing the same @@ -91,3 +95,73 @@ func SkillsPathKeptBy(targets map[string]TargetConfig, name string, leaving map[ } return "" } + +// SkillsFolderConflict is a skills folder that two or more targets with skills +// on sync into with different include or exclude filters, so each sync +// undoes the others' links. Keep is the target to leave on; Stop the rest. +type SkillsFolderConflict struct { + Path string `json:"path"` + Targets []string `json:"targets"` + Keep string `json:"keep"` + Stop []string `json:"stop"` +} + +// SkillsFolderConflicts returns the shared skills folders whose targets' +// filters differ, sorted by path. Targets with identical settings agree on +// the folder's contents and are not a conflict. universal is kept when it is +// in the group, otherwise the alphabetically first target. +func SkillsFolderConflicts(targets map[string]TargetConfig) []SkillsFolderConflict { + byFolder := make(map[string][]string) + for name, tc := range targets { + if !tc.SkillsConfig().IsEnabled() { + continue + } + if folder := skillsFolder(tc); folder != "" { + byFolder[folder] = append(byFolder[folder], name) + } + } + + var out []SkillsFolderConflict + for folder, names := range byFolder { + if len(names) < 2 { + continue + } + sort.Strings(names) + first := targets[names[0]] + differ := false + for _, n := range names[1:] { + other := targets[n] + if !sameSkillsSettings(first.SkillsConfig(), other.SkillsConfig()) { + differ = true + break + } + } + if !differ { + continue + } + keep := names[0] + if slices.Contains(names, "universal") { + keep = "universal" + } + var stop []string + for _, n := range names { + if n != keep { + stop = append(stop, n) + } + } + out = append(out, SkillsFolderConflict{Path: folder, Targets: names, Keep: keep, Stop: stop}) + } + sort.Slice(out, func(i, j int) bool { return out[i].Path < out[j].Path }) + return out +} + +func sameSkillsSettings(a, b ResourceTargetConfig) bool { + return sameSet(a.Include, b.Include) && sameSet(a.Exclude, b.Exclude) +} + +func sameSet(a, b []string) bool { + a, b = slices.Clone(a), slices.Clone(b) + slices.Sort(a) + slices.Sort(b) + return slices.Equal(a, b) +} diff --git a/internal/config/path_overlap_test.go b/internal/config/path_overlap_test.go index 3bbd7e7dd..cddc35229 100644 --- a/internal/config/path_overlap_test.go +++ b/internal/config/path_overlap_test.go @@ -60,3 +60,51 @@ func TestDetectPathOverlap_IgnoresScannerOwnPath(t *testing.T) { t.Errorf("expected no overlap, got %v", involved) } } + +func TestSkillsFolderConflicts_DifferentFilters(t *testing.T) { + got := SkillsFolderConflicts(map[string]TargetConfig{ + "universal": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills", Exclude: []string{"feature-radar*"}}}, + "codex": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills/"}}, + "claude": {Skills: &ResourceTargetConfig{Path: "/tmp/claude/skills"}}, + }) + want := []SkillsFolderConflict{{Path: "/tmp/agents/skills", Targets: []string{"codex", "universal"}, Keep: "universal", Stop: []string{"codex"}}} + if !slices.EqualFunc(got, want, conflictEqual) { + t.Errorf("SkillsFolderConflicts = %+v, want %+v", got, want) + } +} + +func TestSkillsFolderConflicts_SameSettingsNoConflict(t *testing.T) { + got := SkillsFolderConflicts(map[string]TargetConfig{ + "universal": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills", Include: []string{"a", "b"}}}, + "codex": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills", Include: []string{"b", "a"}}}, + }) + if len(got) != 0 { + t.Errorf("expected no conflict, got %+v", got) + } +} + +func TestSkillsFolderConflicts_DifferentFiltersKeepsFirstName(t *testing.T) { + got := SkillsFolderConflicts(map[string]TargetConfig{ + "warp": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills", Include: []string{"x*"}}}, + "amp": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills"}}, + "witsy": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills"}}, + }) + want := []SkillsFolderConflict{{Path: "/tmp/agents/skills", Targets: []string{"amp", "warp", "witsy"}, Keep: "amp", Stop: []string{"warp", "witsy"}}} + if !slices.EqualFunc(got, want, conflictEqual) { + t.Errorf("SkillsFolderConflicts = %+v, want %+v", got, want) + } +} + +func TestSkillsFolderConflicts_IgnoresSkillsOff(t *testing.T) { + got := SkillsFolderConflicts(map[string]TargetConfig{ + "universal": {Skills: &ResourceTargetConfig{Path: "/tmp/agents/skills", Exclude: []string{"x"}}}, + "codex": disabledAt("/tmp/agents/skills"), + }) + if len(got) != 0 { + t.Errorf("expected no conflict with skills off, got %+v", got) + } +} + +func conflictEqual(a, b SkillsFolderConflict) bool { + return a.Path == b.Path && a.Keep == b.Keep && slices.Equal(a.Targets, b.Targets) && slices.Equal(a.Stop, b.Stop) +} diff --git a/internal/server/handler_sync.go b/internal/server/handler_sync.go index 1fe242704..8d43879c2 100644 --- a/internal/server/handler_sync.go +++ b/internal/server/handler_sync.go @@ -84,8 +84,9 @@ func (s *Server) handleSync(w http.ResponseWriter, r *http.Request) { } resp := map[string]any{ - "results": out.results, - "warnings": out.warnings, + "results": out.results, + "warnings": out.warnings, + "folder_conflicts": out.folderConflicts, } if len(out.skills) > 0 { if contextCost := s.computeContextCost(out.skills); contextCost != nil { @@ -98,10 +99,37 @@ func (s *Server) handleSync(w http.ResponseWriter, r *http.Request) { } type syncOutcome struct { - results []syncTargetResult - warnings []string - skills []ssync.DiscoveredSkill - ignoreStats *skillignore.IgnoreStats + results []syncTargetResult + warnings []string + folderConflicts []config.SkillsFolderConflict + skills []ssync.DiscoveredSkill + ignoreStats *skillignore.IgnoreStats +} + +// folderConflicts returns the skills folders whose targets undo each other's +// sync, never nil, plus a warning for the path overlap they don't explain +// ("" when there is none). +func folderConflicts(targets map[string]config.TargetConfig, isProject bool) ([]config.SkillsFolderConflict, string) { + conflicts := config.SkillsFolderConflicts(targets) + explained := map[string]bool{} + for _, c := range conflicts { + for _, name := range c.Targets { + explained[name] = true + } + } + rest := 0 + for _, name := range config.DetectPathOverlap(targets, isProject) { + if !explained[name] { + rest++ + } + } + if conflicts == nil { + conflicts = []config.SkillsFolderConflict{} + } + if rest == 0 { + return conflicts, "" + } + return conflicts, fmt.Sprintf("Skill path overlap across %d target(s) — see Health Check for details", rest) } // projectTargets returns the targets of the project declared under root. @@ -137,8 +165,9 @@ func (s *Server) syncResources(start time.Time, dryRun, force bool, kind, projec return nil, http.StatusBadRequest, validErr } - if involved := config.DetectPathOverlap(s.cfg.Targets, s.IsProjectMode()); len(involved) > 0 { - warnings = append(warnings, fmt.Sprintf("Skill path overlap across %d target(s) — see Health Check for details", len(involved))) + conflicts, overlap := folderConflicts(s.cfg.Targets, s.IsProjectMode()) + if overlap != "" { + warnings = append(warnings, overlap) } if !dryRun { @@ -357,7 +386,7 @@ func (s *Server) syncResources(start time.Time, dryRun, force bool, kind, projec } s.writeOpsLog("sync", "ok", start, logArgs, "") - return &syncOutcome{results: results, warnings: warnings, skills: allSkills, ignoreStats: ignoreStats}, 0, nil + return &syncOutcome{results: results, warnings: warnings, folderConflicts: conflicts, skills: allSkills, ignoreStats: ignoreStats}, 0, nil } // backupBeforeSync snapshots the target folders a sync may overwrite, as the @@ -539,6 +568,7 @@ func (s *Server) handleDiff(w http.ResponseWriter, r *http.Request) { globalMode := s.cfg.Mode ignorePatterns := ssync.EffectiveFileIgnorePatterns(s.cfg.Ignore) targets := s.cloneTargets() + conflicts, _ := folderConflicts(targets, s.IsProjectMode()) s.mu.RUnlock() if globalMode == "" { @@ -563,7 +593,7 @@ func (s *Server) handleDiff(w http.ResponseWriter, r *http.Request) { diffs = s.appendAgentDiffs(diffs, targets, agentsSource, filterTarget) - resp := map[string]any{"diffs": diffs} + resp := map[string]any{"diffs": diffs, "folder_conflicts": conflicts} maps.Copy(resp, ignorePayload(ignoreStats)) maps.Copy(resp, agentIgnorePayload(agentsSource, nil)) writeJSON(w, resp) diff --git a/internal/server/handler_sync_test.go b/internal/server/handler_sync_test.go index 2a3891a99..932b4ac0a 100644 --- a/internal/server/handler_sync_test.go +++ b/internal/server/handler_sync_test.go @@ -328,3 +328,42 @@ func TestHandleSync_UnknownProjectIsRejected(t *testing.T) { t.Fatalf("expected 400, got %d: %s", rr.Code, rr.Body.String()) } } + +func TestHandleSync_ReportsFolderConflicts(t *testing.T) { + shared := filepath.Join(t.TempDir(), "agents-skills") + s, src := newTestServerWithTargets(t, map[string]string{"universal": shared, "codex": shared}) + addSkill(t, src, "alpha") + s.cfg.Targets["universal"] = config.TargetConfig{Skills: &config.ResourceTargetConfig{Path: shared, Exclude: []string{"feature-radar*"}}} + if err := s.cfg.Save(); err != nil { + t.Fatalf("failed to save config: %v", err) + } + + for _, tc := range []struct{ method, url, body string }{ + {http.MethodPost, "/api/sync", `{"dryRun":true}`}, + {http.MethodGet, "/api/diff", ""}, + } { + req := httptest.NewRequest(tc.method, tc.url, strings.NewReader(tc.body)) + rr := httptest.NewRecorder() + s.handler.ServeHTTP(rr, req) + if rr.Code != http.StatusOK { + t.Fatalf("%s: expected 200, got %d: %s", tc.url, rr.Code, rr.Body.String()) + } + var resp struct { + Warnings []string `json:"warnings"` + FolderConflicts []config.SkillsFolderConflict `json:"folder_conflicts"` + } + json.Unmarshal(rr.Body.Bytes(), &resp) + if len(resp.FolderConflicts) != 1 { + t.Fatalf("%s: expected 1 folder conflict, got %+v", tc.url, resp.FolderConflicts) + } + c := resp.FolderConflicts[0] + if c.Keep != "universal" || len(c.Stop) != 1 || c.Stop[0] != "codex" { + t.Errorf("%s: conflict = %+v, want keep universal, stop codex", tc.url, c) + } + for _, w := range resp.Warnings { + if strings.Contains(w, "Skill path overlap") { + t.Errorf("%s: overlap fully explained by the conflict, got warning %q", tc.url, w) + } + } + } +} diff --git a/tests/integration/sync_shared_path_test.go b/tests/integration/sync_shared_path_test.go index c1f50e2fc..9ee928750 100644 --- a/tests/integration/sync_shared_path_test.go +++ b/tests/integration/sync_shared_path_test.go @@ -278,3 +278,34 @@ targets: } } } + +// TestSync_SharedPath_DifferentFiltersWarns covers two targets sharing a +// skills folder with different filters: each sync undoes the other, so sync +// names them and says how to keep one. +func TestSync_SharedPath_DifferentFiltersWarns(t *testing.T) { + sb := testutil.NewSandbox(t) + defer sb.Cleanup() + + sb.CreateSkill("feature-radar", map[string]string{"SKILL.md": "---\nname: feature-radar\n---\n# x"}) + sharedDir := filepath.Join(sb.Home, ".agents", "skills") + if err := os.MkdirAll(sharedDir, 0755); err != nil { + t.Fatalf("create shared dir: %v", err) + } + sb.WriteConfig(`source: ` + sb.SourcePath + ` +mode: merge +targets: + universal: + skills: + path: ~/.agents/skills + exclude: [feature-radar*] + codex: + skills: + path: ~/.agents/skills +`) + + result := sb.RunCLI("sync") + result.AssertSuccess(t) + result.AssertOutputContains(t, "codex and universal sync skills to ~/.agents/skills with different filters, so each sync undoes the other") + result.AssertOutputContains(t, "keep one: skillshare target codex --skills=false") + result.AssertOutputNotContains(t, "Skill path overlap") +} diff --git a/ui/src/api/client.ts b/ui/src/api/client.ts index 6f9135737..4dd65c252 100644 --- a/ui/src/api/client.ts +++ b/ui/src/api/client.ts @@ -467,7 +467,7 @@ export const api = { body: JSON.stringify(opts), }), diff: (target?: string) => - apiFetch<{ diffs: DiffTarget[] } & IgnoreSources>(`/diff${target ? '?target=' + encodeURIComponent(target) : ''}`), + apiFetch<{ diffs: DiffTarget[]; folder_conflicts?: FolderConflict[] } & IgnoreSources>(`/diff${target ? '?target=' + encodeURIComponent(target) : ''}`), diffStream: ( onDiscovering: () => void, onStart: (total: number) => void, @@ -1204,9 +1204,20 @@ export function formatTokenK(n: number): string { export interface SyncResponse extends IgnoreSources { results: SyncResult[]; warnings?: string[]; + folder_conflicts?: FolderConflict[]; context_cost?: ContextCost; } +/** A skills folder two or more targets sync into with different settings, so each sync undoes the other. */ +export interface FolderConflict { + path: string; + targets: string[]; + /** The target to keep syncing skills */ + keep: string; + /** The targets to stop syncing skills for */ + stop: string[]; +} + export interface ConfigSaveResponse { success: boolean; warnings?: string[]; diff --git a/ui/src/i18n/locales/de.json b/ui/src/i18n/locales/de.json index 244435fe6..132eb06ab 100644 --- a/ui/src/i18n/locales/de.json +++ b/ui/src/i18n/locales/de.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "Die Synchronisierung lässt sie unberührt. Sammeln holt sie in deine Quelle.", "sync.local.collect": "Sammeln", "sync.forceHint": "Dateien ersetzen, die in einem Ziel bearbeitet wurden", + "sync.folderConflict.text": "{names} synchronisieren Skills mit unterschiedlichen Filtern in denselben Ordner {path}, sodass jede Synchronisierung die andere rückgängig macht.", + "sync.folderConflict.stop": "Skills für {name} nicht mehr synchronisieren", "sync.last.title": "Letzte Synchronisierung", "sync.last.when": "Wann", "sync.last.targets": "Ziele", diff --git a/ui/src/i18n/locales/en.json b/ui/src/i18n/locales/en.json index 4193b93cb..ef20b136b 100644 --- a/ui/src/i18n/locales/en.json +++ b/ui/src/i18n/locales/en.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "Sync leaves them alone. Collect brings them into your source.", "sync.local.collect": "Collect", "sync.forceHint": "Replace files that were edited inside a target", + "sync.folderConflict.text": "{names} sync skills to the same folder {path} with different filters, so each sync undoes the other.", + "sync.folderConflict.stop": "Stop syncing skills for {name}", "sync.last.title": "Last sync", "sync.last.when": "When", "sync.last.targets": "Targets", diff --git a/ui/src/i18n/locales/es.json b/ui/src/i18n/locales/es.json index e4e0906c4..668723597 100644 --- a/ui/src/i18n/locales/es.json +++ b/ui/src/i18n/locales/es.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "La sincronización no los toca. Recopilar los trae a tu origen.", "sync.local.collect": "Recopilar", "sync.forceHint": "Reemplazar archivos editados dentro de un destino", + "sync.folderConflict.text": "{names} sincronizan skills en la misma carpeta {path} con filtros distintos, así que cada sincronización deshace la otra.", + "sync.folderConflict.stop": "Dejar de sincronizar skills con {name}", "sync.last.title": "Última sincronización", "sync.last.when": "Cuándo", "sync.last.targets": "Destinos", diff --git a/ui/src/i18n/locales/fa.json b/ui/src/i18n/locales/fa.json index fd3aaa3d7..2a258590c 100644 --- a/ui/src/i18n/locales/fa.json +++ b/ui/src/i18n/locales/fa.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "همگام‌سازی به آن‌ها دست نمی‌زند. جمع‌آوری آن‌ها را به منبع شما می‌آورد.", "sync.local.collect": "جمع‌آوری", "sync.forceHint": "فایل‌هایی را که داخل هدف ویرایش شده‌اند جایگزین کن", + "sync.folderConflict.text": "{names} Skills را با فیلترهای متفاوت در یک پوشه ({path}) همگام‌سازی می‌کنند، بنابراین هر همگام‌سازی کار دیگری را خنثی می‌کند.", + "sync.folderConflict.stop": "توقف همگام‌سازی Skills برای {name}", "sync.last.title": "آخرین همگام‌سازی", "sync.last.when": "زمان", "sync.last.targets": "هدف‌ها", diff --git a/ui/src/i18n/locales/fr.json b/ui/src/i18n/locales/fr.json index 63fd6bca2..45a1cd640 100644 --- a/ui/src/i18n/locales/fr.json +++ b/ui/src/i18n/locales/fr.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "La synchronisation n'y touche pas. Collecter les ramène dans votre source.", "sync.local.collect": "Collecter", "sync.forceHint": "Remplacer les fichiers modifiés dans une cible", + "sync.folderConflict.text": "{names} synchronisent les skills dans le même dossier {path} avec des filtres différents : chaque synchronisation annule l’autre.", + "sync.folderConflict.stop": "Arrêter de synchroniser les skills vers {name}", "sync.last.title": "Dernière synchronisation", "sync.last.when": "Quand", "sync.last.targets": "Cibles", diff --git a/ui/src/i18n/locales/id.json b/ui/src/i18n/locales/id.json index f8ebc6d6b..31812c510 100644 --- a/ui/src/i18n/locales/id.json +++ b/ui/src/i18n/locales/id.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "Sinkronisasi tidak menyentuhnya. Kumpulkan membawanya ke sumber Anda.", "sync.local.collect": "Kumpulkan", "sync.forceHint": "Ganti file yang diedit di dalam target", + "sync.folderConflict.text": "{names} menyinkronkan skill ke folder yang sama {path} dengan filter berbeda, sehingga setiap sinkronisasi membatalkan yang lain.", + "sync.folderConflict.stop": "Berhenti menyinkronkan skill ke {name}", "sync.last.title": "Sinkronisasi terakhir", "sync.last.when": "Kapan", "sync.last.targets": "Target", diff --git a/ui/src/i18n/locales/ja.json b/ui/src/i18n/locales/ja.json index 577f6fcbb..adacb5fd4 100644 --- a/ui/src/i18n/locales/ja.json +++ b/ui/src/i18n/locales/ja.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "同期では変更されません。収集するとソースに取り込めます。", "sync.local.collect": "収集", "sync.forceHint": "ターゲット内で編集されたファイルを置き換えます", + "sync.folderConflict.text": "{names} は同じフォルダ {path} に異なるフィルターで Skills を同期しているため、同期のたびに互いの結果を打ち消します。", + "sync.folderConflict.stop": "{name} の Skills の同期を停止", "sync.last.title": "前回の同期", "sync.last.when": "日時", "sync.last.targets": "ターゲット", diff --git a/ui/src/i18n/locales/ko.json b/ui/src/i18n/locales/ko.json index c0d22509c..db75414ef 100644 --- a/ui/src/i18n/locales/ko.json +++ b/ui/src/i18n/locales/ko.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "동기화는 이 항목을 건드리지 않습니다. 수집하면 소스로 가져옵니다.", "sync.local.collect": "수집", "sync.forceHint": "대상 안에서 수정된 파일을 교체합니다", + "sync.folderConflict.text": "{names}이(가) 같은 폴더 {path}에 서로 다른 필터로 Skills를 동기화해서, 동기화할 때마다 서로의 결과를 되돌립니다.", + "sync.folderConflict.stop": "{name}의 Skills 동기화 중지", "sync.last.title": "마지막 동기화", "sync.last.when": "시간", "sync.last.targets": "대상", diff --git a/ui/src/i18n/locales/pt-BR.json b/ui/src/i18n/locales/pt-BR.json index b16ef9d65..fc026f4e0 100644 --- a/ui/src/i18n/locales/pt-BR.json +++ b/ui/src/i18n/locales/pt-BR.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "A sincronização não mexe neles. Coletar traz para a sua origem.", "sync.local.collect": "Coletar", "sync.forceHint": "Substituir arquivos editados dentro de um destino", + "sync.folderConflict.text": "{names} sincronizam skills na mesma pasta {path} com filtros diferentes, então cada sincronização desfaz a outra.", + "sync.folderConflict.stop": "Parar de sincronizar skills com {name}", "sync.last.title": "Última sincronização", "sync.last.when": "Quando", "sync.last.targets": "Destinos", diff --git a/ui/src/i18n/locales/zh-CN.json b/ui/src/i18n/locales/zh-CN.json index 4032018b7..c9f5cfadf 100644 --- a/ui/src/i18n/locales/zh-CN.json +++ b/ui/src/i18n/locales/zh-CN.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "同步不会动它们,收集可以将其纳入来源。", "sync.local.collect": "收集", "sync.forceHint": "替换在目标中修改过的文件", + "sync.folderConflict.text": "{names} 同步到同一个文件夹 {path},但筛选不同,每次同步都会互相加回、删掉。", + "sync.folderConflict.stop": "停止同步 {name} 的 Skills", "sync.last.title": "上次同步", "sync.last.when": "时间", "sync.last.targets": "目标", diff --git a/ui/src/i18n/locales/zh-TW.json b/ui/src/i18n/locales/zh-TW.json index 2ccb45549..8bc834afa 100644 --- a/ui/src/i18n/locales/zh-TW.json +++ b/ui/src/i18n/locales/zh-TW.json @@ -1651,6 +1651,8 @@ "sync.local.hint": "同步不會動到它們,收集可以將其納入來源。", "sync.local.collect": "收集", "sync.forceHint": "取代在目標中修改過的檔案", + "sync.folderConflict.text": "{names} 同步到同一個資料夾 {path},但篩選不同,每次同步都會互相加回、刪掉。", + "sync.folderConflict.stop": "停止同步 {name} 的 Skills", "sync.last.title": "上次同步", "sync.last.when": "時間", "sync.last.targets": "目標", diff --git a/ui/src/pages/SyncPage.test.tsx b/ui/src/pages/SyncPage.test.tsx new file mode 100644 index 000000000..04e5c5e37 --- /dev/null +++ b/ui/src/pages/SyncPage.test.tsx @@ -0,0 +1,51 @@ +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; +import { render, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { MemoryRouter } from 'react-router-dom'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; +import { api } from '../api/client'; +import type { Target } from '../api/client'; +import { mcpApi } from '../api/mcp'; +import { ToastProvider } from '../components/Toast'; +import { I18nProvider } from '../i18n'; +import SyncPage from './SyncPage'; + +vi.mock('../api/client', async (load) => ({ + ...await load(), + api: { listTargets: vi.fn(), diff: vi.fn(), diffExtras: vi.fn(), listLog: vi.fn(), skillsOffPreview: vi.fn(), updateTarget: vi.fn() }, +})); +vi.mock('../api/mcp', async (load) => ({ ...await load(), mcpApi: { list: vi.fn() } })); + +const target = (name: string) => ({ + name, path: '/home/me/.agents/skills', mode: 'merge', targetNaming: 'flat', status: 'merged', linkedCount: 3, localCount: 0, + include: [], exclude: [], expectedSkillCount: 3, skillsEnabled: true, +}) as Target; + +describe('Sync page folder conflicts', () => { + beforeEach(() => { + vi.clearAllMocks(); + vi.mocked(api.listTargets).mockResolvedValue({ targets: [target('codex'), target('universal')], sourceSkillCount: 3 }); + vi.mocked(api.diff).mockResolvedValue({ + diffs: [], ignored_count: 0, ignored_skills: [], ignore_root: '', ignore_repos: [], + folder_conflicts: [{ path: '/home/me/.agents/skills', targets: ['codex', 'universal'], keep: 'universal', stop: ['codex'] }], + }); + vi.mocked(api.diffExtras).mockResolvedValue({ extras: [] }); + vi.mocked(api.listLog).mockResolvedValue({ entries: [] } as never); + vi.mocked(mcpApi.list).mockResolvedValue({ paths: {}, source: { targets: [], servers: {} } } as never); + vi.mocked(api.skillsOffPreview).mockResolvedValue({ remove: [], keep: [], sharedWith: 'universal' }); + vi.mocked(api.updateTarget).mockResolvedValue({ success: true }); + }); + + it('names the targets that undo each other and stops skills for the one to drop', async () => { + const user = userEvent.setup(); + render( + + + , + ); + expect(await screen.findByText(/codex and universal sync skills to the same folder .*\.agents\/skills with different filters, so each sync undoes the other\./)).toBeInTheDocument(); + await user.click(screen.getByRole('button', { name: 'Stop syncing skills for codex' })); + await user.click(await screen.findByRole('button', { name: 'Stop syncing' })); + await waitFor(() => expect(api.updateTarget).toHaveBeenCalledWith('codex', { skills_enabled: false })); + }); +}); diff --git a/ui/src/pages/SyncPage.tsx b/ui/src/pages/SyncPage.tsx index 09818305a..eb3af89b1 100644 --- a/ui/src/pages/SyncPage.tsx +++ b/ui/src/pages/SyncPage.tsx @@ -11,9 +11,10 @@ import { Checkbox } from '../components/Input'; import PageHeader from '../components/PageHeader'; import Spinner from '../components/Spinner'; import { useToast } from '../components/Toast'; -import { describeMessage, targetLabel } from '../components/mcp/mcpView'; +import { describeMessage, mcpClient, targetLabel } from '../components/mcp/mcpView'; import { countChanges, countEdited, extraGroups, MCP_CHANGED, mcpGroups, resourceGroups, runSync, type ChangeGroup, type Part, type RowIcon } from '../components/sync/syncView'; -import { refreshTargets } from '../components/targets/targetView'; +import SkillsOffDialog from '../components/targets/SkillsOffDialog'; +import { joinList, refreshTargets } from '../components/targets/targetView'; import { formatDateTime, formatRelativeTime, useI18n, useT } from '../i18n'; import { shortenHome } from '../lib/paths'; import { formatAgentDisplayName } from '../lib/resourceNames'; @@ -48,6 +49,7 @@ export default function SyncPage() { const [running, setRunning] = useState(false); const [runError, setRunError] = useState(''); const [outcome, setOutcome] = useState(null); + const [stopping, setStopping] = useState(''); const plan = mcp.data?.plan; const parts = new Set(PARTS.filter((p) => !off.has(p))); @@ -64,6 +66,10 @@ export default function SyncPage() { const ignored = [...(parts.has('skill') ? diff.data?.ignored_skills ?? [] : []), ...(parts.has('agent') ? diff.data?.agent_ignored_skills ?? [] : [])]; const skipped = parts.has('skill') ? diffs.filter((d) => (d.skippedCount ?? 0) > 0) : []; const last = log.data?.entries.find((e) => !e.args?.dry_run); + const targetList = targets.data?.targets ?? []; + const conflicts = diff.data?.folder_conflicts ?? []; + const stopTarget = targetList.find((x) => x.name === stopping); + const stopConflict = conflicts.find((c) => c.stop.includes(stopping)); const toggle = (set: Set, key: string) => { const next = new Set(set); if (next.has(key)) next.delete(key); else next.add(key); return next; }; @@ -152,6 +158,17 @@ export default function SyncPage() { )} {parts.has('mcp') && mcp.data?.previewError &&
{mcp.data.previewError}
} {outcome?.warnings?.map((w) =>
{w}
)} + {conflicts.map((c) => ( +
+ + {t('sync.folderConflict.text', { names: joinList(c.targets, locale), path: shortenHome(c.path) })} + {c.stop.map((name) => ( + + ))} +
+ ))}
{loading ? ( @@ -276,6 +293,19 @@ export default function SyncPage() {
{collecting && setCollecting(false)} />} + {stopTarget && ( + x.name === stopConflict?.keep)} + managed={[...(stopTarget.agentPath ? ['Agents'] : []), ...(mcp.data?.paths[mcpClient(stopTarget.name)] ? ['MCP'] : [])]} + onClose={() => setStopping('')} + onStopped={(removed) => { + setStopping(''); + refreshTargets(queryClient); + toast(t(removed === 1 ? 'targetDetail.skillsOff.stopped.one' : 'targetDetail.skillsOff.stopped.other', { name: stopTarget.name, count: removed }), 'success'); + }} + /> + )} ); } diff --git a/website/docs/reference/commands/doctor.md b/website/docs/reference/commands/doctor.md index 1b033f0ba..bc500f0cb 100644 --- a/website/docs/reference/commands/doctor.md +++ b/website/docs/reference/commands/doctor.md @@ -149,6 +149,15 @@ Doctor flags two classes of duplicate-skill risk before they reach the runtime p Resolution: disable one of the overlapping targets, or set a distinct path with `skillshare target --path `. +When the targets sharing a path have different `include` or `exclude` filters, each sync adds what one target wants and prunes what another filters out, so the folder never settles and `sync` keeps showing the same pending changes. Doctor marks these and suggests turning skills off for all but one target (`universal` when it is one of them) instead of removing a target: + +```text +! Shared path ~/.agents/skills ← codex, universal (different filters, so they undo each other on every sync) + suggestion: Keep universal syncing skills to ~/.agents/skills and stop the rest with `skillshare target codex --skills=false`. +``` + +`sync` prints the same targets with the command to run, and the dashboard's Sync page has a button that stops syncing skills for the target to drop. Targets sharing a path with identical settings keep the resolution above. + **`cross_target_discovery`** — fires when an enabled target's runtime is documented to also scan a directory another enabled target writes to. For example, a config left over from an older setup still points `codex` at the legacy `~/.codex/skills`, while `universal` writes to `~/.agents/skills` — which Codex also reads. Enabling both makes Codex see universal's content on top of its own. ```text @@ -312,7 +321,7 @@ skillshare doctor --json { "name": "source", "status": "pass", "message": "Source: ~/.config/skillshare/skills (12 skills)" }, { "name": "skillignore", "status": "pass", "message": ".skillignore: 3 patterns, 2 skills ignored", "details": ["test-*", "vendor/", "!important", "---", "test-draft", "vendor/lib"] }, { "name": "sync_drift", "status": "warning", "message": "claude: 1 skill(s) not synced (7/8 linked)", "details": ["new-skill"] }, - { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills and disable or reconfigure the rest (currently: universal, warp)"] }, + { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills; preview removing duplicate targets with `skillshare target remove --global --dry-run` (currently: universal, warp)."] }, { "name": "broken_symlinks", "status": "error", "message": "cursor: 1 broken symlink(s)", "details": ["old-skill"] } ], "summary": { "total": 14, "pass": 12, "warnings": 1, "errors": 1, "info": 0 }, diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/doctor.md b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/doctor.md index 1d29f8642..b8c1e3e35 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/doctor.md +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/doctor.md @@ -149,6 +149,15 @@ Doctor は、ランタイムのピッカーに到達する前に、Skill 重複 解決方法: 重複している Target のいずれかを無効化するか、`skillshare target --path ` で別のパスを設定してください。 +パスを共有する Target 同士で `include`、`exclude` のフィルターが異なる場合、同期のたびに一方の Target が必要とするものが追加され、もう一方がフィルターで除外したものが削除されます。そのためフォルダが落ち着かず、`sync` には同じ保留中の変更が表示され続けます。Doctor はこのケースを示し、Target を削除する代わりに 1 つ(`universal` が含まれていればそれ)を残して残りの Skills 同期をオフにするよう提案します: + +```text +! Shared path ~/.agents/skills ← codex, universal (different filters, so they undo each other on every sync) + suggestion: Keep universal syncing skills to ~/.agents/skills and stop the rest with `skillshare target codex --skills=false`. +``` + +`sync` も同じ Target と実行すべきコマンドを表示し、ダッシュボードの同期ページには外す Target の Skills 同期を停止するボタンがあります。設定が同一の Target がパスを共有している場合は、上記の解決方法がそのまま当てはまります。 + **`cross_target_discovery`** — ある有効な Target のランタイムが、別の有効な Target が書き込むディレクトリもスキャンすると文書化されている場合に発生します。例えば、以前のセットアップから残った設定では `codex` がレガシーな `~/.codex/skills` を指したままになっている一方、`universal` は `~/.agents/skills` に書き込みます — このディレクトリは Codex も読み込みます。両方を有効にすると、Codex は自身のコンテンツに加えて universal のコンテンツも見ることになります。 ```text @@ -312,7 +321,7 @@ skillshare doctor --json { "name": "source", "status": "pass", "message": "Source: ~/.config/skillshare/skills (12 skills)" }, { "name": "skillignore", "status": "pass", "message": ".skillignore: 3 patterns, 2 skills ignored", "details": ["test-*", "vendor/", "!important", "---", "test-draft", "vendor/lib"] }, { "name": "sync_drift", "status": "warning", "message": "claude: 1 skill(s) not synced (7/8 linked)", "details": ["new-skill"] }, - { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills and disable or reconfigure the rest (currently: universal, warp)"] }, + { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills; preview removing duplicate targets with `skillshare target remove --global --dry-run` (currently: universal, warp)."] }, { "name": "broken_symlinks", "status": "error", "message": "cursor: 1 broken symlink(s)", "details": ["old-skill"] } ], "summary": { "total": 14, "pass": 12, "warnings": 1, "errors": 1, "info": 0 }, diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/doctor.md b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/doctor.md index 6dbbfd86f..3e4aeae97 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/doctor.md +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/doctor.md @@ -149,6 +149,15 @@ Doctor는 런타임 피커에 도달하기 전에 두 가지 종류의 중복 sk 해결 방법: 중복된 target 중 하나를 비활성화하거나, `skillshare target --path `로 별도의 경로를 설정하십시오. +경로를 공유하는 target들의 `include`, `exclude` 필터가 서로 다르면, 동기화할 때마다 한 target이 원하는 항목이 추가되고 다른 target이 필터로 제외한 항목이 삭제됩니다. 그래서 폴더가 안정되지 않고 `sync`에 같은 대기 중 변경이 계속 표시됩니다. Doctor는 이 경우를 표시하고, target을 제거하는 대신 하나(`universal`이 포함되어 있으면 그것)만 남기고 나머지는 Skills 동기화를 끄도록 제안합니다: + +```text +! Shared path ~/.agents/skills ← codex, universal (different filters, so they undo each other on every sync) + suggestion: Keep universal syncing skills to ~/.agents/skills and stop the rest with `skillshare target codex --skills=false`. +``` + +`sync`도 같은 target과 실행할 명령을 출력하며, 대시보드의 동기화 페이지에는 뺄 target의 Skills 동기화를 중지하는 버튼이 있습니다. 설정이 같은 target들이 경로를 공유하는 경우에는 위의 해결 방법이 그대로 적용됩니다. + **`cross_target_discovery`** — 활성화된 target의 런타임이 다른 활성화된 target이 쓰는 디렉터리도 스캔하도록 문서화되어 있을 때 발생합니다. 예를 들어 이전 설정이 남아 있어 `codex`가 여전히 legacy 경로인 `~/.codex/skills`를 가리키는 반면, `universal`은 `~/.agents/skills`에 쓰고 Codex는 이 경로도 읽습니다. 둘 다 활성화하면 Codex가 자신의 콘텐츠에 더해 universal의 콘텐츠까지 보게 됩니다. ```text @@ -312,7 +321,7 @@ skillshare doctor --json { "name": "source", "status": "pass", "message": "Source: ~/.config/skillshare/skills (12 skills)" }, { "name": "skillignore", "status": "pass", "message": ".skillignore: 3 patterns, 2 skills ignored", "details": ["test-*", "vendor/", "!important", "---", "test-draft", "vendor/lib"] }, { "name": "sync_drift", "status": "warning", "message": "claude: 1 skill(s) not synced (7/8 linked)", "details": ["new-skill"] }, - { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills and disable or reconfigure the rest (currently: universal, warp)"] }, + { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills; preview removing duplicate targets with `skillshare target remove --global --dry-run` (currently: universal, warp)."] }, { "name": "broken_symlinks", "status": "error", "message": "cursor: 1 broken symlink(s)", "details": ["old-skill"] } ], "summary": { "total": 14, "pass": 12, "warnings": 1, "errors": 1, "info": 0 }, diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/doctor.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/doctor.md index 79d15d9b6..731e30a9f 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/doctor.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/doctor.md @@ -150,6 +150,15 @@ Doctor 会在两类重复 skill 风险到达运行时选择器之前将其标记 解决方法:禁用其中一个重叠的 target,或用 `skillshare target --path ` 设置一个独立的路径。 +如果共用路径的 targets 的 `include` 或 `exclude` 筛选不同,每次同步都会加入一个 target 需要的内容、再删掉另一个 target 过滤掉的内容,文件夹永远不会稳定,`sync` 也会一直显示同样的待同步变更。Doctor 会标出这种情况,并建议只保留一个 target(如果其中有 `universal` 就保留它)、其余的关闭 skills 同步,而不是移除 target: + +```text +! Shared path ~/.agents/skills ← codex, universal (different filters, so they undo each other on every sync) + suggestion: Keep universal syncing skills to ~/.agents/skills and stop the rest with `skillshare target codex --skills=false`. +``` + +`sync` 也会列出相同的 targets 和要执行的命令,dashboard 的同步页面则提供按钮,可直接停止同步该 target 的 skills。设置完全相同的共用路径 targets 仍适用上面的解决方法。 + **`cross_target_discovery`** —— 当某个已启用 target 的运行时文档说明它也会扫描 另一个已启用 target 写入的目录时触发。例如,沿用旧设置的配置仍让 `codex` 指向旧版的 `~/.codex/skills`,而 `universal` 写入 `~/.agents/skills` —— Codex 同样会读取这个目录。 @@ -316,7 +325,7 @@ skillshare doctor --json { "name": "source", "status": "pass", "message": "Source: ~/.config/skillshare/skills (12 skills)" }, { "name": "skillignore", "status": "pass", "message": ".skillignore: 3 patterns, 2 skills ignored", "details": ["test-*", "vendor/", "!important", "---", "test-draft", "vendor/lib"] }, { "name": "sync_drift", "status": "warning", "message": "claude: 1 skill(s) not synced (7/8 linked)", "details": ["new-skill"] }, - { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills and disable or reconfigure the rest (currently: universal, warp)"] }, + { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills; preview removing duplicate targets with `skillshare target remove --global --dry-run` (currently: universal, warp)."] }, { "name": "broken_symlinks", "status": "error", "message": "cursor: 1 broken symlink(s)", "details": ["old-skill"] } ], "summary": { "total": 14, "pass": 12, "warnings": 1, "errors": 1, "info": 0 }, diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/doctor.md b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/doctor.md index 93fed6566..b3d0d4658 100644 --- a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/doctor.md +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/doctor.md @@ -149,6 +149,15 @@ Doctor 會在兩類重複 skill 風險到達 runtime picker 之前先標示出 解決方式:停用其中一個重疊的 target,或使用 `skillshare target --path ` 設定不同的路徑。 +若共用路徑的 targets 其 `include` 或 `exclude` 篩選不同,每次同步都會加入一個 target 要的內容、再刪掉另一個 target 過濾掉的內容,資料夾永遠不會穩定,`sync` 也會一直顯示同樣的待同步變更。Doctor 會標出這種情況,並建議只保留一個 target(若其中有 `universal` 就保留它)、其他的關閉 skills 同步,而不是移除 target: + +```text +! Shared path ~/.agents/skills ← codex, universal (different filters, so they undo each other on every sync) + suggestion: Keep universal syncing skills to ~/.agents/skills and stop the rest with `skillshare target codex --skills=false`. +``` + +`sync` 也會列出相同的 targets 與要執行的指令,dashboard 的同步頁面則提供按鈕,可直接停止同步該 target 的 skills。設定完全相同的共用路徑 targets 仍適用上方的解決方式。 + **`cross_target_discovery`**——當某個已啟用 target 的 runtime 文件說明它也會掃描另一個已啟用 target 寫入的目錄時觸發。例如,從舊設定沿用下來的 config 仍將 `codex` 指向舊的 `~/.codex/skills`,而 `universal` 則寫入 `~/.agents/skills`——這個目錄 Codex 同樣會讀取。兩者都啟用時,Codex 就會在自己的內容之外,額外看到 universal 的內容。 ```text @@ -312,7 +321,7 @@ skillshare doctor --json { "name": "source", "status": "pass", "message": "Source: ~/.config/skillshare/skills (12 skills)" }, { "name": "skillignore", "status": "pass", "message": ".skillignore: 3 patterns, 2 skills ignored", "details": ["test-*", "vendor/", "!important", "---", "test-draft", "vendor/lib"] }, { "name": "sync_drift", "status": "warning", "message": "claude: 1 skill(s) not synced (7/8 linked)", "details": ["new-skill"] }, - { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills and disable or reconfigure the rest (currently: universal, warp)"] }, + { "name": "shared_target_paths", "status": "warning", "message": "1 shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", "details": ["~/.agents/skills ← universal, warp"], "suggestions": ["Choose one authoritative target for ~/.agents/skills; preview removing duplicate targets with `skillshare target remove --global --dry-run` (currently: universal, warp)."] }, { "name": "broken_symlinks", "status": "error", "message": "cursor: 1 broken symlink(s)", "details": ["old-skill"] } ], "summary": { "total": 14, "pass": 12, "warnings": 1, "errors": 1, "info": 0 },