mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
fix: clarify registry result list
Alvin Unreal30e187cd1442
diff --git a/internal/tui/tui.go b/internal/tui/tui.goindex 0b24080..2a44e53 100644--- a/internal/tui/tui.go+++ b/internal/tui/tui.go@@ -145,12 +145,13 @@ const ()var (- titleStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("212"))- borderStyle = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).Padding(0, 1)- 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"))+ titleStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("212"))+ borderStyle = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).Padding(0, 1)+ selectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("230")).Background(lipgloss.Color("62"))+ inactiveSelectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("250")).Background(lipgloss.Color("238"))+ dimStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241"))+ errorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("203"))+ warningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("214"))// Scope tags: project=cyan, global=magenta.scopeProjectStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("45"))diff --git a/internal/tui/update_test.go b/internal/tui/update_test.goindex a1ff36a..17d948e 100644--- a/internal/tui/update_test.go+++ b/internal/tui/update_test.go@@ -626,3 +626,38 @@ func TestTUIRegistryMultiInstallDispatch(t *testing.T) {t.Errorf("unexpected confirmation view: %s", viewStr)}}++func TestTUIRegistryListRenderingWithContextAndFocus(t *testing.T) {+ m := newModel("")+ m.width = 120+ m.height = 30+ m.registryModal = true+ m.registryQuery = "xyz"+ m.registryResults = []registry.Skill{+ {DisplayName: "My Display Name", Slug: "my-display-name", Source: "github.com/my-org/my-repo"},+ }+ m.registrySelected = 0++ // Test 1: Search focused (list unfocused) -> inactiveSelectedStyle (subtle background)+ m.registryFocusList = false+ viewStr1 := 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")+ }++ // Test 2: List focused -> selectedStyle (active selected background)+ m.registryFocusList = true+ // Trigger project install to show confirmation overlay+ modelTmp, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})+ mClone := modelTmp.(appModel)++ if !mClone.confirming {+ t.Fatal("expected confirmation overlay to be active")+ }++ // Confirmation screen should explicitly show target agents+ viewStr2 := mClone.View()+ if !strings.Contains(viewStr2, "Target agents") || !strings.Contains(viewStr2, "all detected") {+ t.Errorf("expected confirmation view to explicitly state target agents, got:\n%s", viewStr2)+ }+}diff --git a/internal/tui/view.go b/internal/tui/view.goindex 4621984..4183b75 100644--- a/internal/tui/view.go+++ b/internal/tui/view.go@@ -1596,6 +1596,19 @@ func (m appModel) confirmationOverlay(layout appLayout) string {if command != "" {lines = append(lines, sectionHeaderStyle.Render("Command"), dimStyle.Render(wrapText(command, 48)), "")}+ if m.pendingAction != nil && (m.pendingAction.ID == "install_skill" || m.pendingAction.ID == "bulk_install_skills") {+ var detectedAgents []string+ for _, agent := range m.result.Agents {+ if agent.Detected {+ detectedAgents = append(detectedAgents, agent.Display)+ }+ }+ agentText := "none detected"+ if len(detectedAgents) > 0 {+ agentText = strings.Join(detectedAgents, ", ")+ }+ lines = append(lines, sectionHeaderStyle.Render("Target agents"), dimStyle.Render("all detected ("+agentText+")"), "")+ }lines = append(lines, wrapText(instruction, 48))if m.confirmError != "" {@@ -1770,10 +1783,18 @@ func (m appModel) registryModalOverlay(layout appLayout) string {} else {// Show resultsfor idx, s := range m.registryResults {- selector := " "+ selector := " "if idx == m.registrySelected {- selector = "› "+ selector = "›"+ }+ selectedMark := " "+ if m.registrySelectedKeys != nil {+ if _, isSel := m.registrySelectedKeys[s.Source+"\x00"+s.Slug]; isSel {+ selectedMark = "●"+ }}+ prefix := selector + selectedMark + " "+ prefixWidth := 3status, _ := m.checkRegistrySkillStatus(s)var badge string@@ -1781,13 +1802,13 @@ func (m appModel) registryModalOverlay(layout appLayout) string {badge = scopeProjectStyle.Render("[installed]")} else if status == StatusSimilarInstalled {badge = warningStyle.Render("[similar]")+ } else if s.Invalid {+ badge = errorStyle.Render("[invalid]")}installsText := fmt.Sprintf("%d↓", s.Installs)installsStyled := dimStyle.Render(installsText)- // Selector (2) + Name(?) + Badge(?) + Installs(?)- // Let's truncate Name to fit nicely in leftWidthrightPart := ""if badge != "" {rightPart = badge + " " + installsStyled@@ -1795,28 +1816,61 @@ func (m appModel) registryModalOverlay(layout appLayout) string {rightPart = installsStyled}rightPartWidth := lipgloss.Width(rightPart)- availNameWidth := leftWidth - 2 - rightPartWidth - 1 // 1 space padding+ availNameWidth := leftWidth - prefixWidth - rightPartWidth - 1 // 1 space paddingif availNameWidth < 5 {availNameWidth = 5}- selectedMark := " "- if m.registrySelectedKeys != nil {- if _, isSel := m.registrySelectedKeys[s.Source+"\x00"+s.Slug]; isSel {- selectedMark = "● "++ srcCtx := ""+ if s.Source != "" {+ srcCtx = normalizeSource(s.Source)+ }++ plainNameAndSource := s.DisplayName+ if srcCtx != "" {+ plainNameAndSource += " (" + srcCtx + ")"+ }++ // Truncate the plain text+ truncatedPlain := truncate(plainNameAndSource, availNameWidth)++ var styledText string+ if idx == m.registrySelected {+ // Highlighted row is formatted entirely by selectedStyle/inactiveSelectedStyle, keep plain+ styledText = truncatedPlain+ } else {+ if status == StatusInstalled || s.Invalid {+ // Installed/unavailable rows are dimmed+ styledText = dimStyle.Render(truncatedPlain)+ } else {+ // Normal row: style source context as dim+ if len(truncatedPlain) > len(s.DisplayName) {+ displayNamePart := truncatedPlain[:len(s.DisplayName)]+ sourcePart := truncatedPlain[len(s.DisplayName):]+ styledText = displayNamePart + dimStyle.Render(sourcePart)+ } else {+ styledText = truncatedPlain+ }}}- namePart := truncate(selectedMark+s.DisplayName, availNameWidth)// Pad the line- line := selector + namePart- paddingLen := leftWidth - lipgloss.Width(line) - rightPartWidth+ linePlain := prefix + truncatedPlain+ paddingLen := leftWidth - lipgloss.Width(linePlain) - rightPartWidth+ line := prefix + styledTextif paddingLen > 0 {line += strings.Repeat(" ", paddingLen)}line += rightPartif idx == m.registrySelected {- leftContentLines = append(leftContentLines, selectedStyle.Render(padRight(line, leftWidth)))+ var lineStyled string+ if m.registryFocusList {+ lineStyled = selectedStyle.Render(padRight(prefix+truncatedPlain+rightPart, leftWidth))+ } else {+ lineStyled = inactiveSelectedStyle.Render(padRight(prefix+truncatedPlain+rightPart, leftWidth))+ }+ leftContentLines = append(leftContentLines, lineStyled)} else {leftContentLines = append(leftContentLines, line)}@@ -1828,51 +1882,16 @@ func (m appModel) registryModalOverlay(layout appLayout) string {// Right pane: detail preview / bulk detailsvar rightContentLines []stringselectedCount := m.registrySelectedCount()- if selectedCount > 0 {- rightContentLines = append(rightContentLines,- titleStyle.Render(fmt.Sprintf("Bulk Installation (%d)", selectedCount)),- "",- sectionHeaderStyle.Render("Selected Skills:"),- "",- )- for _, selSkill := range m.registrySelectedKeys {- rightContentLines = append(rightContentLines,- fmt.Sprintf(" • %s (%s)", selSkill.DisplayName, selSkill.Slug),- )- }-- var list []actions.AvailableSkillInstall- for _, s := range m.registrySelectedKeys {- list = append(list, actions.AvailableSkillInstall{- Source: s.Source,- DisplayName: s.DisplayName,- Slug: s.Slug,- })- }- projPreview := actions.ForAvailableSkills(list, false)- globalPreview := actions.ForAvailableSkills(list, true)+ if len(m.registryResults) > 0 && m.registrySelected >= 0 && m.registrySelected < len(m.registryResults) {+ s := m.registryResults[m.registrySelected]+ status, similarMsg := m.checkRegistrySkillStatus(s)- rightContentLines = append(rightContentLines, "")- rightContentLines = append(rightContentLines, sectionHeaderStyle.Render("Install Commands:"), "")- if projPreview.Available {+ if selectedCount > 0 {rightContentLines = append(rightContentLines,- dimStyle.Render("Project-local:"),- " "+projPreview.Command,- )- } else {- rightContentLines = append(rightContentLines, errorStyle.Render("Project-local: "+projPreview.Reason))- }- if globalPreview.Available {- rightContentLines = append(rightContentLines,- dimStyle.Render("Globally (adds -g):"),- " "+globalPreview.Command,+ lipgloss.NewStyle().Foreground(lipgloss.Color("228")).Bold(true).Render(fmt.Sprintf("● Bulk Select: %d skills marked for installation", selectedCount)),+ "",)- } else {- rightContentLines = append(rightContentLines, errorStyle.Render("Globally: "+globalPreview.Reason))}- } else if len(m.registryResults) > 0 && m.registrySelected >= 0 && m.registrySelected < len(m.registryResults) {- s := m.registryResults[m.registrySelected]- status, similarMsg := m.checkRegistrySkillStatus(s)rightContentLines = append(rightContentLines,titleStyle.Render(s.DisplayName),@@ -1882,29 +1901,10 @@ func (m appModel) registryModalOverlay(layout appLayout) string {formatMetaLine("Installs:", fmt.Sprintf("%d", s.Installs), rightWidth),)- // Fetch previews- projActions := actions.ForAvailableSkillWithOptions(s.Source, actions.InstallOptions{- DisplayName: s.DisplayName,- Slug: s.Slug,- Global: false,- })- globalActions := actions.ForAvailableSkillWithOptions(s.Source, actions.InstallOptions{- DisplayName: s.DisplayName,- Slug: s.Slug,- Global: true,- })-+ var statusVal stringallowInstall := truecantInstallReason := ""- if len(projActions) == 0 {- allowInstall = false- cantInstallReason = "installation configuration failed"- } else if !projActions[0].Available {- allowInstall = false- cantInstallReason = projActions[0].Reason- }- var statusVal stringif status == StatusInstalled {statusVal = scopeProjectStyle.Render("[installed] Already installed")allowInstall = false@@ -1924,24 +1924,72 @@ func (m appModel) registryModalOverlay(layout appLayout) string {rightContentLines = append(rightContentLines, "", errorStyle.Render(wrapText("Notice: A similar skill named '"+similarMsg+"' is already installed.", rightWidth)))}- // Install Command previewsrightContentLines = append(rightContentLines, "")rightContentLines = append(rightContentLines, sectionHeaderStyle.Render("Install Commands:"), "")- if !allowInstall && cantInstallReason != "" {- rightContentLines = append(rightContentLines, errorStyle.Render(wrapText("Installations disabled: "+cantInstallReason, rightWidth)))- } else {- if len(projActions) > 0 && projActions[0].Available {+ if selectedCount > 0 {+ var list []actions.AvailableSkillInstall+ for _, sel := range m.registrySelectedKeys {+ list = append(list, actions.AvailableSkillInstall{+ Source: sel.Source,+ DisplayName: sel.DisplayName,+ Slug: sel.Slug,+ })+ }+ projPreview := actions.ForAvailableSkills(list, false)+ globalPreview := actions.ForAvailableSkills(list, true)++ if projPreview.Available {rightContentLines = append(rightContentLines,- dimStyle.Render("Project-local:"),- " "+projActions[0].Command,+ dimStyle.Render("Bulk Project-local:"),+ " "+projPreview.Command,)+ } else {+ rightContentLines = append(rightContentLines, errorStyle.Render("Bulk Project-local: "+projPreview.Reason))}- if len(globalActions) > 0 && globalActions[0].Available {+ if globalPreview.Available {rightContentLines = append(rightContentLines,- dimStyle.Render("Globally (adds -g):"),- " "+globalActions[0].Command,+ dimStyle.Render("Bulk Globally:"),+ " "+globalPreview.Command,)+ } else {+ rightContentLines = append(rightContentLines, errorStyle.Render("Bulk Globally: "+globalPreview.Reason))+ }+ } else {+ projActions := actions.ForAvailableSkillWithOptions(s.Source, actions.InstallOptions{+ DisplayName: s.DisplayName,+ Slug: s.Slug,+ Global: false,+ })+ globalActions := actions.ForAvailableSkillWithOptions(s.Source, actions.InstallOptions{+ DisplayName: s.DisplayName,+ Slug: s.Slug,+ Global: true,+ })++ if len(projActions) == 0 {+ allowInstall = false+ cantInstallReason = "installation configuration failed"+ } else if !projActions[0].Available {+ allowInstall = false+ cantInstallReason = projActions[0].Reason+ }++ if !allowInstall && cantInstallReason != "" {+ rightContentLines = append(rightContentLines, errorStyle.Render(wrapText("Installations disabled: "+cantInstallReason, rightWidth)))+ } else {+ if len(projActions) > 0 && projActions[0].Available {+ rightContentLines = append(rightContentLines,+ dimStyle.Render("Project-local:"),+ " "+projActions[0].Command,+ )+ }+ if len(globalActions) > 0 && globalActions[0].Available {+ rightContentLines = append(rightContentLines,+ dimStyle.Render("Globally (adds -g):"),+ " "+globalActions[0].Command,+ )+ }}}} else {