mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
Discovery: one-press install/open on enter in the modal
Alvin Unreal8b701f49e531
diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.goindex 7a14dd0..53da206 100644--- a/internal/tui/tui_test.go+++ b/internal/tui/tui_test.go@@ -2032,11 +2032,15 @@ func TestInteractiveSourceDetailModal(t *testing.T) {t.Fatal("expected opening unchecked source modal to trigger discovery command")}- // 3. Opening source modal does not repeatedly trigger discovery when already loading/ready/failed- m.discovery["owner/repo"] = SourceDiscovery{Status: DiscoveryLoading}- _, cmdLoading := m.Update(tea.KeyMsg{Type: tea.KeyEnter})- if cmdLoading != nil {- t.Fatal("expected opening loading source modal not to trigger discovery command again")+ // 3. Re-opening (from the sidebar) an already-loading source doesn't re-trigger+ // discovery. Use a modal-closed copy so enter targets the header, leaving the+ // open modal in m intact for the steps below.+ mLoading := m+ mLoading.detailModal = false+ mLoading.modalSource = ""+ mLoading.discovery = map[string]SourceDiscovery{"owner/repo": {Status: DiscoveryLoading}}+ if _, cmdLoading := mLoading.Update(tea.KeyMsg{Type: tea.KeyEnter}); cmdLoading != nil {+ t.Fatal("expected re-opening a loading source not to trigger discovery again")}// Let's set it to ready with some available skills@@ -2144,6 +2148,36 @@ func TestInteractiveSourceDetailModal(t *testing.T) {}}+func TestModalEnterInstallsAvailableSkill(t *testing.T) {+ m := appModel{width: 120, height: 32, detailModal: true, modalSource: "owner/repo", modalSelected: 1,+ result: model.ScanResult{Skills: []*model.Skill{+ {Name: "Installed", Scope: model.ScopeProject, LocalLock: &model.LocalLockEntry{Source: "owner/repo"}},+ }}}+ m.discovery = map[string]SourceDiscovery{+ "owner/repo": {Status: DiscoveryReady, Skills: []DiscoveredSkill{+ {Name: "Installed", Source: "owner/repo"},+ {Name: "Available", Source: "owner/repo"},+ }},+ }+ // modalSelected 1 = the available child.+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})+ next := updated.(appModel)+ if next.detailModal {+ t.Fatal("expected enter on available child to close the modal")+ }+ if !next.confirming || next.pendingAction == nil {+ t.Fatalf("expected enter to arm install confirmation, confirming=%v pending=%v", next.confirming, next.pendingAction)+ }+ if next.pendingAction.ID != "install_skill" {+ t.Fatalf("expected pending install_skill action, got %q", next.pendingAction.ID)+ }+ // Cancel clears the pending action.+ updated, _ = next.Update(tea.KeyMsg{Type: tea.KeyEsc})+ if c := updated.(appModel); c.confirming || c.pendingAction != nil {+ t.Fatalf("expected esc to clear confirm, confirming=%v pending=%v", c.confirming, c.pendingAction)+ }+}+func TestSourceDetailModalSelectionScrollsIntoView(t *testing.T) {discovered := make([]DiscoveredSkill, 0, 30)for i := 0; i < 30; i++ {diff --git a/internal/tui/update.go b/internal/tui/update.goindex 778e27c..5de4b20 100644--- a/internal/tui/update.go+++ b/internal/tui/update.go@@ -118,13 +118,42 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {return m.startSkillActionByID(child.skill, "remove")}}- case "c", "enter":- // Act on the selected child: open the action picker (install for- // an available skill, open/update/remove for an installed one).+ case "c":+ // Open the full action picker for the selected child.m.detailModal = falsem.commands = truem.action = 0m.syncViewport()+ case "enter":+ // Primary action on the selected child: install an available+ // skill (with confirm), or open an installed one.+ if m.modalSource != "" {+ if child, ok := m.currentModalSelectedChild(); ok {+ if child.isAvailable {+ for _, a := range actions.ForAvailableSkill(m.modalSource, child.discoveredSkill.Name) {+ if a.ID != "install_skill" || !a.Available {+ continue+ }+ m.detailModal = false+ m.modalSource = ""+ if a.RequiresConfirm {+ armed := a+ m.pendingAction = &armed+ m.confirming = true+ m.confirmInput = ""+ m.confirmError = ""+ m.syncViewport()+ return m, nil+ }+ return m.executeAction(a)+ }+ } else {+ m.detailModal = false+ m.modalSource = ""+ return m.startSkillActionByID(child.skill, "open_skill")+ }+ }+ }case "d":if m.modalSource != "" {modelTmp, cmd := m.startDiscovery(m.modalSource)@@ -196,11 +225,13 @@ func (m appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {m.confirming = falsem.confirmInput = ""m.confirmError = ""+ m.pendingAction = nilcase "n":if m.confirmInput == "" {m.confirming = falsem.confirmInput = ""m.confirmError = ""+ m.pendingAction = nil}case "pgdown", "ctrl+d", "pgup", "ctrl+u":var cmd tea.Cmd@@ -685,17 +716,23 @@ func preferredRemoveActionID(selectedCount int) string {}func (m appModel) confirmAction() (tea.Model, tea.Cmd) {- actions := m.currentActions()- if len(actions) == 0 || m.action >= len(actions) {- return m, nil+ var action actions.CommandPreview+ if m.pendingAction != nil {+ action = *m.pendingAction+ } else {+ acts := m.currentActions()+ if len(acts) == 0 || m.action >= len(acts) {+ return m, nil+ }+ action = acts[m.action]}- action := actions[m.action]if !confirmationAccepted(m.confirmInput, action.ConfirmValue) {m.confirmError = "Type yes, y, or the displayed phrase. Press Esc to cancel."m.confirmInput = ""m.syncViewport()return m, nil}+ m.pendingAction = nilreturn m.executeAction(action)}diff --git a/internal/tui/view.go b/internal/tui/view.goindex f887bf4..3e8d4c3 100644--- a/internal/tui/view.go+++ b/internal/tui/view.go@@ -1191,7 +1191,7 @@ func (m appModel) detailModalTitle() string {func (m appModel) detailModalHelpLine() string {if m.modalSource != "" {- return "esc/q close · ↑/↓ select · enter/c actions · d scan · o/u/x installed"+ return "esc/q close · ↑/↓ select · enter install/open · c more · d scan"}return "esc/q close · o open in editor · c command picker · ↑/↓ scroll"}@@ -1232,12 +1232,15 @@ func (m *appModel) ensureSourceModalSelectionVisible() {}func (m appModel) confirmationOverlay(layout appLayout) string {- actions := m.currentActions()title := "Confirm action"phrase := ""command := ""- if len(actions) > 0 && m.action < len(actions) {- action := actions[m.action]+ if m.pendingAction != nil {+ title = compat.SanitizeMetadata(m.pendingAction.Title)+ phrase = compat.SanitizeMetadata(m.pendingAction.ConfirmValue)+ command = compat.SanitizeMetadata(m.pendingAction.Command)+ } else if acts := m.currentActions(); len(acts) > 0 && m.action < len(acts) {+ action := acts[m.action]title = compat.SanitizeMetadata(action.Title)phrase = compat.SanitizeMetadata(action.ConfirmValue)command = compat.SanitizeMetadata(action.Command)