summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.ts
diff options
context:
space:
mode:
authorCastor Regex <[email protected]>2025-08-24 09:30:39 -0500
committerJeff Carr <[email protected]>2025-08-24 09:30:39 -0500
commitd12a64368dc7a46a2e7d397d6bd10b03ae396678 (patch)
tree79cfb1aaeecc0f8c8b49a3fad5d35cd3025b2393 /packages/cli/src/ui/hooks/slashCommandProcessor.ts
parent1ff70eeef8f3d685f4e21964fbfeefe1662bfeaa (diff)
feat(stats): save stats on exit
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts22
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index 44a3c2fa..9aa13ca2 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
+import { execFile } from 'child_process';
import { useCallback, useMemo, useEffect, useState } from 'react';
import { type PartListUnion } from '@google/genai';
import process from 'node:process';
@@ -403,11 +404,22 @@ export const useSlashCommandProcessor = (
return { type: 'handled' };
}
case 'quit':
- setQuittingMessages(result.messages);
- setTimeout(async () => {
- await runExitCleanup();
- process.exit(0);
- }, 100);
+ const statsString = JSON.stringify(session.stats);
+ const command = '/home/jcarr/go/bin/regex';
+ const args = ['--stats', session.stats.sessionId, statsString];
+ execFile(command, args, (error, stdout, stderr) => {
+ if (error) {
+ console.error(`execFile error: ${error.message}`);
+ }
+ if (stderr) {
+ console.error(`stderr: ${stderr}`);
+ }
+ setQuittingMessages(result.messages);
+ setTimeout(async () => {
+ await runExitCleanup();
+ process.exit(0);
+ }, 100);
+ });
return { type: 'handled' };
case 'submit_prompt':