mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
fix(tui): target broken symlinks by scope
Alvin Unreal5037fd07e0f3
diff --git a/internal/actions/actions.go b/internal/actions/actions.goindex 7facf1c..c6f5266 100644--- a/internal/actions/actions.go+++ b/internal/actions/actions.go@@ -275,7 +275,7 @@ func deleteBrokenSymlinkPreview(sk *model.Skill) CommandPreview {Title: "Delete broken symlink(s)",Description: "Delete the broken/dangling symlink file(s) for this skill.",Command: "delete broken symlinks for " + compat.SanitizeMetadata(sk.Name),- Exec: ExecSpec{Internal: "delete_broken_symlink"},+ Exec: ExecSpec{Internal: "delete_broken_symlink", Args: []string{string(sk.Scope), sk.Name}},Mutates: true,RequiresConfirm: true,Dangerous: true,diff --git a/internal/actions/actions_test.go b/internal/actions/actions_test.goindex 3e23dfe..2547269 100644--- a/internal/actions/actions_test.go+++ b/internal/actions/actions_test.go@@ -69,6 +69,9 @@ func TestDeleteBrokenSymlinkAction(t *testing.T) {if deleteAct.ConfirmValue != "broken-skill" || deleteAct.Exec.Internal != "delete_broken_symlink" {t.Fatalf("unexpected delete preview: %+v", *deleteAct)}+ if len(deleteAct.Exec.Args) != 2 || deleteAct.Exec.Args[0] != string(model.ScopeProject) || deleteAct.Exec.Args[1] != "broken-skill" {+ t.Fatalf("expected scoped delete args, got %+v", deleteAct.Exec.Args)+ }if !strings.Contains(deleteAct.Title, "broken symlink") {t.Fatalf("expected title to mention broken symlinks, got %q", deleteAct.Title)}diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.goindex 03b871e..c45d793 100644--- a/internal/tui/tui_test.go+++ b/internal/tui/tui_test.go@@ -592,28 +592,23 @@ func TestDeleteBrokenSymlinkPartialFailureRescans(t *testing.T) {if err := os.Symlink(filepath.Join(cwd, "missing-good"), goodLink); err != nil {t.Fatal(err)}- lockedDir := filepath.Join(cwd, "locked")- if err := os.Mkdir(lockedDir, 0o755); err != nil {+ badPath := filepath.Join(cwd, "not-a-symlink-dir")+ if err := os.Mkdir(badPath, 0o755); err != nil {t.Fatal(err)}- badLink := filepath.Join(lockedDir, "bad-broken")- if err := os.Symlink(filepath.Join(cwd, "missing-bad"), badLink); err != nil {+ if err := os.WriteFile(filepath.Join(badPath, "child"), []byte("x"), 0o644); err != nil {t.Fatal(err)}- if err := os.Chmod(lockedDir, 0o555); err != nil {- t.Fatal(err)- }- t.Cleanup(func() { _ = os.Chmod(lockedDir, 0o755) })m := appModel{cwd: cwd, width: 120, height: 32, selected: 1, result: model.ScanResult{Skills: []*model.Skill{{Name: "Broken",Scope: model.ScopeProject,ObservedPaths: []model.ObservedPath{{Path: goodLink, Status: model.StatusBrokenSymlink},- {Path: badLink, Status: model.StatusBrokenSymlink},+ {Path: badPath, Status: model.StatusBrokenSymlink},},}}}}- action := actions.CommandPreview{ID: "delete_broken_symlink", ConfirmValue: "Broken", Exec: actions.ExecSpec{Internal: "delete_broken_symlink"}}+ action := actions.CommandPreview{ID: "delete_broken_symlink", ConfirmValue: "Broken", Exec: actions.ExecSpec{Internal: "delete_broken_symlink", Args: []string{string(model.ScopeProject), "Broken"}}}updated, cmd := m.executeAction(action)next := updated.(appModel)@@ -626,8 +621,8 @@ func TestDeleteBrokenSymlinkPartialFailureRescans(t *testing.T) {if _, err := os.Lstat(goodLink); !os.IsNotExist(err) {t.Fatalf("expected removable broken symlink to be deleted, lstat err=%v", err)}- if _, err := os.Lstat(badLink); err != nil {- t.Fatalf("expected failed broken symlink to remain, lstat err=%v", err)+ if info, err := os.Lstat(badPath); err != nil || !info.IsDir() {+ t.Fatalf("expected failed path to remain as directory, info=%v err=%v", info, err)}}diff --git a/internal/tui/update.go b/internal/tui/update.goindex 18300de..1e435f4 100644--- a/internal/tui/update.go+++ b/internal/tui/update.go@@ -1140,10 +1140,16 @@ func (m appModel) executeAction(action actions.CommandPreview) (tea.Model, tea.Cm.confirming = falsem.confirmInput = ""m.confirmError = ""+ targetScope := ""+ targetName := action.ConfirmValue+ if len(action.Exec.Args) >= 2 {+ targetScope = action.Exec.Args[0]+ targetName = action.Exec.Args[1]+ }removed, failed := 0, 0firstErr := ""for _, sk := range m.result.Skills {- if sk.Name != action.ConfirmValue {+ if sk.Name != targetName || (targetScope != "" && string(sk.Scope) != targetScope) {continue}for _, op := range sk.ObservedPaths {