From f9331ca7be85937b00f9534e89ee12efc4a6a2ff Mon Sep 17 00:00:00 2001 From: David Gageot Date: Fri, 26 Dec 2025 12:37:56 +0100 Subject: [PATCH] Add /exit command Signed-off-by: David Gageot --- pkg/tui/commands/commands.go | 10 ++++++++++ pkg/tui/messages/messages.go | 1 + pkg/tui/tui.go | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/pkg/tui/commands/commands.go b/pkg/tui/commands/commands.go index 7a126f7c0..a7c63e0ae 100644 --- a/pkg/tui/commands/commands.go +++ b/pkg/tui/commands/commands.go @@ -31,6 +31,16 @@ type Item struct { func builtInSessionCommands() []Item { return []Item{ + { + ID: "session.exit", + Label: "Exit", + SlashCommand: "/exit", + Description: "Exit the application", + Category: "Session", + Execute: func() tea.Cmd { + return core.CmdHandler(messages.ExitSessionMsg{}) + }, + }, { ID: "session.new", Label: "New", diff --git a/pkg/tui/messages/messages.go b/pkg/tui/messages/messages.go index eae8ecba7..c19e71ffa 100644 --- a/pkg/tui/messages/messages.go +++ b/pkg/tui/messages/messages.go @@ -3,6 +3,7 @@ package messages // Session command messages type ( NewSessionMsg struct{} + ExitSessionMsg struct{} EvalSessionMsg struct{ Filename string } CompactSessionMsg struct{} CopySessionToClipboardMsg struct{} diff --git a/pkg/tui/tui.go b/pkg/tui/tui.go index 3d9a07902..d5c3cc31b 100644 --- a/pkg/tui/tui.go +++ b/pkg/tui/tui.go @@ -214,6 +214,11 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { a.chatPage = updated.(chat.Page) return a, cmd + case messages.ExitSessionMsg: + return a, core.CmdHandler(dialog.OpenDialogMsg{ + Model: dialog.NewExitConfirmationDialog(), + }) + case messages.NewSessionMsg: a.application.NewSession() sess := a.application.Session()