summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.ts
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-06-11 16:40:31 -0400
committerGitHub <[email protected]>2025-06-11 16:40:31 -0400
commit7a72d255d8effec1396170306cc6be57f598a6d8 (patch)
treeeab86a4d4d5f145a033eed06d16dedeba7b23a37 /packages/cli/src/ui/hooks/slashCommandProcessor.ts
parent4160d904da8328eb7168b5b652d4c0f17682546c (diff)
feat: Add exit UI w/ stats (#924)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts23
1 files changed, 21 insertions, 2 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index 3699b4e9..8e2f2bd2 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -97,6 +97,12 @@ export const useSlashCommandProcessor = (
lastTurnStats: message.lastTurnStats,
duration: message.duration,
};
+ } else if (message.type === MessageType.QUIT) {
+ historyItemContent = {
+ type: 'quit',
+ stats: message.stats,
+ duration: message.duration,
+ };
} else {
historyItemContent = {
type: message.type as
@@ -594,8 +600,20 @@ Add any other context about the problem here.
altName: 'exit',
description: 'exit the cli',
action: async (_mainCommand, _subCommand, _args) => {
- onDebugMessage('Quitting. Good-bye.');
- process.exit(0);
+ 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(),
+ });
+
+ setTimeout(() => {
+ process.exit(0);
+ }, 100);
},
},
];
@@ -721,6 +739,7 @@ Add any other context about the problem here.
session,
gitService,
loadHistory,
+ addItem,
]);
const handleSlashCommand = useCallback(