minor fixes

This commit is contained in:
Jeff Carr 2025-08-30 19:38:21 -05:00
parent 726584146d
commit d2f1e43d1d
2 changed files with 9 additions and 3 deletions

View File

@ -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') {

View File

@ -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}`);