summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.ts
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-06-11 20:08:32 -0400
committerGitHub <[email protected]>2025-06-11 20:08:32 -0400
commitdd53e5c96aa01708a3bdb675c8a8e0d71be35651 (patch)
tree89dda4690c0d81dadc47b3e5bba6ad190e783985 /packages/cli/src/ui/hooks/slashCommandProcessor.ts
parente02a035ab4d1c534c05a4cd6ee50878d90e6aaef (diff)
Show session summary on exit for ctrl+c x 2. Fix exit UI (#963)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts30
1 files changed, 22 insertions, 8 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index 478a62a3..d343c6ff 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -69,6 +69,7 @@ export const useSlashCommandProcessor = (
performMemoryRefresh: () => Promise<void>,
toggleCorgiMode: () => void,
showToolDescriptions: boolean = false,
+ setQuittingMessages: (message: HistoryItem[]) => void,
) => {
const session = useSessionStats();
const gitService = useMemo(() => {
@@ -608,17 +609,24 @@ Add any other context about the problem here.
name: 'quit',
altName: 'exit',
description: 'exit the cli',
- action: async (_mainCommand, _subCommand, _args) => {
+ action: async (mainCommand, _subCommand, _args) => {
const now = new Date();
const { sessionStartTime, cumulative } = session.stats;
const wallDuration = now.getTime() - sessionStartTime.getTime();
- addMessage({
- type: MessageType.QUIT,
- stats: cumulative,
- duration: formatDuration(wallDuration),
- timestamp: new Date(),
- });
+ setQuittingMessages([
+ {
+ type: 'user',
+ text: `/${mainCommand}`,
+ id: now.getTime() - 1,
+ },
+ {
+ type: 'quit',
+ stats: cumulative,
+ duration: formatDuration(wallDuration),
+ id: now.getTime(),
+ },
+ ]);
setTimeout(() => {
process.exit(0);
@@ -749,6 +757,7 @@ Add any other context about the problem here.
gitService,
loadHistory,
addItem,
+ setQuittingMessages,
]);
const handleSlashCommand = useCallback(
@@ -763,7 +772,12 @@ Add any other context about the problem here.
return false;
}
const userMessageTimestamp = Date.now();
- addItem({ type: MessageType.USER, text: trimmed }, userMessageTimestamp);
+ if (trimmed !== '/quit' && trimmed !== '/exit') {
+ addItem(
+ { type: MessageType.USER, text: trimmed },
+ userMessageTimestamp,
+ );
+ }
let subCommand: string | undefined;
let args: string | undefined;