Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/app/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (a *Application) handleCommand(input string) {
switch parts[0] {
case "/model":
a.cmdModel(parts[1:])
case "/exit":
case "/exit", "/quit":
a.cmdExit()
case "/compact":
a.cmdCompact()
Expand Down Expand Up @@ -367,6 +367,7 @@ func (a *Application) cmdHelp() {
/permission [tool] [level] Manage tool permissions
/yolo Toggle auto-approve mode
/exit Exit the application
/quit Exit the application
/compact Compact conversation context to save tokens
/clear Clear chat history
/help Show this help message
Expand Down
20 changes: 20 additions & 0 deletions internal/app/commands_exit_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package app

import (
"testing"
"time"

"github.com/vigo999/ms-cli/ui/model"
)

func TestProcessInputQuitTriggersExit(t *testing.T) {
app := newTestApp()

app.processInput("/quit")

_ = drainUntil(t, app, model.AgentReply, 2*time.Second)
done := drainUntil(t, app, model.Done, 2*time.Second)
if done.Type != model.Done {
t.Fatalf("expected done event, got %s", done.Type)
}
}
6 changes: 6 additions & 0 deletions ui/slash/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ func (r *Registry) registerDefaults() {
Usage: "/exit",
})

r.Register(Command{
Name: "/quit",
Description: "Exit the application",
Usage: "/quit",
})

r.Register(Command{
Name: "/compact",
Description: "Compact conversation context",
Expand Down
29 changes: 29 additions & 0 deletions ui/slash/commands_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package slash

import "testing"

func TestDefaultRegistryIncludesQuit(t *testing.T) {
r := NewRegistry()

if _, ok := r.Get("/quit"); !ok {
t.Fatal("expected /quit command to be registered")
}
}

func TestSuggestionsIncludesQuitPrefix(t *testing.T) {
r := NewRegistry()

suggestions := r.Suggestions("/q")
if !contains(suggestions, "/quit") {
t.Fatalf("expected /quit in suggestions for /q, got %v", suggestions)
}
}

func contains(items []string, target string) bool {
for _, item := range items {
if item == target {
return true
}
}
return false
}