Skip to content

mission control for agent skills

fix(tui): accept y for dangerous confirmations

Alvin Unreal71a3c99c491f
diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go
index f6b900e..b18ce40 100644
--- a/internal/tui/tui_test.go
+++ b/internal/tui/tui_test.go
@@ -1345,7 +1345,7 @@ func TestSingleRemoveRequiresYesConfirmation(t *testing.T) {
}
updated, cmd := m.Update(tea.KeyMsg{Type: tea.KeyEnter})
m = updated.(appModel)
- if cmd != nil || !m.confirming || !strings.Contains(m.confirmError, "Type yes") || m.actionResult != nil {
+ if cmd != nil || !m.confirming || !strings.Contains(m.confirmError, "Type y or yes") || m.actionResult != nil {
t.Fatalf("expected inline confirmation error without command, confirming=%v err=%q result=%#v cmd=%v", m.confirming, m.confirmError, m.actionResult, cmd)
}
}
@@ -1362,31 +1362,35 @@ func TestSingleRemoveRejectsSkillNameConfirmation(t *testing.T) {
}
updated, cmd := m.Update(tea.KeyMsg{Type: tea.KeyEnter})
m = updated.(appModel)
- if cmd != nil || !m.confirming || !strings.Contains(m.confirmError, "Type yes") {
+ if cmd != nil || !m.confirming || !strings.Contains(m.confirmError, "Type y or yes") {
t.Fatalf("expected skill name not to confirm deletion, confirming=%v err=%q cmd=%v", m.confirming, m.confirmError, cmd)
}
}
-func TestSingleRemoveAcceptsYesConfirmation(t *testing.T) {
- old := runExec
- runExec = func(spec runner.ExecSpec) runner.Result {
- return runner.Result{Program: spec.Program, Args: spec.Args, Cwd: spec.Cwd, ExitCode: 0}
- }
- t.Cleanup(func() { runExec = old })
+func TestSingleRemoveAcceptsYOrYesConfirmation(t *testing.T) {
+ for _, input := range []string{"y", "yes"} {
+ t.Run(input, func(t *testing.T) {
+ old := runExec
+ runExec = func(spec runner.ExecSpec) runner.Result {
+ return runner.Result{Program: spec.Program, Args: spec.Args, Cwd: spec.Cwd, ExitCode: 0}
+ }
+ t.Cleanup(func() { runExec = old })
- m := actionTestModel(t.TempDir())
- m.commands = true
- m.action = actionIndex(t, m, "Remove selected skill")
- updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})
- m = updated.(appModel)
- for _, r := range []rune("yes") {
- updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{r}})
- m = updated.(appModel)
- }
- updated, cmd := m.Update(tea.KeyMsg{Type: tea.KeyEnter})
- m = updated.(appModel)
- if cmd == nil || !m.running {
- t.Fatalf("expected yes to run single remove, running=%v cmd=%v", m.running, cmd)
+ m := actionTestModel(t.TempDir())
+ m.commands = true
+ m.action = actionIndex(t, m, "Remove selected skill")
+ updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})
+ m = updated.(appModel)
+ for _, r := range []rune(input) {
+ updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{r}})
+ m = updated.(appModel)
+ }
+ updated, cmd := m.Update(tea.KeyMsg{Type: tea.KeyEnter})
+ m = updated.(appModel)
+ if cmd == nil || !m.running {
+ t.Fatalf("expected %q to run single remove, running=%v cmd=%v", input, m.running, cmd)
+ }
+ })
}
}
@@ -1460,8 +1464,8 @@ func TestConfirmationOverlayCopyMatchesRisk(t *testing.T) {
m.action = actionIndex(t, m, "Remove selected skill")
dangerOut := m.confirmationOverlay(appLayout{Width: 120, Height: 32})
- if !strings.Contains(dangerOut, "Type yes to confirm") || strings.Contains(dangerOut, `Type "deploy-skill"`) || strings.Contains(dangerOut, "y / yes") {
- t.Fatalf("expected single-remove yes-only copy, got %q", dangerOut)
+ if !strings.Contains(dangerOut, "Type y or yes to confirm") || strings.Contains(dangerOut, `Type "deploy-skill"`) {
+ t.Fatalf("expected single-remove y/yes copy, got %q", dangerOut)
}
m = bulkActionTestModel(t.TempDir())
@@ -1470,8 +1474,8 @@ func TestConfirmationOverlayCopyMatchesRisk(t *testing.T) {
m.action = actionIndex(t, m, "Remove 2 selected skills")
m.confirming = true
bulkOut := m.confirmationOverlay(appLayout{Width: 120, Height: 32})
- if !strings.Contains(bulkOut, `Remove 2 selected skills`) || !strings.Contains(bulkOut, `Type yes to confirm`) || strings.Contains(bulkOut, "y / yes") {
- t.Fatalf("expected bulk-remove yes-only copy, got %q", bulkOut)
+ if !strings.Contains(bulkOut, `Remove 2 selected skills`) || !strings.Contains(bulkOut, `Type y or yes to confirm`) {
+ t.Fatalf("expected bulk-remove y/yes copy, got %q", bulkOut)
}
}
diff --git a/internal/tui/update.go b/internal/tui/update.go
index 074070e..59a2d37 100644
--- a/internal/tui/update.go
+++ b/internal/tui/update.go
@@ -986,7 +986,7 @@ func (m appModel) confirmAction() (tea.Model, tea.Cmd) {
func confirmationAccepted(input string, action actions.CommandPreview) bool {
value := strings.TrimSpace(strings.ToLower(input))
if action.Dangerous {
- return value == "yes"
+ return value == "y" || value == "yes"
}
if value == "" {
return true
@@ -996,7 +996,7 @@ func confirmationAccepted(input string, action actions.CommandPreview) bool {
func confirmationError(action actions.CommandPreview) string {
if action.Dangerous {
- return "Type yes to confirm, or press Esc to cancel."
+ return "Type y or yes to confirm, or press Esc to cancel."
}
return "Press Enter to continue, or Esc to cancel."
}
diff --git a/internal/tui/view.go b/internal/tui/view.go
index da33544..33a882b 100644
--- a/internal/tui/view.go
+++ b/internal/tui/view.go
@@ -1306,7 +1306,7 @@ func (m appModel) footerText(width int, rows []skillsRow, actions []actions.Comm
if m.running {
text = "Working…"
} else if m.confirming {
- text = "type yes · enter confirm · esc cancel"
+ text = "type y/yes · enter confirm · esc cancel"
} else if m.searching {
text = "type search · enter apply · esc cancel · backspace edit"
} else if m.detailModal {
@@ -1582,8 +1582,8 @@ func (m appModel) confirmationOverlay(layout appLayout) string {
if dangerous {
headerStyle = errorStyle.Bold(true)
borderColor = lipgloss.Color("203")
- placeholder = "yes"
- instruction = "Type yes to confirm, or Esc to cancel."
+ placeholder = "y / yes"
+ instruction = "Type y or yes to confirm, or Esc to cancel."
}
lines := []string{
headerStyle.Render(title),