From 9f3cfb05639602286f648ea3a5543955a9eec4d3 Mon Sep 17 00:00:00 2001 From: Castor Gemini Date: Sun, 24 Aug 2025 09:01:07 -0500 Subject: [PATCH] feat(stats): pipe session stats to regex --- .../cli/src/ui/components/StatsDisplay.tsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/StatsDisplay.tsx b/packages/cli/src/ui/components/StatsDisplay.tsx index bcf02906..7748ac45 100644 --- a/packages/cli/src/ui/components/StatsDisplay.tsx +++ b/packages/cli/src/ui/components/StatsDisplay.tsx @@ -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 = ({ 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,