Skip to content

mission control for agent skills

Polish TUI badges and scope label clarity

alvinreal405acd440446
diff --git a/internal/tui/tui.go b/internal/tui/tui.go
index 7420017..224f484 100644
--- a/internal/tui/tui.go
+++ b/internal/tui/tui.go
@@ -82,6 +82,7 @@ var (
selectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("230")).Background(lipgloss.Color("62"))
dimStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241"))
errorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("203"))
+ warningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("214"))
runExec = runner.OSRunner{}.Run
// Action Mode UI Polish Styles
@@ -835,8 +836,8 @@ func (m appModel) filterPane(width int) string {
dimStyle.Render(compat.SanitizeMetadata(m.result.Cwd)),
"",
filterLine("All", m.filter == scopeAll),
- filterLine(fmt.Sprintf("Project (%d)", counts[model.ScopeProject]), m.filter == scopeProject),
- filterLine(fmt.Sprintf("Global (%d)", counts[model.ScopeGlobal]), m.filter == scopeGlobal),
+ filterLine(fmt.Sprintf("[P]roject (%d)", counts[model.ScopeProject]), m.filter == scopeProject),
+ filterLine(fmt.Sprintf("[G]lobal (%d)", counts[model.ScopeGlobal]), m.filter == scopeGlobal),
"",
fmt.Sprintf("Skills: %d", len(m.result.Skills)),
fmt.Sprintf("Issues: %d", issues),
@@ -868,6 +869,17 @@ func filterLine(label string, active bool) string {
return " " + label
}
+func scopeBadge(scope string) string {
+ switch scope {
+ case string(model.ScopeProject):
+ return "P"
+ case string(model.ScopeGlobal):
+ return "G"
+ default:
+ return compat.SanitizeMetadata(scope)
+ }
+}
+
func (m appModel) listPane(height, width int) string {
items := m.filteredSkills()
lines := []string{titleStyle.Render("Skills")}
@@ -896,18 +908,23 @@ func (m appModel) listPane(height, width int) string {
if m.isSelected(skill) {
mark = "● "
}
- label := fmt.Sprintf("%s%s [%s]", mark, view.Name, view.Scope)
+ label := fmt.Sprintf("%s%s [%s]", mark, view.Name, scopeBadge(view.Scope))
if m.agent != "" {
label += " " + agentVisibilityBadge(items[i], m.agent)
}
- if len(view.HealthIssues) > 0 {
- label += fmt.Sprintf(" ⚠ %d", len(view.HealthIssues))
+ issueErrors, issueWarnings := healthIssueCounts(view.HealthIssues)
+ if issueErrors > 0 {
+ label += fmt.Sprintf(" !%d", issueErrors)
+ } else if issueWarnings > 0 {
+ label += fmt.Sprintf(" ⚠%d", issueWarnings)
}
var line string
if i == m.selected {
line = selectedStyle.Render(truncate(label, width))
- } else if len(view.HealthIssues) > 0 {
+ } else if issueErrors > 0 {
line = errorStyle.Render(truncate(label, width))
+ } else if issueWarnings > 0 {
+ line = warningStyle.Render(truncate(label, width))
} else {
line = truncate(label, width)
}
@@ -932,6 +949,17 @@ type listRow struct {
skillIndex int
}
+func healthIssueCounts(issues []display.HealthIssueView) (errors int, warnings int) {
+ for _, issue := range issues {
+ if issue.Severity == "error" {
+ errors++
+ } else {
+ warnings++
+ }
+ }
+ return errors, warnings
+}
+
func (m appModel) detailPane() string {
return m.viewport.View()
}
@@ -1028,11 +1056,29 @@ func (m appModel) visibilitySummary(view display.SkillView, width int) []string
if visibility.Agent != m.agent {
continue
}
- prefix := "cannot see"
+ statusText := "not linked"
if visibility.Visible {
- prefix = "can see"
+ statusText = "available"
+ }
+ switch visibility.Reason {
+ case "visible_via_universal_canonical", "visible_via_canonical":
+ statusText = "available (canonical)"
+ case "visible_via_symlink":
+ statusText = "available (symlinked)"
+ case "visible_via_copy":
+ statusText = "available (copied)"
+ case "broken_symlink":
+ statusText = "broken link"
+ case "unsupported_global":
+ statusText = "global unsupported"
+ case "agent_not_detected":
+ statusText = "agent not detected"
+ case "not_in_universal_canonical_dir":
+ statusText = "not in shared folder"
+ case "missing_agent_link":
+ statusText = "not linked"
}
- val := fmt.Sprintf("%s %s (%s)", visibility.Display, prefix, visibility.Reason)
+ val := fmt.Sprintf("%s: %s", visibility.Display, statusText)
if visibility.Path != "" {
val += " at " + visibility.Path
}
@@ -1046,7 +1092,7 @@ func (m appModel) visibilitySummary(view display.SkillView, width int) []string
visible++
}
}
- val := fmt.Sprintf("%d/%d supported agents", visible, len(view.Visibility))
+ val := fmt.Sprintf("Available to %d/%d agents", visible, len(view.Visibility))
return []string{formatMetaLine("Visibility:", val, width)}
}
@@ -1357,14 +1403,14 @@ func agentVisibilityBadge(sk *model.Skill, agent string) string {
continue
}
if visibility.Visible {
- return "✓ visible"
+ return "✓"
}
- return "× " + compat.SanitizeMetadata(visibility.Reason)
+ return "×"
}
if skillObservedByAgent(sk, agent) {
- return "✓ observed"
+ return "✓"
}
- return "× no data"
+ return "×"
}
func (m appModel) agentLabel() string {
diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go
index 1c6c23e..6a8e328 100644
--- a/internal/tui/tui_test.go
+++ b/internal/tui/tui_test.go
@@ -9,6 +9,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
+ "lazyskills/internal/display"
"lazyskills/internal/model"
"lazyskills/internal/runner"
)
@@ -180,7 +181,7 @@ func TestActiveAgentVisibilityReasonIsRendered(t *testing.T) {
Visibility: []model.SkillVisibility{{Agent: "claude-code", Display: "Claude Code", Visible: false, Reason: "missing_agent_link"}},
}}}}
out := m.View()
- if !strings.Contains(out, "Build") || !strings.Contains(out, "Claude Code cannot see") || !strings.Contains(out, "missing_agent_link") {
+ if !strings.Contains(out, "Build") || !strings.Contains(out, "Claude Code: not linked") {
t.Fatalf("expected active agent visibility reason, got %q", out)
}
}
@@ -198,20 +199,27 @@ func TestAgentFilterListMarksNonVisibleSkills(t *testing.T) {
Visibility: []model.SkillVisibility{{Agent: "claude-code", Display: "Claude Code", Visible: false, Reason: "missing_agent_link"}},
},
}}}
- out := m.View()
- if !strings.Contains(out, "Visible [project] ✓ visible") || !strings.Contains(out, "Missing [project] × missing_agent") {
+ out := m.listPane(20, 80)
+ if !strings.Contains(out, "Visible [P] ✓") || !strings.Contains(out, "Missing [P] ×") {
t.Fatalf("expected list-level visibility badges, got %q", out)
}
+ if strings.Contains(out, "not linked") || strings.Contains(out, "available") {
+ t.Fatalf("expected compact list badges without explanatory text, got %q", out)
+ }
}
-func TestListRendersIssueRowsInRedWithSubtleBadge(t *testing.T) {
+func TestListRendersIssueRowsWithSeverityBadges(t *testing.T) {
m := appModel{width: 120, height: 32, selected: 1, result: model.ScanResult{Skills: []*model.Skill{
{Name: "Healthy", Scope: model.ScopeProject},
- {Name: "Problem", Scope: model.ScopeProject, HealthIssues: []model.HealthIssue{{Type: "missing_file", Message: "missing SKILL.md"}}},
+ {Name: "Warning", Scope: model.ScopeProject, HealthIssues: []model.HealthIssue{{Type: "missing_global_lock", Severity: "warning", Message: "not tracked"}}},
+ {Name: "Error", Scope: model.ScopeProject, HealthIssues: []model.HealthIssue{{Type: "missing_file", Severity: "error", Message: "missing SKILL.md"}}},
}}}
- out := m.View()
- if !strings.Contains(out, "Problem [project] ⚠ 1") {
- t.Fatalf("expected subtle issue badge, got %q", out)
+ out := m.listPane(20, 80)
+ if !strings.Contains(out, "Warning [P] ⚠1") {
+ t.Fatalf("expected warning issue badge, got %q", out)
+ }
+ if !strings.Contains(out, "Error [P] !1") {
+ t.Fatalf("expected error issue badge, got %q", out)
}
if strings.Contains(out, "BROKEN") {
t.Fatalf("issue badge should stay subtle, got %q", out)
@@ -632,7 +640,7 @@ func TestGroupedListKeepsSelectedRowVisible(t *testing.T) {
}
m := appModel{width: 120, height: 10, selected: 11, result: model.ScanResult{Skills: skills}}
out := m.View()
- if !strings.Contains(out, "Skill 11 [project]") {
+ if !strings.Contains(out, "Skill 11 [P]") {
t.Fatalf("expected selected row visible with many group headers, got %q", out)
}
}
@@ -850,3 +858,39 @@ func assertRenderedSize(t *testing.T, out string, width, height int) {
}
}
}
+
+func TestVisibilityReasonTranslation(t *testing.T) {
+ sk := &model.Skill{
+ Name: "TestSkill",
+ Scope: model.ScopeProject,
+ Visibility: []model.SkillVisibility{
+ {Agent: "claude-code", Display: "Claude Code", Visible: true, Reason: "visible_via_symlink"},
+ {Agent: "opencode", Display: "OpenCode", Visible: false, Reason: "missing_agent_link"},
+ {Agent: "cursor", Display: "Cursor", Visible: false, Reason: "not_in_universal_canonical_dir"},
+ },
+ }
+
+ // List badges stay compact; detail pane carries the explanation.
+ if badge := agentVisibilityBadge(sk, "claude-code"); badge != "✓" {
+ t.Errorf("expected compact available badge, got %q", badge)
+ }
+ if badge := agentVisibilityBadge(sk, "opencode"); badge != "×" {
+ t.Errorf("expected compact unavailable badge, got %q", badge)
+ }
+ if badge := agentVisibilityBadge(sk, "cursor"); badge != "×" {
+ t.Errorf("expected compact unavailable badge, got %q", badge)
+ }
+
+ // Test detail summary translation
+ mAll := appModel{} // agent = ""
+ linesAll := mAll.visibilitySummary(display.Skill(sk), 80)
+ if len(linesAll) != 1 || !strings.Contains(linesAll[0], "Available to 1/3 agents") {
+ t.Errorf("expected all-agents summary, got %v", linesAll)
+ }
+
+ mFiltered := appModel{agent: "claude-code"}
+ linesFiltered := mFiltered.visibilitySummary(display.Skill(sk), 80)
+ if len(linesFiltered) != 1 || !strings.Contains(linesFiltered[0], "Claude Code: available (symlinked)") {
+ t.Errorf("expected filtered agent translation, got %v", linesFiltered)
+ }
+}