Skip to content

mission control for agent skills

fix: protect canonical skill files behind symlinked scope roots

dongdongbhcd82d49e0e19
diff --git a/internal/actions/actions.go b/internal/actions/actions.go
index a6bf662..ded59f9 100644
--- a/internal/actions/actions.go
+++ b/internal/actions/actions.go
@@ -285,7 +285,11 @@ func ForSkillWithResolver(sk *model.Skill, resolve SkillsResolver) []CommandPrev
previews = append(previews, unavailablePreview("Open selected skill", reason))
}
- if addSource, skillFilter, ok, reasonAdd := addIdentity(sk); ok {
+ sharedOp, isSharedRoot := sharedRootObservation(sk)
+
+ if isSharedRoot {
+ previews = append(previews, unavailablePreview("Reinstall/update selected skill", SharedRootReason(sharedOp.Path)))
+ } else if addSource, skillFilter, ok, reasonAdd := addIdentity(sk); ok {
program, baseArgs := resolve()
args := append([]string{}, baseArgs...)
args = append(args, "add", addSource, "--skill", skillFilter, "--yes")
@@ -299,7 +303,9 @@ func ForSkillWithResolver(sk *model.Skill, resolve SkillsResolver) []CommandPrev
previews = append(previews, unavailablePreview("Reinstall/update selected skill", reasonAdd))
}
- if target, ok, reasonRemove := removeIdentity(sk); ok {
+ if isSharedRoot {
+ previews = append(previews, unavailablePreview("Remove selected skill", SharedRootReason(sharedOp.Path)))
+ } else if target, ok, reasonRemove := removeIdentity(sk); ok {
program, baseArgs := resolve()
args := append([]string{}, baseArgs...)
args = append(args, "remove", target, "--yes")
@@ -317,10 +323,34 @@ func ForSkillWithResolver(sk *model.Skill, resolve SkillsResolver) []CommandPrev
}
if hasBrokenSymlink(sk) {
previews = append(previews, deleteBrokenSymlinkPreview(sk))
+ } else if sharedBroken, ok := onlySharedRootBrokenSymlink(sk); ok {
+ // The only broken symlink(s) here live in a shared canonical repo;
+ // surface why the action is gated instead of letting it silently
+ // vanish from the list.
+ previews = append(previews, unavailablePreview("Delete broken symlink(s)", SharedRootReason(sharedBroken.Path)))
}
return previews
}
+// sharedRootObservation returns the first observed path for sk that was
+// reached through a symlinked scope root, if any.
+func sharedRootObservation(sk *model.Skill) (model.ObservedPath, bool) {
+ for _, op := range sk.ObservedPaths {
+ if op.SharedRoot {
+ return op, true
+ }
+ }
+ return model.ObservedPath{}, false
+}
+
+// SharedRootReason builds the unavailability reason shown when a write
+// action is gated because the skill's files are reached through a
+// symlinked, shared scope root. Exported so callers outside this package
+// (the TUI's disable/enable move flow) can gate on the identical message.
+func SharedRootReason(path string) string {
+ return fmt.Sprintf("skill files are reached through a symlinked skills root (%s); write actions are disabled to protect the shared canonical source", compat.SanitizeMetadata(path))
+}
+
// hasOrphanedLock reports whether the skill is a lock entry whose files are
// gone from disk (the scan flags this as lock_without_files).
func hasOrphanedLock(sk *model.Skill) bool {
@@ -353,18 +383,42 @@ func pruneLockPreview(sk *model.Skill) CommandPreview {
}
}
+// hasBrokenSymlink reports whether sk has a broken symlink that lazyskills
+// owns and may delete. Broken symlinks living under a shared scope root are
+// excluded: deleting them would mutate a canonical repo shared by other
+// agents, not just this skill's own location.
func hasBrokenSymlink(sk *model.Skill) bool {
if sk == nil {
return false
}
for _, op := range sk.ObservedPaths {
- if op.Status == model.StatusBrokenSymlink {
+ if op.Status == model.StatusBrokenSymlink && !op.SharedRoot {
return true
}
}
return false
}
+// onlySharedRootBrokenSymlink reports whether sk has at least one broken
+// symlink observation and every one of them lives under a shared scope root
+// (i.e. hasBrokenSymlink is false only because of the shared-root guard, not
+// because there are no broken symlinks at all).
+func onlySharedRootBrokenSymlink(sk *model.Skill) (model.ObservedPath, bool) {
+ found := false
+ var shared model.ObservedPath
+ for _, op := range sk.ObservedPaths {
+ if op.Status != model.StatusBrokenSymlink {
+ continue
+ }
+ if !op.SharedRoot {
+ return model.ObservedPath{}, false
+ }
+ found = true
+ shared = op
+ }
+ return shared, found
+}
+
// deleteBrokenSymlinkPreview builds the internal action that deletes the
// broken/dangling symlink files for a skill. The TUI owns the filesystem
// mutation and triggers a rescan afterwards. ONLY broken symlinks are ever
diff --git a/internal/actions/actions_test.go b/internal/actions/actions_test.go
index 272f348..500f84d 100644
--- a/internal/actions/actions_test.go
+++ b/internal/actions/actions_test.go
@@ -141,6 +141,98 @@ func TestBulkActionsBuildBatchCommands(t *testing.T) {
}
}
+func TestSharedRootSkillDisablesReinstallAndRemove(t *testing.T) {
+ sk := &model.Skill{
+ Name: "Shared",
+ Scope: model.ScopeGlobal,
+ CanonicalPath: "/tmp/shared",
+ GlobalLock: &model.GlobalLockEntry{Source: "owner/repo"},
+ ObservedPaths: []model.ObservedPath{
+ {Path: "/home/user/.codex/skills/shared", Status: model.StatusCopy, SharedRoot: true},
+ },
+ }
+ previews := ForSkill(sk)
+
+ reinstall := previewByTitle(t, previews, "Reinstall/update selected skill")
+ if reinstall.Available {
+ t.Fatalf("expected reinstall/update to be unavailable for a shared-root skill: %#v", reinstall)
+ }
+ if !strings.Contains(reinstall.Reason, "/home/user/.codex/skills/shared") {
+ t.Fatalf("expected reason to name the symlinked root, got %q", reinstall.Reason)
+ }
+
+ remove := previewByTitle(t, previews, "Remove selected skill")
+ if remove.Available {
+ t.Fatalf("expected remove to be unavailable for a shared-root skill: %#v", remove)
+ }
+ if !strings.Contains(remove.Reason, "/home/user/.codex/skills/shared") {
+ t.Fatalf("expected reason to name the symlinked root, got %q", remove.Reason)
+ }
+
+ // open_skill is read-only and must stay available; a skill's own lock
+ // pruning (prune_lock) never touches skill files, so it is unaffected
+ // too — but this skill has no orphaned lock, so it's simply absent.
+ for _, p := range previews {
+ if p.ID == "prune_lock" {
+ t.Fatalf("did not expect prune_lock for a skill with a matching lock entry: %#v", p)
+ }
+ }
+}
+
+func TestSharedRootOnlyBrokenSymlinkIsGatedNotHidden(t *testing.T) {
+ sk := &model.Skill{
+ Name: "broken-shared",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {Path: "/home/user/.codex/skills/broken-shared", Status: model.StatusBrokenSymlink, SharedRoot: true},
+ },
+ }
+ previews := ForSkill(sk)
+ deleteAct := previewByTitle(t, previews, "Delete broken symlink(s)")
+ if deleteAct.Available {
+ t.Fatalf("expected delete_broken_symlink to be unavailable when the only broken symlink is shared-root: %#v", deleteAct)
+ }
+ if !strings.Contains(deleteAct.Reason, "/home/user/.codex/skills/broken-shared") {
+ t.Fatalf("expected reason to name the symlinked root, got %q", deleteAct.Reason)
+ }
+
+ // A skill with one shared-root broken symlink and one owned broken
+ // symlink must still offer the (owned-only) delete action.
+ mixed := &model.Skill{
+ Name: "mixed",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {Path: "/home/user/.codex/skills/mixed", Status: model.StatusBrokenSymlink, SharedRoot: true},
+ {Path: "/home/user/.claude/skills/mixed", Status: model.StatusBrokenSymlink, SharedRoot: false},
+ },
+ }
+ mixedDelete := previewByTitle(t, ForSkill(mixed), "Delete broken symlink(s)")
+ if !mixedDelete.Available || mixedDelete.Exec.Internal != "delete_broken_symlink" {
+ t.Fatalf("expected an executable delete action when a non-shared broken symlink also exists: %#v", mixedDelete)
+ }
+}
+
+func TestBulkActionsUnavailableForSharedRootSkill(t *testing.T) {
+ skills := []*model.Skill{
+ {
+ Name: "Shared",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {Path: "/home/user/.codex/skills/shared", Status: model.StatusCopy, SharedRoot: true},
+ },
+ },
+ }
+ previews := ForSkillsWithResolver(skills, func() (string, []string) { return "skills", nil })
+ if len(previews) != 2 {
+ t.Fatalf("expected bulk update and remove previews, got %#v", previews)
+ }
+ for _, p := range previews {
+ if p.Available {
+ t.Fatalf("expected bulk action to be unavailable for a shared-root skill: %#v", p)
+ }
+ }
+}
+
func TestOpenEditorActionUsesSafeEditorAndSkillPath(t *testing.T) {
t.Setenv("EDITOR", "vim -n")
previews := ForSkill(&model.Skill{Name: "Deploy", Scope: model.ScopeProject, SkillPath: "/tmp/deploy/SKILL.md"})
diff --git a/internal/agents/agents.go b/internal/agents/agents.go
index 9b5105a..9e89e93 100644
--- a/internal/agents/agents.go
+++ b/internal/agents/agents.go
@@ -265,6 +265,16 @@ type Location struct {
Scope model.Scope
AgentName string
Canonical bool
+ // SharedRoot reports whether Root is reached through a symlinked path
+ // component, meaning the files under it are shared with whatever the
+ // link resolves to (e.g. another agent's canonical skills directory).
+ SharedRoot bool
+ // SharedRootLink is the symlinked path component (logical path), for
+ // diagnostic messages. Empty unless SharedRoot is true.
+ SharedRootLink string
+ // SharedRootTarget is the symlink's resolved (absolute, cleaned) target,
+ // for diagnostic messages. Empty unless SharedRoot is true.
+ SharedRootTarget string
}
func Locations(cwd string) []Location { return LocationsWithEnv(cwd, DefaultEnv()) }
@@ -273,6 +283,17 @@ func LocationsWithEnv(cwd string, e Env) []Location {
seen := map[string]bool{}
globalRoots := map[string]bool{}
homeIsCwd := filepath.Clean(cwd) == filepath.Clean(e.Home)
+ sharedCache := map[string]sharedRootResult{}
+ sharedFor := func(root, anchor string) sharedRootResult {
+ key := root + "\x00" + anchor
+ if result, ok := sharedCache[key]; ok {
+ return result
+ }
+ link, target, shared := sharedRootInfo(root, anchor)
+ result := sharedRootResult{link: link, target: target, shared: shared}
+ sharedCache[key] = result
+ return result
+ }
add := func(loc Location) {
key := string(loc.Scope) + "\x00" + loc.AgentName + "\x00" + loc.Root
if seen[key] {
@@ -300,18 +321,84 @@ func LocationsWithEnv(cwd string, e Env) []Location {
// project-scoped. homeIsCwd handles the cwd==home special case; this guard
// covers the general "project root under a global root" overlap.
if !homeIsCwd && !isUnderAnyGlobalRoot(filepath.Clean(projectRoot), globalRoots) {
- add(Location{Root: projectRoot, Scope: model.ScopeProject, AgentName: a.Name, Canonical: a.Universal})
+ shared := sharedFor(projectRoot, cwd)
+ add(Location{Root: projectRoot, Scope: model.ScopeProject, AgentName: a.Name, Canonical: a.Universal, SharedRoot: shared.shared, SharedRootLink: shared.link, SharedRootTarget: shared.target})
}
if a.Universal && a.SupportsGlobal {
- add(Location{Root: globalCanonical, Scope: model.ScopeGlobal, AgentName: a.Name, Canonical: true})
+ shared := sharedFor(globalCanonical, e.Home)
+ add(Location{Root: globalCanonical, Scope: model.ScopeGlobal, AgentName: a.Name, Canonical: true, SharedRoot: shared.shared, SharedRootLink: shared.link, SharedRootTarget: shared.target})
}
if a.SupportsGlobal && a.GlobalDir != "" && a.GlobalDir != globalCanonical {
- add(Location{Root: a.GlobalDir, Scope: model.ScopeGlobal, AgentName: a.Name, Canonical: false})
+ shared := sharedFor(a.GlobalDir, e.Home)
+ add(Location{Root: a.GlobalDir, Scope: model.ScopeGlobal, AgentName: a.Name, Canonical: false, SharedRoot: shared.shared, SharedRootLink: shared.link, SharedRootTarget: shared.target})
}
}
return out
}
+type sharedRootResult struct {
+ link string
+ target string
+ shared bool
+}
+
+// sharedRootInfo reports whether root is reached through a symlinked path
+// component below anchor. anchor is cwd for project-scope locations and the
+// user's home directory for global-scope locations.
+//
+// When root sits under anchor, each path component of root strictly below
+// anchor is Lstat-ed in turn; the first symlinked component means everything
+// under it (including root) is shared with wherever the link resolves to.
+// A missing component means nothing below it exists either, so the walk
+// stops there and reports not-shared rather than continuing.
+//
+// When root is NOT under anchor (e.g. CODEX_HOME pointing outside the home
+// directory), only root itself is Lstat-ed and reported if it is a symlink.
+// The walk deliberately does not continue up to the filesystem root in that
+// case — doing so would false-positive on system-level symlinks such as
+// macOS's /var -> /private/var.
+func sharedRootInfo(root, anchor string) (link, target string, shared bool) {
+ root = filepath.Clean(root)
+ anchor = filepath.Clean(anchor)
+ if root == anchor {
+ return "", "", false
+ }
+ prefix := anchor + string(filepath.Separator)
+ if !strings.HasPrefix(root, prefix) {
+ return symlinkAt(root)
+ }
+ rel := strings.TrimPrefix(root, prefix)
+ current := anchor
+ for _, part := range strings.Split(rel, string(filepath.Separator)) {
+ current = filepath.Join(current, part)
+ info, err := os.Lstat(current)
+ if err != nil {
+ return "", "", false
+ }
+ if info.Mode()&os.ModeSymlink != 0 {
+ return symlinkAt(current)
+ }
+ }
+ return "", "", false
+}
+
+// symlinkAt reports whether path itself is a symlink, returning path as the
+// link and its resolved, cleaned target when so.
+func symlinkAt(path string) (link, target string, shared bool) {
+ info, err := os.Lstat(path)
+ if err != nil || info.Mode()&os.ModeSymlink == 0 {
+ return "", "", false
+ }
+ raw, err := os.Readlink(path)
+ if err != nil {
+ return "", "", false
+ }
+ if !filepath.IsAbs(raw) {
+ raw = filepath.Join(filepath.Dir(path), raw)
+ }
+ return path, filepath.Clean(raw), true
+}
+
// isUnderAnyGlobalRoot reports whether path is equal to, or nested inside, any
// of the global skills roots. Matching is path-boundary aware so that
// ~/.agents/skills-foo is not treated as inside ~/.agents/skills.
diff --git a/internal/agents/shared_root_test.go b/internal/agents/shared_root_test.go
new file mode 100644
index 0000000..249191a
--- /dev/null
+++ b/internal/agents/shared_root_test.go
@@ -0,0 +1,191 @@
+package agents
+
+import (
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/alvinunreal/lazyskills/internal/model"
+)
+
+// sharedRootInfo needs real symlinks on a real filesystem (unlike the fake
+// string-path + ExistsFunc tests elsewhere in this package), so these tests
+// use t.TempDir() throughout.
+
+func TestSharedRootInfoDetectsSymlinkedLeafSkillsDir(t *testing.T) {
+ home := t.TempDir()
+ claudeSkills := filepath.Join(home, ".claude", "skills")
+ if err := os.MkdirAll(claudeSkills, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ codexHome := filepath.Join(home, ".codex")
+ if err := os.MkdirAll(codexHome, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ codexSkills := filepath.Join(codexHome, "skills")
+ if err := os.Symlink(claudeSkills, codexSkills); err != nil {
+ t.Fatal(err)
+ }
+
+ link, target, shared := sharedRootInfo(codexSkills, home)
+ if !shared {
+ t.Fatalf("expected symlinked leaf skills dir to be detected as shared")
+ }
+ if link != codexSkills {
+ t.Fatalf("expected link %q, got %q", codexSkills, link)
+ }
+ if target != claudeSkills {
+ t.Fatalf("expected target %q, got %q", claudeSkills, target)
+ }
+}
+
+func TestSharedRootInfoDetectsParentLevelSymlink(t *testing.T) {
+ home := t.TempDir()
+ claudeHome := filepath.Join(home, ".claude")
+ if err := os.MkdirAll(filepath.Join(claudeHome, "skills"), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ codexHome := filepath.Join(home, ".codex")
+ if err := os.Symlink(claudeHome, codexHome); err != nil {
+ t.Fatal(err)
+ }
+
+ root := filepath.Join(codexHome, "skills")
+ link, target, shared := sharedRootInfo(root, home)
+ if !shared {
+ t.Fatalf("expected parent-level symlink to be detected as shared")
+ }
+ if link != codexHome {
+ t.Fatalf("expected link to be the symlinked parent component %q, got %q", codexHome, link)
+ }
+ if target != claudeHome {
+ t.Fatalf("expected target %q, got %q", claudeHome, target)
+ }
+}
+
+func TestSharedRootInfoIgnoresPlainRealDirectories(t *testing.T) {
+ home := t.TempDir()
+ root := filepath.Join(home, ".claude", "skills")
+ if err := os.MkdirAll(root, 0o755); err != nil {
+ t.Fatal(err)
+ }
+
+ if _, _, shared := sharedRootInfo(root, home); shared {
+ t.Fatalf("expected plain real directories to not be flagged as shared")
+ }
+}
+
+func TestSharedRootInfoOutsideAnchorOnlyChecksRootItself(t *testing.T) {
+ home := t.TempDir()
+ external := t.TempDir()
+
+ // A real directory root outside anchor: not shared, even though it lives
+ // outside the anchor entirely.
+ realRoot := filepath.Join(external, "codex", "skills")
+ if err := os.MkdirAll(realRoot, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if _, _, shared := sharedRootInfo(realRoot, home); shared {
+ t.Fatalf("expected real directory outside anchor to not be flagged as shared")
+ }
+
+ // A symlinked root outside anchor (e.g. CODEX_HOME pointing elsewhere):
+ // flagged because the root itself is a symlink.
+ target := filepath.Join(external, "actual-skills")
+ if err := os.MkdirAll(target, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ linkedRoot := filepath.Join(external, "codex-linked-skills")
+ if err := os.Symlink(target, linkedRoot); err != nil {
+ t.Fatal(err)
+ }
+ link, gotTarget, shared := sharedRootInfo(linkedRoot, home)
+ if !shared {
+ t.Fatalf("expected symlinked root outside anchor to be flagged as shared")
+ }
+ if link != linkedRoot {
+ t.Fatalf("expected link %q, got %q", linkedRoot, link)
+ }
+ if gotTarget != target {
+ t.Fatalf("expected target %q, got %q", target, gotTarget)
+ }
+}
+
+func TestSharedRootInfoSiblingNotConfusedWithRoot(t *testing.T) {
+ home := t.TempDir()
+ anchor := filepath.Join(home, ".agents", "skills")
+ if err := os.MkdirAll(anchor, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ sibling := filepath.Join(home, ".agents", "skills-foo")
+ if err := os.MkdirAll(sibling, 0o755); err != nil {
+ t.Fatal(err)
+ }
+
+ // skills-foo is not "under" skills despite sharing a string prefix; it
+ // must be treated as outside the anchor (and here it's a plain real
+ // directory, so not shared).
+ if _, _, shared := sharedRootInfo(sibling, anchor); shared {
+ t.Fatalf("expected ~/.agents/skills-foo to not be confused with ~/.agents/skills")
+ }
+}
+
+func TestSharedRootInfoMissingComponentIsNotShared(t *testing.T) {
+ home := t.TempDir()
+ root := filepath.Join(home, ".codex", "skills")
+ // Neither home/.codex nor home/.codex/skills exists.
+ if _, _, shared := sharedRootInfo(root, home); shared {
+ t.Fatalf("expected missing components to not be flagged as shared")
+ }
+}
+
+func TestLocationsWithEnvPropagatesSharedRootThroughSymlinkedScopeRoot(t *testing.T) {
+ home := t.TempDir()
+ cwd := t.TempDir()
+ claudeSkills := filepath.Join(home, ".claude", "skills")
+ if err := os.MkdirAll(claudeSkills, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ codexHome := filepath.Join(home, ".codex")
+ if err := os.MkdirAll(codexHome, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Symlink(claudeSkills, filepath.Join(codexHome, "skills")); err != nil {
+ t.Fatal(err)
+ }
+
+ e := Env{Home: home, Vars: map[string]string{}, ExistsFunc: pathExists}
+ locations := LocationsWithEnv(cwd, e)
+
+ codexSkills := filepath.Join(codexHome, "skills")
+ foundCodex, foundClaude := false, false
+ for _, loc := range locations {
+ if loc.Scope != model.ScopeGlobal {
+ continue
+ }
+ // codex is Universal, so it also has a global-canonical location
+ // (~/.agents/skills) in addition to its own GlobalDir; only the
+ // latter is reached through the symlink under test.
+ if loc.AgentName == "codex" && loc.Root == codexSkills {
+ foundCodex = true
+ if !loc.SharedRoot {
+ t.Fatalf("expected codex global location to be flagged shared, got %#v", loc)
+ }
+ if loc.SharedRootLink != codexSkills {
+ t.Fatalf("unexpected shared root link: %#v", loc)
+ }
+ if loc.SharedRootTarget != claudeSkills {
+ t.Fatalf("unexpected shared root target: %#v", loc)
+ }
+ }
+ if loc.AgentName == "claude-code" && loc.Root == claudeSkills {
+ foundClaude = true
+ if loc.SharedRoot {
+ t.Fatalf("expected claude-code global location to not be flagged shared, got %#v", loc)
+ }
+ }
+ }
+ if !foundCodex || !foundClaude {
+ t.Fatalf("expected both codex and claude-code global locations, got %#v", locations)
+ }
+}
diff --git a/internal/model/model.go b/internal/model/model.go
index bea8128..46345b8 100644
--- a/internal/model/model.go
+++ b/internal/model/model.go
@@ -26,6 +26,11 @@ type ObservedPath struct {
Agent string `json:"agent"`
Status Status `json:"status"`
TargetPath string `json:"target_path,omitempty"` // For symlinks, what they point to
+ // SharedRoot reports whether this path was reached through a symlinked
+ // scope root (e.g. ~/.codex/skills -> ~/.claude/skills). Files here are
+ // not owned by this location: they are shared with whatever the link
+ // resolves to, so destructive actions must not be offered for them.
+ SharedRoot bool `json:"shared_root,omitempty"`
}
// HealthIssue represents a configuration or discovery issue with a skill.
diff --git a/internal/scan/scan.go b/internal/scan/scan.go
index 5224cb8..97bee75 100644
--- a/internal/scan/scan.go
+++ b/internal/scan/scan.go
@@ -249,6 +249,7 @@ func scanDisabledLocation(loc agents.Location, skills map[string]*model.Skill) {
Agent: loc.AgentName,
Status: model.StatusDisabled,
TargetPath: filepath.Join(loc.Root, entry.Name()),
+ SharedRoot: loc.SharedRoot,
}
parseDir := path
if info.Mode()&os.ModeSymlink != 0 {
@@ -596,13 +597,31 @@ func applyScannedLocationRecords(loc agents.Location, skills map[string]*model.S
}
observed := record.observed
observed.Agent = loc.AgentName
+ observed.SharedRoot = loc.SharedRoot
addObservedPath(sk, observed)
for _, issue := range record.healthIssues {
sk.AddHealthIssue(issue)
}
+ if loc.SharedRoot {
+ sk.AddHealthIssue(model.HealthIssue{
+ Type: "shared_scope_root",
+ Severity: "warning",
+ Message: sharedScopeRootMessage(loc),
+ Path: observed.Path,
+ })
+ }
}
}
+// sharedScopeRootMessage explains, for the TUI and JSON output, why a skill
+// reached through a symlinked scope root has its write actions disabled.
+func sharedScopeRootMessage(loc agents.Location) string {
+ return fmt.Sprintf(
+ "skills root is reached through symlink %s -> %s; files here are shared with other locations and write actions are disabled",
+ compat.SanitizeMetadata(loc.SharedRootLink), compat.SanitizeMetadata(loc.SharedRootTarget),
+ )
+}
+
func ensureSkill(skills map[string]*model.Skill, scope model.Scope, keyHint, name, desc string) *model.Skill {
keyName := name
if compat.NormalizeName(keyName) == "" {
diff --git a/internal/scan/scan_test.go b/internal/scan/scan_test.go
index 7de9359..688feeb 100644
--- a/internal/scan/scan_test.go
+++ b/internal/scan/scan_test.go
@@ -781,3 +781,69 @@ func TestNestedBundleDiscoversChildrenAndSuppressesContainer(t *testing.T) {
t.Fatalf("expected only nested child skill, got %#v", res.Skills)
}
}
+
+// TestSharedScopeRootSymlinkFlagsOnlyTheSymlinkedAgent covers the
+// alvinunreal/lazyskills#34 scenario: an agent's scope root directory is
+// itself a symlink into another agent's canonical skills tree (e.g.
+// ~/.codex/skills -> ~/.claude/skills). The skill must remain visible to
+// both agents, but only the observation reached through the symlink is
+// flagged as shared/non-owned.
+func TestSharedScopeRootSymlinkFlagsOnlyTheSymlinkedAgent(t *testing.T) {
+ home := withHome(t)
+ cwd := t.TempDir()
+
+ claudeSkills := filepath.Join(home, ".claude", "skills")
+ writeSkill(t, filepath.Join(claudeSkills, "shared"), "Shared", "shared skill")
+
+ codexHome := filepath.Join(home, ".codex")
+ if err := os.MkdirAll(codexHome, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Symlink(claudeSkills, filepath.Join(codexHome, "skills")); err != nil {
+ t.Fatal(err)
+ }
+
+ res, err := Run(cwd)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ var sk *model.Skill
+ for _, s := range res.Skills {
+ if s.Name == "Shared" {
+ sk = s
+ }
+ }
+ if sk == nil {
+ t.Fatalf("expected Shared skill in scan results, got %#v", res.Skills)
+ }
+
+ var codexObserved, claudeObserved *model.ObservedPath
+ for i := range sk.ObservedPaths {
+ obs := &sk.ObservedPaths[i]
+ switch obs.Agent {
+ case "codex":
+ codexObserved = obs
+ case "claude-code":
+ claudeObserved = obs
+ }
+ }
+ if codexObserved == nil || claudeObserved == nil {
+ t.Fatalf("expected both codex and claude-code observed paths, got %#v", sk.ObservedPaths)
+ }
+ if !codexObserved.SharedRoot {
+ t.Fatalf("expected codex observed path to be flagged shared root: %#v", codexObserved)
+ }
+ if claudeObserved.SharedRoot {
+ t.Fatalf("expected claude-code observed path to not be flagged shared root: %#v", claudeObserved)
+ }
+
+ if !hasIssue(sk.HealthIssues, "shared_scope_root") {
+ t.Fatalf("expected shared_scope_root health issue, got %#v", sk.HealthIssues)
+ }
+ for _, issue := range sk.HealthIssues {
+ if issue.Type == "shared_scope_root" && issue.Severity != "warning" {
+ t.Fatalf("expected shared_scope_root severity warning, got %#v", issue)
+ }
+ }
+}
diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go
index feb325f..76b4298 100644
--- a/internal/tui/tui_test.go
+++ b/internal/tui/tui_test.go
@@ -3530,6 +3530,201 @@ func TestTuiEnableDisableEdgeCases(t *testing.T) {
}
}
+// TestSharedRootDisablesPerAgentEnableDisable covers alvinunreal/lazyskills#34:
+// a per-agent disable/enable preview must be refused (not silently offered)
+// when the observation it targets was reached through a symlinked, shared
+// scope root, since moving it would mutate the canonical repo other agents
+// share.
+func TestSharedRootDisablesPerAgentEnableDisable(t *testing.T) {
+ tempDir := t.TempDir()
+ skillDir := filepath.Join(tempDir, "shared-skill")
+ if err := os.MkdirAll(skillDir, 0755); err != nil {
+ t.Fatal(err)
+ }
+
+ sk := &model.Skill{
+ Name: "shared-skill",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {
+ Path: skillDir,
+ Scope: model.ScopeGlobal,
+ Agent: "codex",
+ Status: model.StatusCopy,
+ SharedRoot: true,
+ },
+ },
+ }
+
+ m := appModel{cwd: tempDir, agent: "codex"}
+ acts := m.appendEnableDisableActions(nil, sk)
+ if len(acts) != 1 || acts[0].ID != "disable_skill" || acts[0].Available {
+ t.Fatalf("expected disable action to be unavailable for a shared-root path, got: %+v", acts)
+ }
+ if !strings.Contains(acts[0].Reason, "symlinked") || !strings.Contains(acts[0].Reason, skillDir) {
+ t.Fatalf("expected shared-root reason naming the path, got %q", acts[0].Reason)
+ }
+
+ disabledPath := filepath.Join(tempDir, ".lazyskills-disabled", "shared-skill")
+ skDisabled := &model.Skill{
+ Name: "shared-skill",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {
+ Path: disabledPath,
+ TargetPath: skillDir,
+ Scope: model.ScopeGlobal,
+ Agent: "codex",
+ Status: model.StatusDisabled,
+ SharedRoot: true,
+ },
+ },
+ }
+ acts = m.appendEnableDisableActions(nil, skDisabled)
+ if len(acts) != 1 || acts[0].ID != "enable_skill" || acts[0].Available {
+ t.Fatalf("expected enable action to be unavailable for a shared-root disabled path, got: %+v", acts)
+ }
+ if !strings.Contains(acts[0].Reason, "symlinked") {
+ t.Fatalf("expected shared-root reason, got %q", acts[0].Reason)
+ }
+}
+
+// TestSharedRootGatesScopeLevelEnableDisable covers the scope-level move,
+// which touches every agent root for the skill at once: if even one of
+// those roots is shared, the whole action must be refused rather than
+// silently moving the remaining, owned subset.
+func TestSharedRootGatesScopeLevelEnableDisable(t *testing.T) {
+ tempDir := t.TempDir()
+ ownedDir := filepath.Join(tempDir, "owned-skill")
+ sharedDir := filepath.Join(tempDir, "shared-skill-root", "shared-skill")
+ if err := os.MkdirAll(ownedDir, 0755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.MkdirAll(sharedDir, 0755); err != nil {
+ t.Fatal(err)
+ }
+
+ sk := &model.Skill{
+ Name: "mixed-skill",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {Path: ownedDir, Scope: model.ScopeGlobal, Agent: "claude-code", Status: model.StatusCopy},
+ {Path: sharedDir, Scope: model.ScopeGlobal, Agent: "codex", Status: model.StatusCopy, SharedRoot: true},
+ },
+ }
+
+ m := appModel{cwd: tempDir}
+ acts := m.appendEnableDisableActions(nil, sk)
+ if len(acts) != 1 || acts[0].ID != "disable_skill" || acts[0].Available {
+ t.Fatalf("expected the whole scope-level disable to be refused when any path is shared-root, got: %+v", acts)
+ }
+ if !strings.Contains(acts[0].Reason, "symlinked") {
+ t.Fatalf("expected shared-root reason, got %q", acts[0].Reason)
+ }
+}
+
+// TestSharedRootGatesSourceEnableDisableActions covers the source-level bulk
+// disable/enable builder: any shared-root observation among the source's
+// skills must gate the whole preview unavailable.
+func TestSharedRootGatesSourceEnableDisableActions(t *testing.T) {
+ sk := &model.Skill{
+ Name: "shared-skill",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {Path: "/home/user/.codex/skills/shared-skill", Scope: model.ScopeGlobal, Agent: "codex", Status: model.StatusCopy, SharedRoot: true},
+ },
+ }
+ m := appModel{}
+ previews := m.sourceEnableDisableActions([]*model.Skill{sk})
+ var disable *actions.CommandPreview
+ for i := range previews {
+ if previews[i].ID == "disable_skill" {
+ disable = &previews[i]
+ }
+ }
+ if disable == nil || disable.Available {
+ t.Fatalf("expected disable_skill preview to be unavailable for a shared-root skill, got %+v", previews)
+ }
+ if !strings.Contains(disable.Reason, "symlinked") {
+ t.Fatalf("expected shared-root reason, got %q", disable.Reason)
+ }
+
+ skDisabled := &model.Skill{
+ Name: "shared-skill",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {
+ Path: "/home/user/.codex/skills/.lazyskills-disabled/shared-skill",
+ TargetPath: "/home/user/.codex/skills/shared-skill",
+ Scope: model.ScopeGlobal,
+ Agent: "codex",
+ Status: model.StatusDisabled,
+ SharedRoot: true,
+ },
+ },
+ }
+ previews = m.sourceEnableDisableActions([]*model.Skill{skDisabled})
+ var enable *actions.CommandPreview
+ for i := range previews {
+ if previews[i].ID == "enable_skill" {
+ enable = &previews[i]
+ }
+ }
+ if enable == nil || enable.Available {
+ t.Fatalf("expected enable_skill preview to be unavailable for a shared-root disabled skill, got %+v", previews)
+ }
+ if !strings.Contains(enable.Reason, "symlinked") {
+ t.Fatalf("expected shared-root reason, got %q", enable.Reason)
+ }
+}
+
+// TestSharedRootMoveHandlerRefusesRename is the defense-in-depth check on the
+// exec handler itself: even if a stale or forged action offers a move whose
+// src is a shared-root path, the handler must re-check m.result.Skills and
+// abort the whole plan without renaming anything.
+func TestSharedRootMoveHandlerRefusesRename(t *testing.T) {
+ tempDir := t.TempDir()
+ skillDir := filepath.Join(tempDir, "shared-skill")
+ if err := os.MkdirAll(skillDir, 0755); err != nil {
+ t.Fatal(err)
+ }
+
+ m := appModel{
+ cwd: tempDir,
+ result: model.ScanResult{
+ Skills: []*model.Skill{
+ {
+ Name: "shared-skill",
+ Scope: model.ScopeGlobal,
+ ObservedPaths: []model.ObservedPath{
+ {Path: skillDir, Scope: model.ScopeGlobal, Agent: "codex", Status: model.StatusCopy, SharedRoot: true},
+ },
+ },
+ },
+ },
+ }
+
+ action := actions.CommandPreview{
+ ID: "disable_skill",
+ Exec: actions.ExecSpec{Internal: "disable_skill", Args: []string{skillDir}},
+ }
+
+ resModel, cmd := m.executeAction(action)
+ if cmd != nil {
+ t.Fatal("expected the move to fail preflight (no cmd returned) for a shared-root path")
+ }
+ resAppModel := resModel.(appModel)
+ if resAppModel.actionResult == nil || !strings.Contains(resAppModel.actionResult.Err, "symlinked") {
+ t.Fatalf("expected actionResult to carry a shared-root refusal, got: %+v", resAppModel.actionResult)
+ }
+ if _, err := os.Stat(skillDir); err != nil {
+ t.Fatalf("expected the shared-root directory to remain untouched, got error: %v", err)
+ }
+ if _, err := os.Stat(filepath.Join(tempDir, ".lazyskills-disabled", "shared-skill")); !os.IsNotExist(err) {
+ t.Fatal("expected no disabled shelf entry to be created for the shared-root path")
+ }
+}
+
func TestTUIPreviewRenderInFlightSuppression(t *testing.T) {
m := appModel{
width: 120,
diff --git a/internal/tui/update.go b/internal/tui/update.go
index 23333b7..780492e 100644
--- a/internal/tui/update.go
+++ b/internal/tui/update.go
@@ -1425,9 +1425,27 @@ func (m appModel) executeAction(action actions.CommandPreview) (tea.Model, tea.C
}
}
+ // safety: never move a path reached through a symlinked, shared scope
+ // root. The preview builders already refuse to offer these, but this
+ // re-checks live observations from the current scan so a stale or
+ // forged action can't bypass the gate and mutate a canonical repo
+ // shared by other agents.
+ sharedRootPaths := map[string]bool{}
+ for _, sk := range m.result.Skills {
+ for _, obs := range sk.ObservedPaths {
+ if obs.SharedRoot {
+ sharedRootPaths[obs.Path] = true
+ }
+ }
+ }
+
// Preflight validation
var errs []string
for _, item := range plan {
+ if sharedRootPaths[item.src] {
+ errs = append(errs, fmt.Sprintf("path is reached through a symlinked skills root; refusing to move: %s", compat.SanitizeMetadata(item.src)))
+ continue
+ }
// Check if source exists
_, err := os.Lstat(item.src)
if err != nil {
@@ -1532,6 +1550,9 @@ func (m appModel) executeAction(action actions.CommandPreview) (tea.Model, tea.C
if op.Status != model.StatusBrokenSymlink {
continue // safety: never touch working symlinks or canonical files
}
+ if op.SharedRoot {
+ continue // safety: never delete symlinks reached through a shared scope root
+ }
info, err := os.Lstat(op.Path)
if err != nil {
if os.IsNotExist(err) {
@@ -1710,27 +1731,37 @@ func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview,
}
toggleActions := []actions.CommandPreview{}
if m.agent != "" {
- var activePaths []string
- var disabledPaths []string
+ var activeObs []model.ObservedPath
+ var disabledObs []model.ObservedPath
for _, obs := range sk.ObservedPaths {
if obs.Agent == m.agent {
if obs.Status == model.StatusDisabled {
- disabledPaths = append(disabledPaths, obs.Path, obs.TargetPath)
+ disabledObs = append(disabledObs, obs)
} else {
- activePaths = append(activePaths, obs.Path)
+ activeObs = append(activeObs, obs)
}
}
}
- if len(activePaths) > 0 {
- for _, path := range activePaths {
+ if len(activeObs) > 0 {
+ for _, obs := range activeObs {
+ path := obs.Path
sharingAgents := []string{}
for _, other := range sk.ObservedPaths {
if other.Path == path {
sharingAgents = append(sharingAgents, other.Agent)
}
}
- if len(sharingAgents) > 1 {
+ switch {
+ case obs.SharedRoot:
+ toggleActions = append(toggleActions, actions.CommandPreview{
+ ID: "disable_skill",
+ Title: fmt.Sprintf("Disable skill for agent %s", m.agentLabel()),
+ Description: "This skill cannot be disabled because its files are reached through a symlinked, shared scope root.",
+ Available: false,
+ Reason: actions.SharedRootReason(path),
+ })
+ case len(sharingAgents) > 1:
reason := fmt.Sprintf("This path is shared by multiple agents (%s). Use scope-level disable instead.", strings.Join(sharingAgents, ", "))
toggleActions = append(toggleActions, actions.CommandPreview{
ID: "disable_skill",
@@ -1739,7 +1770,7 @@ func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview,
Available: false,
Reason: reason,
})
- } else {
+ default:
toggleActions = append(toggleActions, actions.CommandPreview{
ID: "disable_skill",
Title: fmt.Sprintf("Disable skill for agent %s", m.agentLabel()),
@@ -1756,10 +1787,10 @@ func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview,
}
}
- if len(disabledPaths) > 0 {
- for i := 0; i < len(disabledPaths); i += 2 {
- src := disabledPaths[i]
- dest := disabledPaths[i+1]
+ if len(disabledObs) > 0 {
+ for _, obs := range disabledObs {
+ src := obs.Path
+ dest := obs.TargetPath
sharingAgents := []string{}
for _, other := range sk.ObservedPaths {
@@ -1768,7 +1799,16 @@ func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview,
}
}
- if len(sharingAgents) > 1 {
+ switch {
+ case obs.SharedRoot:
+ toggleActions = append(toggleActions, actions.CommandPreview{
+ ID: "enable_skill",
+ Title: fmt.Sprintf("Enable skill for agent %s", m.agentLabel()),
+ Description: "This skill cannot be enabled because its files are reached through a symlinked, shared scope root.",
+ Available: false,
+ Reason: actions.SharedRootReason(src),
+ })
+ case len(sharingAgents) > 1:
reason := fmt.Sprintf("This path is shared by multiple agents (%s). Use scope-level enable instead.", strings.Join(sharingAgents, ", "))
toggleActions = append(toggleActions, actions.CommandPreview{
ID: "enable_skill",
@@ -1777,7 +1817,7 @@ func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview,
Available: false,
Reason: reason,
})
- } else {
+ default:
toggleActions = append(toggleActions, actions.CommandPreview{
ID: "enable_skill",
Title: fmt.Sprintf("Enable skill for agent %s", m.agentLabel()),
@@ -1799,23 +1839,52 @@ func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview,
seenActive := map[string]bool{}
var disabledPaths []string
seenDisabled := map[string]bool{}
+ hasSharedActive, hasSharedDisabled := false, false
+ var sharedActivePath, sharedDisabledPath string
for _, obs := range sk.ObservedPaths {
- if obs.Scope == sk.Scope {
- if obs.Status == model.StatusDisabled {
- if !seenDisabled[obs.Path] {
- seenDisabled[obs.Path] = true
- disabledPaths = append(disabledPaths, obs.Path, obs.TargetPath)
+ if obs.Scope != sk.Scope {
+ continue
+ }
+ if obs.Status == model.StatusDisabled {
+ if obs.SharedRoot {
+ if !hasSharedDisabled {
+ hasSharedDisabled = true
+ sharedDisabledPath = obs.Path
}
- } else {
- if !seenActive[obs.Path] {
- seenActive[obs.Path] = true
- activePaths = append(activePaths, obs.Path)
+ continue
+ }
+ if !seenDisabled[obs.Path] {
+ seenDisabled[obs.Path] = true
+ disabledPaths = append(disabledPaths, obs.Path, obs.TargetPath)
+ }
+ } else {
+ if obs.SharedRoot {
+ if !hasSharedActive {
+ hasSharedActive = true
+ sharedActivePath = obs.Path
}
+ continue
+ }
+ if !seenActive[obs.Path] {
+ seenActive[obs.Path] = true
+ activePaths = append(activePaths, obs.Path)
}
}
}
- if len(activePaths) > 0 {
+ // A scope-level move touches every agent root at once; if any of
+ // them is reached through a shared scope root, refuse the whole
+ // action rather than silently moving the remaining subset.
+ switch {
+ case hasSharedActive:
+ toggleActions = append(toggleActions, actions.CommandPreview{
+ ID: "disable_skill",
+ Title: fmt.Sprintf("Disable skill (scope: %s)", sk.Scope),
+ Description: "This skill cannot be disabled across scope because one or more directories are reached through a symlinked, shared scope root.",
+ Available: false,
+ Reason: actions.SharedRootReason(sharedActivePath),
+ })
+ case len(activePaths) > 0:
toggleActions = append(toggleActions, actions.CommandPreview{
ID: "disable_skill",
Title: fmt.Sprintf("Disable skill (scope: %s)", sk.Scope),
@@ -1830,7 +1899,15 @@ func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview,
})
}
- if len(disabledPaths) > 0 {
+ if hasSharedDisabled {
+ toggleActions = append(toggleActions, actions.CommandPreview{
+ ID: "enable_skill",
+ Title: fmt.Sprintf("Enable skill (scope: %s)", sk.Scope),
+ Description: "This skill cannot be enabled across scope because one or more disabled directories are reached through a symlinked, shared scope root.",
+ Available: false,
+ Reason: actions.SharedRootReason(sharedDisabledPath),
+ })
+ } else if len(disabledPaths) > 0 {
toggleActions = append(toggleActions, actions.CommandPreview{
ID: "enable_skill",
Title: fmt.Sprintf("Enable skill (scope: %s)", sk.Scope),
@@ -1858,12 +1935,32 @@ func (m appModel) sourceEnableDisableActions(skills []*model.Skill) []actions.Co
var disabledPaths []string
seenDisabled := map[string]bool{}
sharedActive, sharedDisabled := map[string][]string{}, map[string][]string{}
+ hasSharedRootActive, hasSharedRootDisabled := false, false
+ var sharedRootActivePath, sharedRootDisabledPath string
for _, sk := range skills {
for _, obs := range sk.ObservedPaths {
if m.agent != "" && obs.Agent != m.agent {
continue
}
+ // A path reached through a shared scope root is never eligible
+ // for a source-level move, regardless of scope/agent filtering;
+ // track it so the whole preview below is refused rather than
+ // silently moving the remaining subset.
+ if obs.SharedRoot {
+ if obs.Status == model.StatusDisabled {
+ if !hasSharedRootDisabled {
+ hasSharedRootDisabled = true
+ sharedRootDisabledPath = obs.Path
+ }
+ } else {
+ if !hasSharedRootActive {
+ hasSharedRootActive = true
+ sharedRootActivePath = obs.Path
+ }
+ }
+ continue
+ }
if m.agent != "" {
sharing := sharingAgentsForPath(sk, obs.Path)
if len(sharing) > 1 {
@@ -1891,7 +1988,14 @@ func (m appModel) sourceEnableDisableActions(skills []*model.Skill) []actions.Co
}
var out []actions.CommandPreview
- if len(activePaths) > 0 {
+ switch {
+ case hasSharedRootActive:
+ title := "Disable source skills"
+ if m.agent != "" {
+ title = fmt.Sprintf("Disable source skills for agent %s", m.agentLabel())
+ }
+ out = append(out, actions.CommandPreview{ID: "disable_skill", Title: title, Description: "This source cannot be disabled because one or more directories are reached through a symlinked, shared scope root.", Available: false, Reason: actions.SharedRootReason(sharedRootActivePath)})
+ case len(activePaths) > 0:
title := "Disable source skills"
desc := "Disable all enabled skills in this source."
cmd := "disable source skills"
@@ -1901,11 +2005,18 @@ func (m appModel) sourceEnableDisableActions(skills []*model.Skill) []actions.Co
cmd = "disable source skills for agent " + m.agentLabel()
}
out = append(out, actions.CommandPreview{ID: "disable_skill", Title: title, Description: desc, Command: cmd, Exec: actions.ExecSpec{Internal: "disable_skill", Args: activePaths}, Mutates: true, Available: true})
- } else if len(sharedActive) > 0 {
+ case len(sharedActive) > 0:
out = append(out, actions.CommandPreview{ID: "disable_skill", Title: fmt.Sprintf("Disable source skills for agent %s", m.agentLabel()), Description: "This source cannot be disabled for a single agent because one or more directories are shared.", Available: false, Reason: sharedSourceReason(sharedActive, "disable")})
}
- if len(disabledPaths) > 0 {
+ switch {
+ case hasSharedRootDisabled:
+ title := "Enable source skills"
+ if m.agent != "" {
+ title = fmt.Sprintf("Enable source skills for agent %s", m.agentLabel())
+ }
+ out = append(out, actions.CommandPreview{ID: "enable_skill", Title: title, Description: "This source cannot be enabled because one or more disabled directories are reached through a symlinked, shared scope root.", Available: false, Reason: actions.SharedRootReason(sharedRootDisabledPath)})
+ case len(disabledPaths) > 0:
title := "Enable source skills"
desc := "Enable all disabled skills in this source."
cmd := "enable source skills"
@@ -1915,7 +2026,7 @@ func (m appModel) sourceEnableDisableActions(skills []*model.Skill) []actions.Co
cmd = "enable source skills for agent " + m.agentLabel()
}
out = append(out, actions.CommandPreview{ID: "enable_skill", Title: title, Description: desc, Command: cmd, Exec: actions.ExecSpec{Internal: "enable_skill", Args: disabledPaths}, Mutates: true, Available: true})
- } else if len(sharedDisabled) > 0 {
+ case len(sharedDisabled) > 0:
out = append(out, actions.CommandPreview{ID: "enable_skill", Title: fmt.Sprintf("Enable source skills for agent %s", m.agentLabel()), Description: "This source cannot be enabled for a single agent because one or more disabled directories are shared.", Available: false, Reason: sharedSourceReason(sharedDisabled, "enable")})
}