mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
Implement enable/disable skill actions in TUI
alvinrealc62a015404e8
diff --git a/internal/display/display.go b/internal/display/display.goindex 844e3b1..120f68c 100644--- a/internal/display/display.go+++ b/internal/display/display.go@@ -20,6 +20,7 @@ type SkillView struct {GlobalLock *compat.GlobalLockDisplayHealthIssues []HealthIssueViewPreview string+ Disabled bool}type ObservedPathView struct {@@ -56,6 +57,7 @@ func Skill(sk *model.Skill) SkillView {Scope: compat.SanitizeMetadata(string(sk.Scope)),CanonicalPath: compat.SanitizeMetadata(sk.CanonicalPath),SkillPath: compat.SanitizeMetadata(sk.SkillPath),+ Disabled: sk.Disabled,}for _, p := range sk.ObservedPaths {view.Observed = append(view.Observed, ObservedPathView{diff --git a/internal/model/model.go b/internal/model/model.goindex 835dc1a..bea8128 100644--- a/internal/model/model.go+++ b/internal/model/model.go@@ -16,6 +16,7 @@ const (StatusSymlink Status = "symlink"StatusCopy Status = "copy"StatusBrokenSymlink Status = "broken_symlink"+ StatusDisabled Status = "disabled")// ObservedPath represents one location on disk where this skill was found.@@ -116,6 +117,7 @@ type Skill struct {LocalLock *LocalLockEntry `json:"local_lock,omitempty"`GlobalLock *GlobalLockEntry `json:"global_lock,omitempty"`HealthIssues []HealthIssue `json:"health_issues"`+ Disabled bool `json:"disabled"`}// ToolStatus represents the location and status of a development tool.diff --git a/internal/scan/scan.go b/internal/scan/scan.goindex 92c5628..ada290a 100644--- a/internal/scan/scan.go+++ b/internal/scan/scan.go@@ -73,6 +73,7 @@ func Run(cwd string) (model.ScanResult, error) {for _, loc := range agents.Locations(absCwd) {scanLocation(loc, skills)+ scanDisabledLocation(loc, skills)}correlateLocks(skills, localLock.Skills, globalLock.Skills)@@ -107,6 +108,18 @@ func Run(cwd string) (model.ScanResult, error) {}}sk.Visibility = skillVisibility(sk, res.Agents)++ hasActive := false+ hasDisabled := false+ for _, obs := range sk.ObservedPaths {+ if obs.Status == model.StatusDisabled {+ hasDisabled = true+ } else {+ hasActive = true+ }+ }+ sk.Disabled = hasDisabled && !hasActive+res.Skills = append(res.Skills, sk)}sort.Slice(res.Skills, func(i, j int) bool {@@ -121,7 +134,7 @@ func Run(cwd string) (model.ScanResult, error) {func hasNonCanonicalObservation(sk *model.Skill) bool {for _, observed := range sk.ObservedPaths {- if observed.Status != model.StatusCanonical {+ if observed.Status != model.StatusCanonical && observed.Status != model.StatusDisabled {return true}}@@ -163,7 +176,7 @@ func skillVisibility(sk *model.Skill, states []model.AgentState) []model.SkillVifor _, state := range states {item := model.SkillVisibility{Agent: state.Name, Display: state.Display}if observed, ok := observedForAgent(sk, state.Name); ok {- item.Visible = observed.Status != model.StatusBrokenSymlink+ item.Visible = observed.Status != model.StatusBrokenSymlink && observed.Status != model.StatusDisableditem.Path = observed.Pathitem.Status = observed.Statusswitch observed.Status {@@ -179,6 +192,8 @@ func skillVisibility(sk *model.Skill, states []model.AgentState) []model.SkillViitem.Reason = "visible_via_copy"case model.StatusBrokenSymlink:item.Reason = "broken_symlink"+ case model.StatusDisabled:+ item.Reason = "disabled"default:item.Reason = "visible"}@@ -211,6 +226,69 @@ func observedForAgent(sk *model.Skill, agent string) (model.ObservedPath, bool)return model.ObservedPath{}, false}+func scanDisabledLocation(loc agents.Location, skills map[string]*model.Skill) {+ disabledRoot := filepath.Join(loc.Root, ".lazyskills-disabled")+ entries, err := os.ReadDir(disabledRoot)+ if err != nil {+ return+ }+ for _, entry := range entries {+ if strings.HasPrefix(entry.Name(), ".") {+ continue+ }+ path := filepath.Join(disabledRoot, entry.Name())+ info, err := os.Lstat(path)+ if err != nil {+ continue+ }+ observed := model.ObservedPath{+ Path: path,+ Scope: loc.Scope,+ Agent: loc.AgentName,+ Status: model.StatusDisabled,+ TargetPath: filepath.Join(loc.Root, entry.Name()),+ }+ parseDir := path+ if info.Mode()&os.ModeSymlink != 0 {+ target, _ := os.Readlink(path)+ if !filepath.IsAbs(target) {+ target = filepath.Join(filepath.Dir(path), target)+ }+ if st, err := os.Stat(path); 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+ } else if !info.IsDir() {+ continue+ }++ skillFile := filepath.Join(parseDir, "SKILL.md")+ doc, err := frontmatter.ParseFile(skillFile)+ if err != nil {+ sk := ensureSkill(skills, loc.Scope, entry.Name(), entry.Name(), "")+ addObservedPath(sk, observed)+ issueType := "invalid_frontmatter"+ if errors.Is(err, os.ErrNotExist) {+ issueType = "missing_skill_md"+ }+ sk.AddHealthIssue(model.HealthIssue{Type: issueType, Severity: "error", Message: fmt.Sprintf("invalid SKILL.md in disabled shelf: %v", err), Path: skillFile})+ continue+ }++ sk := ensureSkill(skills, loc.Scope, entry.Name(), doc.Name, doc.Description)+ if sk.SkillPath == "" {+ sk.SkillPath = skillFile+ }+ if sk.Preview == "" {+ sk.Preview = doc.Raw+ }+ addObservedPath(sk, observed)+ }+}+func scanLocation(loc agents.Location, skills map[string]*model.Skill) {entries, err := os.ReadDir(loc.Root)if err != nil {diff --git a/internal/scan/scan_test.go b/internal/scan/scan_test.goindex 1082248..7f2b200 100644--- a/internal/scan/scan_test.go+++ b/internal/scan/scan_test.go@@ -536,3 +536,43 @@ func TestPreflightChecking(t *testing.T) {t.Error("expected CanRunSkills to be false when npx exists but node is missing")}}++func TestScanDisabledSkills(t *testing.T) {+ withHome(t)+ cwd := t.TempDir()++ // 1. Create a disabled skill inside project-local aider-desk agent root+ disabledDir := filepath.Join(cwd, ".aider-desk", "skills", ".lazyskills-disabled", "review")+ writeSkill(t, disabledDir, "Review", "Review code")++ // Run scan+ res, err := Run(cwd)+ if err != nil {+ t.Fatal(err)+ }++ // Verify we found the disabled skill+ found := false+ for _, sk := range res.Skills {+ if sk.Name == "Review" {+ found = true+ if !sk.Disabled {+ t.Errorf("expected skill 'Review' to be disabled, got %#v", sk)+ }+ if len(sk.ObservedPaths) != 1 {+ t.Fatalf("expected 1 observed path, got %d", len(sk.ObservedPaths))+ }+ obs := sk.ObservedPaths[0]+ if obs.Status != model.StatusDisabled {+ t.Errorf("expected status 'disabled', got %s", obs.Status)+ }+ expectedTarget := filepath.Join(cwd, ".aider-desk", "skills", "review")+ if obs.TargetPath != expectedTarget {+ t.Errorf("expected target path %q, got %q", expectedTarget, obs.TargetPath)+ }+ }+ }+ if !found {+ t.Fatal("expected to find disabled skill 'Review'")+ }+}diff --git a/internal/tui/state.go b/internal/tui/state.goindex fac0195..6af488f 100644--- a/internal/tui/state.go+++ b/internal/tui/state.go@@ -232,18 +232,41 @@ func (m *appModel) selectCurrentSourceGroup() {if group == "" {return}- if m.selectedKeys == nil {- m.selectedKeys = map[string]bool{}- }- changed := false+ var groupSkills []*model.Skillitems := m.filteredSkills()for _, skill := range items {if listGroupLabel(skill) == group {- m.selectedKeys[skillKey(skill)] = true- changed = true+ groupSkills = append(groupSkills, skill)+ }+ }+ if len(groupSkills) == 0 {+ return+ }++ allSelected := true+ for _, skill := range groupSkills {+ if !m.isSelected(skill) {+ allSelected = false+ break}}- if !changed && len(m.selectedKeys) == 0 {+ if allSelected {+ for _, skill := range groupSkills {+ delete(m.selectedKeys, skillKey(skill))+ }+ if len(m.selectedKeys) == 0 {+ m.selectedKeys = nil+ }+ return+ }++ if m.selectedKeys == nil {+ m.selectedKeys = map[string]bool{}+ }+ for _, skill := range groupSkills {+ m.selectedKeys[skillKey(skill)] = true+ }+ if len(m.selectedKeys) == 0 {m.selectedKeys = nil}}@@ -331,6 +354,7 @@ func (m appModel) sourceActions(group string) []actions.CommandPreview {previews[i].ConfirmValue = group}}+ previews = append(m.sourceEnableDisableActions(skills), previews...)discoverable, reason := m.isSourceDiscoverable(group)diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.goindex 4842705..fd1799c 100644--- a/internal/tui/tui_test.go+++ b/internal/tui/tui_test.go@@ -646,6 +646,11 @@ func TestSourceMarkSelectsCurrentSource(t *testing.T) {if next.selectedCount() != 4 || !next.isSelected(next.result.Skills[0]) || !next.isSelected(next.result.Skills[1]) || !next.isSelected(next.result.Skills[2]) || !next.isSelected(next.result.Skills[3]) || next.isSelected(next.result.Skills[4]) {t.Fatalf("expected source mark to select all skills from owner/repo only, selected=%#v", next.selectedKeys)}+ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'s'}})+ next = updated.(appModel)+ if next.selectedCount() != 0 {+ t.Fatalf("expected second source mark to unselect marked source skills, selected=%#v", next.selectedKeys)+ }}func TestSourceMarkOnlySelectsFilteredSkills(t *testing.T) {@@ -1606,14 +1611,14 @@ func TestContextualFooterAndHelpModal(t *testing.T) {// 1. Default footer (Skills focused)outDefault := m.View()- if !strings.Contains(outDefault, "enter open · c skill actions") {+ if !strings.Contains(outDefault, "enter open · e enable/disable · c actions") {t.Fatalf("expected default footer in View, got:\n%s", outDefault)}// 1b. Source row selected footerm.selected = 0outHeaderFooter := m.View()- if !strings.Contains(outHeaderFooter, "enter browse · d scan · c source actions") {+ if !strings.Contains(outHeaderFooter, "enter browse · e enable/disable source") {t.Fatalf("expected source group footer in View, got:\n%s", outHeaderFooter)}m.selected = 1@@ -2624,3 +2629,171 @@ func TestModalCommandPickerUXWithBulkSelection(t *testing.T) {t.Fatal("expected remove action to trigger confirmation overlay")}}++func TestTuiEnableDisableActions(t *testing.T) {+ tempDir := t.TempDir()+ skillDir := filepath.Join(tempDir, "my-skill")+ if err := os.MkdirAll(skillDir, 0755); err != nil {+ t.Fatal(err)+ }+ skillFile := filepath.Join(skillDir, "SKILL.md")+ if err := os.WriteFile(skillFile, []byte("---\nname: my-skill\n---\n"), 0644); err != nil {+ t.Fatal(err)+ }++ sk := &model.Skill{+ Name: "my-skill",+ Scope: model.ScopeProject,+ ObservedPaths: []model.ObservedPath{+ {+ Path: skillDir,+ Scope: model.ScopeProject,+ Agent: "aider-desk",+ Status: model.StatusCopy,+ },+ },+ }++ m := appModel{+ cwd: tempDir,+ agent: "aider-desk",+ }++ acts := m.appendEnableDisableActions(nil, sk)+ if len(acts) != 1 || acts[0].ID != "disable_skill" {+ t.Fatalf("expected 1 disable action, got %+v", acts)+ }+ disableAction := acts[0]++ _, cmd := m.executeAction(disableAction)+ if cmd == nil {+ t.Fatal("expected loadSnapshot cmd to be returned on success")+ }++ disabledPath := filepath.Join(tempDir, ".lazyskills-disabled", "my-skill")+ if _, err := os.Stat(disabledPath); err != nil {+ t.Fatalf("expected disabled folder to exist at %s, got error: %v", disabledPath, err)+ }+ if _, err := os.Stat(skillDir); !os.IsNotExist(err) {+ t.Fatalf("expected active folder at %s to be gone, got error: %v", skillDir, err)+ }++ sk.ObservedPaths[0].Status = model.StatusDisabled+ sk.ObservedPaths[0].Path = disabledPath+ sk.ObservedPaths[0].TargetPath = skillDir++ acts = m.appendEnableDisableActions(nil, sk)+ if len(acts) != 1 || acts[0].ID != "enable_skill" {+ t.Fatalf("expected 1 enable action, got %+v", acts)+ }+ enableAction := acts[0]++ _, cmd = m.executeAction(enableAction)+ if cmd == nil {+ t.Fatal("expected loadSnapshot cmd to be returned on success")+ }++ if _, err := os.Stat(skillDir); err != nil {+ t.Fatalf("expected active folder to exist at %s, got error: %v", skillDir, err)+ }+ if _, err := os.Stat(disabledPath); !os.IsNotExist(err) {+ t.Fatalf("expected disabled folder at %s to be gone, got error: %v", disabledPath, err)+ }+}++func TestTuiEnableDisableEdgeCases(t *testing.T) {+ tempDir := t.TempDir()+ skillDir := filepath.Join(tempDir, "my-skill")+ if err := os.MkdirAll(skillDir, 0755); err != nil {+ t.Fatal(err)+ }++ sk := &model.Skill{+ Name: "my-skill",+ Scope: model.ScopeProject,+ ObservedPaths: []model.ObservedPath{+ {+ Path: skillDir,+ Scope: model.ScopeProject,+ Agent: "aider-desk",+ Status: model.StatusCopy,+ },+ {+ Path: skillDir,+ Scope: model.ScopeProject,+ Agent: "amp",+ Status: model.StatusCopy,+ },+ },+ }++ // 1. Guard check: per-agent disable blocked when path is shared by multiple agents+ m := appModel{+ cwd: tempDir,+ agent: "aider-desk",+ }+ 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 shared path, got: %+v", acts)+ }+ if !strings.Contains(acts[0].Reason, "shared by multiple agents") {+ t.Fatalf("expected shared reason, got %q", acts[0].Reason)+ }++ // 2. Guard check: per-agent enable blocked when disabled path is shared by multiple agents+ disabledPath := filepath.Join(tempDir, ".lazyskills-disabled", "my-skill")+ skDisabled := &model.Skill{+ Name: "my-skill",+ Scope: model.ScopeProject,+ ObservedPaths: []model.ObservedPath{+ {+ Path: disabledPath,+ TargetPath: skillDir,+ Scope: model.ScopeProject,+ Agent: "aider-desk",+ Status: model.StatusDisabled,+ },+ {+ Path: disabledPath,+ TargetPath: skillDir,+ Scope: model.ScopeProject,+ Agent: "amp",+ Status: model.StatusDisabled,+ },+ },+ }+ 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 shared path, got: %+v", acts)+ }+ if !strings.Contains(acts[0].Reason, "shared by multiple agents") {+ t.Fatalf("expected shared reason, got %q", acts[0].Reason)+ }++ // 3. Deduplication check: scope-level disable has no duplicates in Args+ mNoAgent := appModel{+ cwd: tempDir,+ }+ acts = mNoAgent.appendEnableDisableActions(nil, sk)+ if len(acts) != 1 || acts[0].ID != "disable_skill" {+ t.Fatalf("expected 1 scope disable action, got %+v", acts)+ }+ if len(acts[0].Exec.Args) != 1 {+ t.Fatalf("expected deduplicated args, got %+v", acts[0].Exec.Args)+ }++ // 4. Preflight validate dest already exists+ destDir := filepath.Join(tempDir, ".lazyskills-disabled", "my-skill")+ if err := os.MkdirAll(destDir, 0755); err != nil {+ t.Fatal(err)+ }+ disableAction := acts[0]+ resModel, cmd := mNoAgent.executeAction(disableAction)+ if cmd != nil {+ t.Fatal("expected action to fail preflight (no cmd returned) when dest exists")+ }+ resAppModel := resModel.(appModel)+ if resAppModel.actionResult == nil || !strings.Contains(resAppModel.actionResult.Err, "destination already exists") {+ t.Fatalf("expected actionResult to carry destination already exists error, got: %+v", resAppModel.actionResult)+ }+}diff --git a/internal/tui/update.go b/internal/tui/update.goindex 0a22571..2cb5242 100644--- a/internal/tui/update.go+++ b/internal/tui/update.go@@ -2,7 +2,9 @@ package tuiimport ("fmt"+ "os""os/exec"+ "path/filepath""strings""time"@@ -297,6 +299,8 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {return m.startAction()case "o":return m.startActionByID("open_skill")+ case "e":+ return m.startToggleAction()case "u":actionID := preferredUpdateActionID(m.selectedCount())if m.modalSource != "" {@@ -385,6 +389,11 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {if len(rows) > 0 && m.selected < len(rows) && !rows[m.selected].isHeader {return m.startCurrentSkillActionByID("open_skill")}+ case "e":+ rows := m.visibleRows()+ if len(rows) > 0 && m.selected < len(rows) {+ return m.startToggleAction()+ }case "u":rows := m.visibleRows()if len(rows) > 0 && m.selected < len(rows) && !rows[m.selected].isHeader {@@ -578,7 +587,7 @@ func (m appModel) currentActions() []actions.CommandPreview {if child.isAvailable {return actions.ForAvailableSkill(m.modalSource, child.discoveredSkill.Name)}- return actions.ForSkill(child.skill)+ return m.appendEnableDisableActions(actions.ForSkill(child.skill), child.skill)}}selected := m.selectedSkills()@@ -593,7 +602,7 @@ func (m appModel) currentActions() []actions.CommandPreview {if row.isHeader {return m.sourceActions(row.groupName)}- return actions.ForSkill(row.skill)+ return m.appendEnableDisableActions(actions.ForSkill(row.skill), row.skill)}func (m appModel) startAction() (tea.Model, tea.Cmd) {@@ -630,6 +639,17 @@ func (m appModel) startActionByID(id string) (tea.Model, tea.Cmd) {return m, nil}+func (m appModel) startToggleAction() (tea.Model, tea.Cmd) {+ for i, action := range m.currentActions() {+ if (action.ID == "enable_skill" || action.ID == "disable_skill") && action.Available {+ m.action = i+ m.commands = false+ return m.startAction()+ }+ }+ return m, nil+}+func (m appModel) startSkillActionByID(sk *model.Skill, id string) (tea.Model, tea.Cmd) {for _, action := range actions.ForSkill(sk) {if action.ID == id {@@ -763,6 +783,104 @@ func (m appModel) executeAction(action actions.CommandPreview) (tea.Model, tea.Cm.actionResult = nilreturn m.startDiscovery(action.ConfirmValue, true)}+ if action.Exec.Internal == "enable_skill" || action.Exec.Internal == "disable_skill" {+ m.commands = false+ m.confirming = false+ m.confirmInput = ""+ m.confirmError = ""+ m.actionResult = nil++ type moveItem struct {+ src, dest string+ }+ var plan []moveItem+ seenSrc := map[string]bool{}++ if action.Exec.Internal == "disable_skill" {+ for _, path := range action.Exec.Args {+ src := path+ dest := filepath.Join(filepath.Dir(src), ".lazyskills-disabled", filepath.Base(src))+ if !seenSrc[src] {+ seenSrc[src] = true+ plan = append(plan, moveItem{src: src, dest: dest})+ }+ }+ } else { // enable_skill+ for i := 0; i < len(action.Exec.Args); i += 2 {+ if i+1 >= len(action.Exec.Args) {+ break+ }+ src := action.Exec.Args[i]+ dest := action.Exec.Args[i+1]+ if !seenSrc[src] {+ seenSrc[src] = true+ plan = append(plan, moveItem{src: src, dest: dest})+ }+ }+ }++ // Preflight validation+ var errs []string+ for _, item := range plan {+ // Check if source exists+ _, err := os.Lstat(item.src)+ if err != nil {+ errs = append(errs, fmt.Sprintf("source path does not exist: %s", item.src))+ continue+ }++ // Destination must not exist+ if _, err := os.Lstat(item.dest); err == nil || !os.IsNotExist(err) {+ errs = append(errs, fmt.Sprintf("destination already exists: %s", item.dest))+ continue+ }++ // Parent directory check+ parent := filepath.Dir(item.dest)+ parentInfo, err := os.Stat(parent)+ if err == nil {+ if !parentInfo.IsDir() {+ errs = append(errs, fmt.Sprintf("parent of destination is not a directory: %s", parent))+ }+ } else if !os.IsNotExist(err) {+ errs = append(errs, fmt.Sprintf("failed to check parent directory %s: %v", parent, err))+ }+ }++ succeededMoves := 0+ if len(errs) == 0 {+ // Execution+ for _, item := range plan {+ parent := filepath.Dir(item.dest)+ if err := os.MkdirAll(parent, 0755); err != nil {+ errs = append(errs, fmt.Sprintf("failed to create directory %s: %v", parent, err))+ break+ }+ if err := os.Rename(item.src, item.dest); err != nil {+ errs = append(errs, fmt.Sprintf("failed to move %s to %s: %v", item.src, item.dest, err))+ break+ }+ succeededMoves+++ }+ }++ if len(errs) > 0 {+ m.actionResult = &runner.Result{+ Program: action.Exec.Internal,+ Args: action.Exec.Args,+ ExitCode: -1,+ Err: compat.SanitizeMetadata(strings.Join(errs, "; ")),+ }+ m.syncViewport()+ if succeededMoves > 0 {+ return m, loadSnapshot(m.cwd)+ }+ return m, nil+ }++ // Success: rescan+ return m, loadSnapshot(m.cwd)+ }if action.Exec.Internal == "prune_project_lock" || action.Exec.Internal == "prune_global_lock" {m.commands = falsem.confirming = false@@ -873,3 +991,256 @@ func (m appModel) runBatch(batch []actions.ExecSpec) (runner.Result, bool) {}return runner.Result{Program: "bulk", Cwd: m.cwd, ExitCode: 0, Stdout: strings.Join(lines, "\n")}, false}++func (m appModel) appendEnableDisableActions(previews []actions.CommandPreview, sk *model.Skill) []actions.CommandPreview {+ if sk == nil {+ return previews+ }+ toggleActions := []actions.CommandPreview{}+ if m.agent != "" {+ var activePaths []string+ var disabledPaths []string+ for _, obs := range sk.ObservedPaths {+ if obs.Agent == m.agent {+ if obs.Status == model.StatusDisabled {+ disabledPaths = append(disabledPaths, obs.Path, obs.TargetPath)+ } else {+ activePaths = append(activePaths, obs.Path)+ }+ }+ }++ if len(activePaths) > 0 {+ for _, path := range activePaths {+ sharingAgents := []string{}+ for _, other := range sk.ObservedPaths {+ if other.Path == path {+ sharingAgents = append(sharingAgents, other.Agent)+ }+ }+ if 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",+ Title: fmt.Sprintf("Disable skill for agent %s", m.agentLabel()),+ Description: "This skill cannot be disabled for a single agent because the root directory is shared.",+ Available: false,+ Reason: reason,+ })+ } else {+ toggleActions = append(toggleActions, actions.CommandPreview{+ ID: "disable_skill",+ Title: fmt.Sprintf("Disable skill for agent %s", m.agentLabel()),+ Description: fmt.Sprintf("Disable this skill for %s by moving it to the disabled shelf.", m.agentLabel()),+ Command: "disable skill for agent " + m.agentLabel(),+ Exec: actions.ExecSpec{+ Internal: "disable_skill",+ Args: []string{path},+ },+ Mutates: true,+ Available: true,+ })+ }+ }+ }++ if len(disabledPaths) > 0 {+ for i := 0; i < len(disabledPaths); i += 2 {+ src := disabledPaths[i]+ dest := disabledPaths[i+1]++ sharingAgents := []string{}+ for _, other := range sk.ObservedPaths {+ if other.Path == src {+ sharingAgents = append(sharingAgents, other.Agent)+ }+ }++ if 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",+ Title: fmt.Sprintf("Enable skill for agent %s", m.agentLabel()),+ Description: "This skill cannot be enabled for a single agent because the disabled directory is shared.",+ Available: false,+ Reason: reason,+ })+ } else {+ toggleActions = append(toggleActions, actions.CommandPreview{+ ID: "enable_skill",+ Title: fmt.Sprintf("Enable skill for agent %s", m.agentLabel()),+ Description: fmt.Sprintf("Enable this skill for %s by moving it back from the disabled shelf.", m.agentLabel()),+ Command: "enable skill for agent " + m.agentLabel(),+ Exec: actions.ExecSpec{+ Internal: "enable_skill",+ Args: []string{src, dest},+ },+ Mutates: true,+ Available: true,+ })+ }+ }+ }++ } else {+ var activePaths []string+ seenActive := map[string]bool{}+ var disabledPaths []string+ seenDisabled := map[string]bool{}+ 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)+ }+ } else {+ if !seenActive[obs.Path] {+ seenActive[obs.Path] = true+ activePaths = append(activePaths, obs.Path)+ }+ }+ }+ }++ if len(activePaths) > 0 {+ toggleActions = append(toggleActions, actions.CommandPreview{+ ID: "disable_skill",+ Title: fmt.Sprintf("Disable skill (scope: %s)", sk.Scope),+ Description: fmt.Sprintf("Disable this skill across all agent roots in the %s scope.", sk.Scope),+ Command: fmt.Sprintf("disable skill (scope: %s)", sk.Scope),+ Exec: actions.ExecSpec{+ Internal: "disable_skill",+ Args: activePaths,+ },+ Mutates: true,+ Available: true,+ })+ }++ if len(disabledPaths) > 0 {+ toggleActions = append(toggleActions, actions.CommandPreview{+ ID: "enable_skill",+ Title: fmt.Sprintf("Enable skill (scope: %s)", sk.Scope),+ Description: fmt.Sprintf("Enable this skill across all agent roots in the %s scope.", sk.Scope),+ Command: fmt.Sprintf("enable skill (scope: %s)", sk.Scope),+ Exec: actions.ExecSpec{+ Internal: "enable_skill",+ Args: disabledPaths,+ },+ Mutates: true,+ Available: true,+ })+ }+ }++ return insertToggleActions(previews, toggleActions)+}++func (m appModel) sourceEnableDisableActions(skills []*model.Skill) []actions.CommandPreview {+ if len(skills) == 0 {+ return nil+ }+ var activePaths []string+ seenActive := map[string]bool{}+ var disabledPaths []string+ seenDisabled := map[string]bool{}+ sharedActive, sharedDisabled := map[string][]string{}, map[string][]string{}++ for _, sk := range skills {+ for _, obs := range sk.ObservedPaths {+ if m.agent != "" && obs.Agent != m.agent {+ continue+ }+ if m.agent != "" {+ sharing := sharingAgentsForPath(sk, obs.Path)+ if len(sharing) > 1 {+ if obs.Status == model.StatusDisabled {+ sharedDisabled[obs.Path] = sharing+ } else {+ sharedActive[obs.Path] = sharing+ }+ continue+ }+ }++ if obs.Status == model.StatusDisabled {+ if !seenDisabled[obs.Path] {+ seenDisabled[obs.Path] = true+ disabledPaths = append(disabledPaths, obs.Path, obs.TargetPath)+ }+ continue+ }+ if !seenActive[obs.Path] {+ seenActive[obs.Path] = true+ activePaths = append(activePaths, obs.Path)+ }+ }+ }++ var out []actions.CommandPreview+ if len(activePaths) > 0 {+ title := "Disable source skills"+ desc := "Disable all enabled skills in this source."+ cmd := "disable source skills"+ if m.agent != "" {+ title = fmt.Sprintf("Disable source skills for agent %s", m.agentLabel())+ desc = fmt.Sprintf("Disable enabled skills in this source for %s.", m.agentLabel())+ 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 {+ 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 {+ title := "Enable source skills"+ desc := "Enable all disabled skills in this source."+ cmd := "enable source skills"+ if m.agent != "" {+ title = fmt.Sprintf("Enable source skills for agent %s", m.agentLabel())+ desc = fmt.Sprintf("Enable disabled skills in this source for %s.", m.agentLabel())+ 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 {+ 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")})+ }++ return out+}++func sharingAgentsForPath(sk *model.Skill, path string) []string {+ var agents []string+ for _, other := range sk.ObservedPaths {+ if other.Path == path {+ agents = append(agents, other.Agent)+ }+ }+ return agents+}++func sharedSourceReason(shared map[string][]string, verb string) string {+ for _, agents := range shared {+ return fmt.Sprintf("This path is shared by multiple agents (%s). Use scope-level %s instead.", strings.Join(agents, ", "), verb)+ }+ return "One or more paths are shared by multiple agents. Use scope-level " + verb + " instead."+}++func insertToggleActions(previews, toggleActions []actions.CommandPreview) []actions.CommandPreview {+ if len(toggleActions) == 0 {+ return previews+ }+ insertAt := len(previews)+ for i, preview := range previews {+ if preview.ID == "open_skill" {+ insertAt = i + 1+ break+ }+ }+ out := make([]actions.CommandPreview, 0, len(previews)+len(toggleActions))+ out = append(out, previews[:insertAt]...)+ out = append(out, toggleActions...)+ out = append(out, previews[insertAt:]...)+ return out+}diff --git a/internal/tui/view.go b/internal/tui/view.goindex 13d4c21..fbbfc97 100644--- a/internal/tui/view.go+++ b/internal/tui/view.go@@ -226,11 +226,21 @@ func (m appModel) listPane(height, width int) string {severity = fmt.Sprintf(" ▲%d", issueWarnings)}- // Reserve room for the trailing tags so a long name truncates first,- // keeping scope/agent/severity badges visible. lipgloss.Width counts- // display columns (not bytes), so width-1 glyphs like ▲ need no- // spacing crutch (the old ⚠ badge padded with a space to render).+ isEffectivelyDisabled := row.skill.Disabled+ if m.agent != "" {+ isEffectivelyDisabled = false+ for _, obs := range row.skill.ObservedPaths {+ if obs.Agent == m.agent && obs.Status == model.StatusDisabled {+ isEffectivelyDisabled = true+ break+ }+ }+ }+tail := " " + scopeTag + agentBadge + severity+ if isEffectivelyDisabled {+ tail += " [disabled]"+ }nameCore := truncate(mark+view.Name, max(1, width-lipgloss.Width(tail)))switch {@@ -238,6 +248,12 @@ func (m appModel) listPane(height, width int) string {line = selectedStyle.Render(nameCore + tail)case issueErrors > 0:line = errorStyle.Render(nameCore + tail)+ case isEffectivelyDisabled:+ line = dimStyle.Render(nameCore+" "+scopeTag) + agentBadge+ if issueWarnings > 0 {+ line += warningStyle.Render(severity)+ }+ line += " " + dimStyle.Render("[disabled]")default:line = nameCore + " " + scopeStyle(view.Scope).Render(scopeTag) + agentBadgeif issueWarnings > 0 {@@ -461,8 +477,25 @@ func (m appModel) metadataLinesForRows(rows []skillsRow, width int) []string {}view := display.Skill(row.skill)+ isEffectivelyDisabled := row.skill.Disabled+ if m.agent != "" {+ isEffectivelyDisabled = false+ for _, obs := range row.skill.ObservedPaths {+ if obs.Agent == m.agent && obs.Status == model.StatusDisabled {+ isEffectivelyDisabled = true+ break+ }+ }+ }+ statusVal := "enabled"+ if isEffectivelyDisabled {+ statusVal = errorStyle.Render("disabled")+ } else {+ statusVal = lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render("enabled")+ }lines := []string{formatMetaLine("Scope:", styledScopeBadge(string(view.Scope)), width),+ formatMetaLine("Status:", statusVal, width),}if view.Description != "" {lines = append(lines, formatMetaLine("Description:", dimStyle.Render(view.Description), width))@@ -975,6 +1008,8 @@ func (m appModel) visibilitySummary(view display.SkillView, width int) []stringstatusText = "available (copied)"case "broken_symlink":statusText = "broken link"+ case "disabled":+ statusText = "disabled"case "unsupported_global":statusText = "global unsupported"case "agent_not_detected":@@ -987,7 +1022,7 @@ func (m appModel) visibilitySummary(view display.SkillView, width int) []stringvar statusStyled stringif visibility.Visible {statusStyled = lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render(statusText)- } else if visibility.Reason == "broken_symlink" {+ } else if visibility.Reason == "broken_symlink" || visibility.Reason == "disabled" {statusStyled = errorStyle.Render(statusText)} else {statusStyled = dimStyle.Render(statusText)@@ -1139,11 +1174,6 @@ func (m appModel) commandPreview(sk *model.Skill, width int) []string {continue}titleText := compat.SanitizeMetadata(preview.Title)- if preview.Dangerous {- titleText += " — removes skills"- } else if preview.Mutates {- titleText += " — changes skills"- }if i == m.action {// Selected Action Highlight Block (entire block has same purple background)titleLine := activeActionTitleStyle.Render(padRight(selector+titleText, width))@@ -1210,25 +1240,25 @@ func (m appModel) footerText(width int) string {} else if m.detailModal {text = "↑/↓ scroll · o edit · c commands · esc/q close"} else if m.commands {- text = "↑/↓ choose · enter run · esc close"+ text = "↑/↓ choose · enter run · e enable/disable · esc close"} else if m.helpOpen {text = "esc/q/? close help"} else if m.focus == focusMetadata {- text = "↑/↓ scroll metadata · enter open · c commands · o edit · ? help"+ text = "↑/↓ scroll metadata · enter open · c commands · e enable/disable · ? help"} else if m.focus == focusPreview {- text = "↑/↓ scroll preview · enter open · c commands · o edit · ? help"+ text = "↑/↓ scroll preview · enter open · c commands · e enable/disable · ? help"} else {// focusSkillsrows := m.visibleRows()if len(rows) > 0 && m.selected >= 0 && m.selected < len(rows) {row := rows[m.selected]if row.isHeader {- text = "enter browse · d scan · c source actions · h/- collapse · l/+ expand · ? help"+ text = "enter browse · e enable/disable source · d scan · c actions · ? help"} else {- text = "enter open · c skill actions · o edit · u update · x remove · ? help"+ text = "enter open · e enable/disable · c actions · u update · x remove · ? help"}} else {- text = "enter open · c skill actions · o edit · u update · x remove · ? help"+ text = "enter open · e enable/disable · c actions · u update · x remove · ? help"}}return dimStyle.Render(truncate(text, width))@@ -1263,8 +1293,9 @@ func (m appModel) helpModalOverlay(layout appLayout) string {sectionHeaderStyle.Render("Actions & Selection:")," enter Open detail modal for the selected source or skill"," space Mark / unmark selected skill for bulk actions",- " s Mark all skills in the current source group",+ " s Mark / unmark skills in the current source group"," o Open selected skill directly in editor",+ " e Enable / disable selected skill or source group"," c Open command picker menu"," u / x Quick reinstall-update / remove for selection"," d Check local or remote source for available skills (Source row)",