From 8f8082fe3da9e1972f8b8226c68fa14e326a3d8a Mon Sep 17 00:00:00 2001 From: Arya Gummadi Date: Mon, 18 Aug 2025 22:57:53 -0700 Subject: feat: add file change tracking to session metrics (#6094) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Jacob Richman --- packages/cli/src/ui/components/StatsDisplay.tsx | 47 ++++++++++++++++--------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'packages/cli/src/ui/components/StatsDisplay.tsx') diff --git a/packages/cli/src/ui/components/StatsDisplay.tsx b/packages/cli/src/ui/components/StatsDisplay.tsx index 71c88aef..8dd00efd 100644 --- a/packages/cli/src/ui/components/StatsDisplay.tsx +++ b/packages/cli/src/ui/components/StatsDisplay.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { Box, Text } from 'ink'; import Gradient from 'ink-gradient'; -import { Colors } from '../colors.js'; +import { theme } from '../semantic-colors.js'; import { formatDuration } from '../utils/formatters.js'; import { useSessionStats, ModelMetrics } from '../contexts/SessionContext.js'; import { @@ -29,7 +29,7 @@ const StatRow: React.FC = ({ title, children }) => ( {/* Fixed width for the label creates a clean "gutter" for alignment */} - {title} + {title} {children} @@ -111,12 +111,12 @@ const ModelUsageTable: React.FC<{ {modelMetrics.api.totalRequests} - + {modelMetrics.tokens.prompt.toLocaleString()} - + {modelMetrics.tokens.candidates.toLocaleString()} @@ -125,12 +125,12 @@ const ModelUsageTable: React.FC<{ {cacheEfficiency > 0 && ( - Savings Highlight:{' '} + Savings Highlight:{' '} {totalCachedTokens.toLocaleString()} ({cacheEfficiency.toFixed(1)} %) of input tokens were served from the cache, reducing costs. - + » Tip: For a full token breakdown, run `/stats model`. @@ -150,7 +150,7 @@ export const StatsDisplay: React.FC = ({ }) => { const { stats } = useSessionStats(); const { metrics } = stats; - const { models, tools } = metrics; + const { models, tools, files } = metrics; const computed = computeSessionStats(metrics); const successThresholds = { @@ -169,18 +169,18 @@ export const StatsDisplay: React.FC = ({ const renderTitle = () => { if (title) { - return Colors.GradientColors && Colors.GradientColors.length > 0 ? ( - + return theme.ui.gradient && theme.ui.gradient.length > 0 ? ( + {title} ) : ( - + {title} ); } return ( - + Session Stats ); @@ -189,7 +189,7 @@ export const StatsDisplay: React.FC = ({ return ( = ({ {tools.totalCalls} ({' '} - ✔ {tools.totalSuccess}{' '} - ✖ {tools.totalFail} ) + ✔ {tools.totalSuccess}{' '} + ✖ {tools.totalFail} ) @@ -215,12 +215,25 @@ export const StatsDisplay: React.FC = ({ {computed.agreementRate.toFixed(1)}%{' '} - + ({computed.totalDecisions} reviewed) )} + {files && + (files.totalLinesAdded > 0 || files.totalLinesRemoved > 0) && ( + + + + +{files.totalLinesAdded} + {' '} + + -{files.totalLinesRemoved} + + + + )}
@@ -233,7 +246,7 @@ export const StatsDisplay: React.FC = ({ {formatDuration(computed.totalApiTime)}{' '} - + ({computed.apiTimePercent.toFixed(1)}%) @@ -241,7 +254,7 @@ export const StatsDisplay: React.FC = ({ {formatDuration(computed.totalToolTime)}{' '} - + ({computed.toolTimePercent.toFixed(1)}%) -- cgit v1.2.3