mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
Fix disabled symlink scan health
alvinrealffad5b5e147e
diff --git a/internal/scan/scan.go b/internal/scan/scan.goindex fb3ffad..4c2a84b 100644--- a/internal/scan/scan.go+++ b/internal/scan/scan.go@@ -254,15 +254,14 @@ func scanDisabledLocation(loc agents.Location, skills map[string]*model.Skill) {if info.Mode()&os.ModeSymlink != 0 {target, _ := os.Readlink(path)if !filepath.IsAbs(target) {- target = filepath.Join(filepath.Dir(path), target)+ target = filepath.Join(loc.Root, target)}- if st, err := os.Stat(path); err != nil || !st.IsDir() {+ if st, err := os.Stat(target); err != nil || !st.IsDir() {sk := ensureSkill(skills, loc.Scope, entry.Name(), entry.Name(), "")addObservedPath(sk, observed)- sk.AddHealthIssue(model.HealthIssue{Type: "broken_symlink", Severity: "error", Message: "disabled skill path is a broken symlink", Path: path})continue}- parseDir = path+ parseDir = target} else if !info.IsDir() {continue}diff --git a/internal/scan/scan_test.go b/internal/scan/scan_test.goindex 7f2b200..572253b 100644--- a/internal/scan/scan_test.go+++ b/internal/scan/scan_test.go@@ -576,3 +576,50 @@ func TestScanDisabledSkills(t *testing.T) {t.Fatal("expected to find disabled skill 'Review'")}}++func TestScanDisabledRelativeSymlinkDoesNotReportBroken(t *testing.T) {+ home := withHome(t)+ cwd := t.TempDir()++ targetDir := filepath.Join(home, "source-skills", "cloudflare")+ writeSkill(t, targetDir, "Cloudflare", "Cloudflare skills")++ disabledRoot := filepath.Join(home, ".claude", "skills", ".lazyskills-disabled")+ if err := os.MkdirAll(disabledRoot, 0o755); err != nil {+ t.Fatal(err)+ }+ // This is the kind of relative symlink that works from ~/.claude/skills,+ // but becomes broken according to the OS after it is moved into the disabled+ // shelf. Disabled scans should resolve it relative to the active root and not+ // report a false broken_symlink health issue.+ if err := os.Symlink(filepath.Join("..", "..", "source-skills", "cloudflare"), filepath.Join(disabledRoot, "cloudflare")); err != nil {+ t.Fatal(err)+ }++ res, err := Run(cwd)+ if err != nil {+ t.Fatal(err)+ }++ var found *model.Skill+ for _, sk := range res.Skills {+ if sk.Name == "Cloudflare" {+ found = sk+ break+ }+ }+ if found == nil {+ t.Fatal("expected to find disabled symlink skill 'Cloudflare'")+ }+ if !found.Disabled {+ t.Fatalf("expected Cloudflare skill to be disabled, got %#v", found)+ }+ for _, issue := range found.HealthIssues {+ if issue.Type == "broken_symlink" {+ t.Fatalf("disabled symlink should not report broken_symlink: %#v", issue)+ }+ }+ if found.Preview == "" {+ t.Fatal("expected disabled symlink target preview to be parsed")+ }+}