summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.ts
diff options
context:
space:
mode:
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;