summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/utils')
-rw-r--r--packages/cli/src/ui/utils/computeStats.test.ts45
-rw-r--r--packages/cli/src/ui/utils/computeStats.ts4
2 files changed, 48 insertions, 1 deletions
diff --git a/packages/cli/src/ui/utils/computeStats.test.ts b/packages/cli/src/ui/utils/computeStats.test.ts
index 0e32ffe2..e9085fb3 100644
--- a/packages/cli/src/ui/utils/computeStats.test.ts
+++ b/packages/cli/src/ui/utils/computeStats.test.ts
@@ -121,6 +121,10 @@ describe('computeSessionStats', () => {
totalDecisions: { accept: 0, reject: 0, modify: 0 },
byName: {},
},
+ files: {
+ totalLinesAdded: 0,
+ totalLinesRemoved: 0,
+ },
};
const result = computeSessionStats(metrics);
@@ -137,6 +141,8 @@ describe('computeSessionStats', () => {
agreementRate: 0,
totalPromptTokens: 0,
totalCachedTokens: 0,
+ totalLinesAdded: 0,
+ totalLinesRemoved: 0,
});
});
@@ -163,6 +169,10 @@ describe('computeSessionStats', () => {
totalDecisions: { accept: 0, reject: 0, modify: 0 },
byName: {},
},
+ files: {
+ totalLinesAdded: 0,
+ totalLinesRemoved: 0,
+ },
};
const result = computeSessionStats(metrics);
@@ -197,6 +207,10 @@ describe('computeSessionStats', () => {
totalDecisions: { accept: 0, reject: 0, modify: 0 },
byName: {},
},
+ files: {
+ totalLinesAdded: 0,
+ totalLinesRemoved: 0,
+ },
};
const result = computeSessionStats(metrics);
@@ -215,6 +229,10 @@ describe('computeSessionStats', () => {
totalDecisions: { accept: 6, reject: 2, modify: 2 },
byName: {},
},
+ files: {
+ totalLinesAdded: 0,
+ totalLinesRemoved: 0,
+ },
};
const result = computeSessionStats(metrics);
@@ -234,6 +252,10 @@ describe('computeSessionStats', () => {
totalDecisions: { accept: 0, reject: 0, modify: 0 },
byName: {},
},
+ files: {
+ totalLinesAdded: 0,
+ totalLinesRemoved: 0,
+ },
};
const result = computeSessionStats(metrics);
@@ -244,4 +266,27 @@ describe('computeSessionStats', () => {
expect(result.successRate).toBe(0);
expect(result.agreementRate).toBe(0);
});
+
+ it('should correctly include line counts', () => {
+ const metrics: SessionMetrics = {
+ models: {},
+ tools: {
+ totalCalls: 0,
+ totalSuccess: 0,
+ totalFail: 0,
+ totalDurationMs: 0,
+ totalDecisions: { accept: 0, reject: 0, modify: 0 },
+ byName: {},
+ },
+ files: {
+ totalLinesAdded: 42,
+ totalLinesRemoved: 18,
+ },
+ };
+
+ const result = computeSessionStats(metrics);
+
+ expect(result.totalLinesAdded).toBe(42);
+ expect(result.totalLinesRemoved).toBe(18);
+ });
});
diff --git a/packages/cli/src/ui/utils/computeStats.ts b/packages/cli/src/ui/utils/computeStats.ts
index e0483c3b..ec7c49fa 100644
--- a/packages/cli/src/ui/utils/computeStats.ts
+++ b/packages/cli/src/ui/utils/computeStats.ts
@@ -34,7 +34,7 @@ export function calculateCacheHitRate(metrics: ModelMetrics): number {
export const computeSessionStats = (
metrics: SessionMetrics,
): ComputedSessionStats => {
- const { models, tools } = metrics;
+ const { models, tools, files } = metrics;
const totalApiTime = Object.values(models).reduce(
(acc, model) => acc + model.api.totalLatencyMs,
0,
@@ -80,5 +80,7 @@ export const computeSessionStats = (
agreementRate,
totalCachedTokens,
totalPromptTokens,
+ totalLinesAdded: files.totalLinesAdded,
+ totalLinesRemoved: files.totalLinesRemoved,
};
};