mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
fix: refine registry modal preview
Alvin Unreal0d0cc89ccbfc
diff --git a/internal/tui/update_test.go b/internal/tui/update_test.goindex 8135824..beb76d9 100644--- a/internal/tui/update_test.go+++ b/internal/tui/update_test.go@@ -476,7 +476,12 @@ func TestTUINoFalseNoSkillsFoundWhileSearchPending(t *testing.T) {m.height = 30m.registryModal = truem.registryQuery = "a"- m.registryResults = nil+ m.registryResults = []registry.Skill{{+ DisplayName: "Old Result",+ Slug: "old",+ Source: "owner/old",+ }}+ m.registrySelected = 0m.registryFocusList = falsemodelTmp, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'b'}})@@ -486,12 +491,28 @@ func TestTUINoFalseNoSkillsFoundWhileSearchPending(t *testing.T) {}viewStr := m.View()+ if strings.Contains(viewStr, "Old Result") {+ t.Error("should hide old results while a new search is pending/loading")+ }if strings.Contains(viewStr, "No skills found in registry.") {t.Error("should not show 'No skills found' while search is loading/pending")}if !strings.Contains(viewStr, "Searching registry...") {t.Error("expected 'Searching registry...' to be shown while search is loading/pending")}++ // Verify navigation is blocked when loading+ m.registryFocusList = true+ m.registryResults = []registry.Skill{{+ DisplayName: "Old",+ Slug: "old",+ }}+ // Pressing 'j' should be a no-op when loading+ modelTmp, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'j'}})+ m = modelTmp.(appModel)+ if m.registrySelected != 0 {+ t.Errorf("expected navigation to be blocked during search loading, got selection=%d", m.registrySelected)+ }}func TestTUICancelPreservesRegistryModalState(t *testing.T) {@@ -634,16 +655,41 @@ func TestTUIRegistryListRenderingWithContextAndFocus(t *testing.T) {m.registryModal = truem.registryQuery = "xyz"m.registryResults = []registry.Skill{- {DisplayName: "My Display Name", Slug: "my-display-name", Source: "github.com/my-org/my-repo"},+ {DisplayName: "My Display Name", Slug: "my-display-name", Source: "https://github.com/my-org/my-repo/skills/my-folder"},}m.registrySelected = 0- // Test 1: Search focused (list unfocused) -> inactiveSelectedStyle (subtle background)+ // Mock local discovery map to test description lookup matching+ appDisc := SourceDiscovery{+ Status: DiscoveryReady,+ Skills: []DiscoveredSkill{+ {Name: "My Display Name", Description: "This is a great skill description!"},+ },+ }+ m.discovery = map[string]SourceDiscovery{+ "https://github.com/my-org/my-repo/skills/my-folder": appDisc,+ }++ // Test 1: Search focused (list unfocused)m.registryFocusList = falseviewStr1 := m.View()if !strings.Contains(viewStr1, "My Display Name") || !strings.Contains(viewStr1, "my-org/my-repo") {t.Fatal("expected view to contain display name and source context")}+ // Prefix for highlighted-only row starts with "› "+ if !strings.Contains(viewStr1, "› My Display Name") {+ t.Errorf("expected prefix '› ' for highlighted row, got view:\n%s", viewStr1)+ }+ // Verify parsed Repository/Folder and matched Description in Right Pane+ if !strings.Contains(viewStr1, "Repository: my-org/my-repo") {+ t.Errorf("expected parsed Repository to be displayed, got view:\n%s", viewStr1)+ }+ if !strings.Contains(viewStr1, "Folder: skills/my-folder") {+ t.Errorf("expected parsed Folder to be displayed, got view:\n%s", viewStr1)+ }+ if !strings.Contains(viewStr1, "This is a great skill description!") {+ t.Errorf("expected matched Description to be displayed, got view:\n%s", viewStr1)+ }// Test 2: List focused -> selectedStyle (active selected background)m.registryFocusList = truediff --git a/internal/tui/view.go b/internal/tui/view.goindex 4183b75..92f53fc 100644--- a/internal/tui/view.go+++ b/internal/tui/view.go@@ -1722,6 +1722,34 @@ func truncateReleaseNotes(notes string, width int) string {return strings.Join(out, "\n")}+func parseSourceURLDetails(source string) (repo string, folder string) {+ src := source+ src = strings.TrimPrefix(src, "git+https://")+ src = strings.TrimPrefix(src, "https://")+ src = strings.TrimPrefix(src, "http://")+ src = strings.TrimPrefix(src, "git@")+ src = strings.ReplaceAll(src, ":", "/")+ src = strings.TrimSuffix(src, ".git")+ src = strings.TrimRight(src, "/")++ // Remove host prefix+ for _, host := range []string{"github.com/", "gitlab.com/"} {+ src = strings.TrimPrefix(src, host)+ }++ // Now src should look like "owner/repo/sub/folders" or just "owner/repo"+ parts := strings.Split(src, "/")+ if len(parts) >= 2 {+ repo = parts[0] + "/" + parts[1]+ if len(parts) > 2 {+ folder = strings.Join(parts[2:], "/")+ }+ } else {+ repo = src+ }+ return repo, folder+}+func (m appModel) registrySelectedCount() int {return len(m.registrySelectedKeys)}@@ -1737,7 +1765,7 @@ func (m appModel) registryModalOverlay(layout appLayout) string {// Left pane header: Query inputvar inputLine string- focusPrompt := "Search: "+ focusPrompt := " Search: "if m.registryFocusList {// List is focused: input prompt is dim@@ -1774,27 +1802,27 @@ func (m appModel) registryModalOverlay(layout appLayout) string {)} else if len(m.registryQuery) < 2 {leftContentLines = append(leftContentLines, " Type at least 2 characters to search.")+ } else if m.registryLoading {+ leftContentLines = append(leftContentLines, " "+runningStyle.Render("Searching registry..."))} else if len(m.registryResults) == 0 {- if m.registryLoading {- leftContentLines = append(leftContentLines, " "+runningStyle.Render("Searching registry..."))- } else {- leftContentLines = append(leftContentLines, " No skills found in registry.")- }+ leftContentLines = append(leftContentLines, " No skills found in registry.")} else {// Show resultsfor idx, s := range m.registryResults {- selector := " "- if idx == m.registrySelected {- selector = "›"- }- selectedMark := " "+ isSel := falseif m.registrySelectedKeys != nil {- if _, isSel := m.registrySelectedKeys[s.Source+"\x00"+s.Slug]; isSel {- selectedMark = "●"- }+ _, isSel = m.registrySelectedKeys[s.Source+"\x00"+s.Slug]+ }++ prefix := " "+ if idx == m.registrySelected && isSel {+ prefix = "›● "+ } else if idx == m.registrySelected {+ prefix = "› "+ } else if isSel {+ prefix = "● "}- prefix := selector + selectedMark + " "- prefixWidth := 3+ prefixWidth := lipgloss.Width(prefix)status, _ := m.checkRegistrySkillStatus(s)var badge string@@ -1866,9 +1894,9 @@ func (m appModel) registryModalOverlay(layout appLayout) string {if idx == m.registrySelected {var lineStyled stringif m.registryFocusList {- lineStyled = selectedStyle.Render(padRight(prefix+truncatedPlain+rightPart, leftWidth))+ lineStyled = selectedStyle.Render(padRight(prefix+truncatedPlain, leftWidth-rightPartWidth-1) + " " + rightPart)} else {- lineStyled = inactiveSelectedStyle.Render(padRight(prefix+truncatedPlain+rightPart, leftWidth))+ lineStyled = inactiveSelectedStyle.Render(padRight(prefix+truncatedPlain, leftWidth-rightPartWidth-1) + " " + rightPart)}leftContentLines = append(leftContentLines, lineStyled)} else {@@ -1882,7 +1910,7 @@ func (m appModel) registryModalOverlay(layout appLayout) string {// Right pane: detail preview / bulk detailsvar rightContentLines []stringselectedCount := m.registrySelectedCount()- if len(m.registryResults) > 0 && m.registrySelected >= 0 && m.registrySelected < len(m.registryResults) {+ if len(m.registryResults) > 0 && m.registrySelected >= 0 && m.registrySelected < len(m.registryResults) && !m.registryLoading {s := m.registryResults[m.registrySelected]status, similarMsg := m.checkRegistrySkillStatus(s)@@ -1896,10 +1924,17 @@ func (m appModel) registryModalOverlay(layout appLayout) string {rightContentLines = append(rightContentLines,titleStyle.Render(s.DisplayName),"",+ )++ repo, folder := parseSourceURLDetails(s.Source)+ rightContentLines = append(rightContentLines,formatMetaLine("Slug:", s.Slug, rightWidth),- formatMetaLine("Source:", s.Source, rightWidth),- formatMetaLine("Installs:", fmt.Sprintf("%d", s.Installs), rightWidth),+ formatMetaLine("Repository:", repo, rightWidth),)+ if folder != "" {+ rightContentLines = append(rightContentLines, formatMetaLine("Folder:", folder, rightWidth))+ }+ rightContentLines = append(rightContentLines, formatMetaLine("Installs:", fmt.Sprintf("%d", s.Installs), rightWidth))var statusVal stringallowInstall := true@@ -1924,6 +1959,38 @@ func (m appModel) registryModalOverlay(layout appLayout) string {rightContentLines = append(rightContentLines, "", errorStyle.Render(wrapText("Notice: A similar skill named '"+similarMsg+"' is already installed.", rightWidth)))}+ var matchedDesc string+ var matchedPreview string+ for _, disc := range m.discovery {+ if disc.Status == DiscoveryReady {+ for _, ds := range disc.Skills {+ if compat.NormalizeName(ds.Name) == compat.NormalizeName(s.DisplayName) || compat.NormalizeName(ds.Name) == compat.NormalizeName(s.Slug) {+ if ds.Description != "" {+ matchedDesc = ds.Description+ }+ if ds.Preview != "" {+ matchedPreview = ds.Preview+ }+ }+ }+ }+ }++ if matchedDesc != "" {+ rightContentLines = append(rightContentLines,+ "",+ sectionHeaderStyle.Render("Description:"),+ wrapText(matchedDesc, rightWidth),+ )+ }+ if matchedPreview != "" {+ rightContentLines = append(rightContentLines,+ "",+ sectionHeaderStyle.Render("Preview:"),+ wrapText(matchedPreview, rightWidth),+ )+ }+rightContentLines = append(rightContentLines, "")rightContentLines = append(rightContentLines, sectionHeaderStyle.Render("Install Commands:"), "")@@ -2016,10 +2083,10 @@ func (m appModel) registryModalOverlay(layout appLayout) string {// Help linehelpLineText := m.registryModalHelpLine()- helpLine := dimStyle.Render(helpLineText)+ helpLine := dimStyle.Render(" " + helpLineText)content := []string{- titleStyle.Render(" Skills.sh Registry Search "),+ titleStyle.Render(" Skills.sh Registry Search"),"",body,"",@@ -2040,11 +2107,11 @@ func (m appModel) registryModalOverlay(layout appLayout) string {func (m appModel) registryModalHelpLine() string {if !m.registryFocusList {if m.registryError != nil && len(m.registryQuery) >= 2 {- return "type search · enter retry · tab select list · esc close"+ return "type to search (typing active) · enter retry · tab navigate list · esc close"}- return "type search · tab select list · esc close"+ return "type to search (typing active) · tab navigate list · esc close"}- parts := []string{"↑/↓ choose"}+ parts := []string{"↑/↓/j/k choose (navigation active)"}parts = append(parts, "space toggle")selectedCount := m.registrySelectedCount()if selectedCount > 0 {