feat(stats): pipe session stats to regex
This commit is contained in:
parent
8958ea6514
commit
9f3cfb0563
|
@ -4,7 +4,8 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* 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 { Box, Text } from 'ink';
|
||||||
import Gradient from 'ink-gradient';
|
import Gradient from 'ink-gradient';
|
||||||
import { theme } from '../semantic-colors.js';
|
import { theme } from '../semantic-colors.js';
|
||||||
|
@ -155,6 +156,24 @@ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
|
||||||
const { models, tools, files } = metrics;
|
const { models, tools, files } = metrics;
|
||||||
const computed = computeSessionStats(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 = {
|
const successThresholds = {
|
||||||
green: TOOL_SUCCESS_RATE_HIGH,
|
green: TOOL_SUCCESS_RATE_HIGH,
|
||||||
yellow: TOOL_SUCCESS_RATE_MEDIUM,
|
yellow: TOOL_SUCCESS_RATE_MEDIUM,
|
||||||
|
|
Loading…
Reference in New Issue