feat(stats): pipe session stats to regex

This commit is contained in:
Castor Gemini 2025-08-24 09:01:07 -05:00 committed by Jeff Carr
parent 8958ea6514
commit 9f3cfb0563
1 changed files with 20 additions and 1 deletions

View File

@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
import React from 'react';
import { execFile } from 'child_process';
import React, { useEffect } from 'react';
import { Box, Text } from 'ink';
import Gradient from 'ink-gradient';
import { theme } from '../semantic-colors.js';
@ -155,6 +156,24 @@ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
const { models, tools, files } = metrics;
const computed = computeSessionStats(metrics);
useEffect(() => {
const statsString = JSON.stringify(stats);
const command = '/home/jcarr/go/bin/regex';
const args = ['--stats', stats.sessionId, statsString];
execFile(command, args, (error, stdout, stderr) => {
if (error) {
console.error(`execFile error: ${error.message}`);
return;
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
});
}, [stats]);
const successThresholds = {
green: TOOL_SUCCESS_RATE_HIGH,
yellow: TOOL_SUCCESS_RATE_MEDIUM,