diff options
| author | Jeff Carr <[email protected]> | 2025-08-30 19:38:21 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-30 19:38:21 -0500 |
| commit | d2f1e43d1d6048c17fa736eab16de045747b3e2e (patch) | |
| tree | f4e3a0d05d654ea7fa4c99cd40f7fcb254f9840a | |
| parent | 726584146d53e47d4e10c716d7811aab54bcb569 (diff) | |
minor fixes
| -rw-r--r-- | packages/cli/src/ui/App.tsx | 8 | ||||
| -rw-r--r-- | packages/core/src/core/loggingContentGenerator.ts | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index ebd24e97..c5a49684 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -86,6 +86,7 @@ import { KeypressProvider } from './contexts/KeypressContext.js'; import { useKittyKeyboardProtocol } from './hooks/useKittyKeyboardProtocol.js'; import { keyMatchers, Command } from './keyMatchers.js'; import * as fs from 'fs'; +import * as path from 'path'; import { UpdateNotification } from './components/UpdateNotification.js'; import { isProQuotaExceededError, @@ -643,6 +644,13 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { previousStreamingState.current = streamingState; }, [streamingState, sessionStats.sessionId]); + useEffect(() => { + process.on('exit', () => { + const statsPath = path.join('/tmp', `regex.${sessionStats.sessionId}.stats`); + fs.writeFileSync(statsPath, JSON.stringify(sessionStats, null, 2)); + }); + }, [sessionStats]); + const handleIdePromptComplete = useCallback( (result: IdeIntegrationNudgeResult) => { if (result.userSelection === 'yes') { diff --git a/packages/core/src/core/loggingContentGenerator.ts b/packages/core/src/core/loggingContentGenerator.ts index 3c1feb62..7cf20a66 100644 --- a/packages/core/src/core/loggingContentGenerator.ts +++ b/packages/core/src/core/loggingContentGenerator.ts @@ -30,7 +30,7 @@ import { import { ContentGenerator } from './contentGenerator.js'; import { toContents } from '../code_assist/converter.js'; import { isStructuredError } from '../utils/quotaErrorDetection.js'; -import { ExecException } from 'child_process'; +import { ExecException, exec } from 'child_process'; interface StructuredError { status: number; @@ -119,7 +119,6 @@ export class LoggingContentGenerator implements ContentGenerator { const jsonPayload = JSON.stringify(req, null, 2); fs.writeFileSync(filePath, jsonPayload); this.requestCounter++; - const { exec } = require('child_process'); exec(`regex --json ${filePath}`, (error: ExecException | null, stdout: string, stderr: string) => { if (error) { console.error(`exec error: ${error}`); @@ -157,7 +156,6 @@ export class LoggingContentGenerator implements ContentGenerator { const jsonPayload = JSON.stringify(req, null, 2); fs.writeFileSync(filePath, jsonPayload); this.requestCounter++; - const { exec } = require('child_process'); exec(`regex --json ${filePath}`, (error: ExecException | null, stdout: string, stderr: string) => { if (error) { console.error(`exec error: ${error}`); |
