Skip to content

Commit 8edbbcd

Browse files
Mag1ckgemini-code-assist[bot]jackwotherspoon
authored
feat(cli): add gemini --resume hint on exit (#16285)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Jack Wotherspoon <jackwoth@google.com>
1 parent 508af3a commit 8edbbcd

4 files changed

Lines changed: 24 additions & 9 deletions

File tree

packages/cli/src/ui/components/SessionSummaryDisplay.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ interface SessionSummaryDisplayProps {
1414
export const SessionSummaryDisplay: React.FC<SessionSummaryDisplayProps> = ({
1515
duration,
1616
}) => (
17-
<StatsDisplay title="Agent powering down. Goodbye!" duration={duration} />
17+
<StatsDisplay
18+
title="Agent powering down. Goodbye!"
19+
duration={duration}
20+
footer="Tip: Resume a previous session using gemini --resume or /resume"
21+
/>
1822
);

packages/cli/src/ui/components/StatsDisplay.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const ModelUsageTable: React.FC<{
178178
: `Model Usage`;
179179

180180
return (
181-
<Box flexDirection="column" marginTop={1}>
181+
<Box flexDirection="column" marginBottom={1}>
182182
{/* Header */}
183183
<Box alignItems="flex-end">
184184
<Box width={nameWidth}>
@@ -379,6 +379,7 @@ interface StatsDisplayProps {
379379
duration: string;
380380
title?: string;
381381
quotas?: RetrieveUserQuotaResponse;
382+
footer?: string;
382383
selectedAuthType?: string;
383384
userEmail?: string;
384385
tier?: string;
@@ -390,6 +391,7 @@ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
390391
duration,
391392
title,
392393
quotas,
394+
footer,
393395
selectedAuthType,
394396
userEmail,
395397
tier,
@@ -433,6 +435,13 @@ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
433435
);
434436
};
435437

438+
const renderFooter = () => {
439+
if (!footer) {
440+
return null;
441+
}
442+
return <ThemedGradient bold>{footer}</ThemedGradient>;
443+
};
444+
436445
return (
437446
<Box
438447
borderStyle="round"
@@ -536,6 +545,7 @@ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
536545
pooledLimit={pooledLimit}
537546
pooledResetTime={pooledResetTime}
538547
/>
548+
{renderFooter()}
539549
</Box>
540550
);
541551
};

packages/cli/src/ui/components/__snapshots__/SessionSummaryDisplay.test.tsx.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ exports[`<SessionSummaryDisplay /> > renders the summary display with a title 1`
1717
│ » API Time: 50.2s (100.0%) │
1818
│ » Tool Time: 0s (0.0%) │
1919
│ │
20-
│ │
2120
│ Model Usage │
2221
│ Model Reqs Input Tokens Cache Reads Output Tokens │
2322
│ ──────────────────────────────────────────────────────────────────────────── │
2423
│ gemini-2.5-pro 10 500 500 2,000 │
2524
│ │
2625
│ Savings Highlight: 500 (50.0%) of input tokens were served from the cache, reducing costs. │
26+
│ │
27+
│ Tip: Resume a previous session using gemini --resume or /resume │
2728
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
2829
`;

packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ exports[`<StatsDisplay /> > Conditional Rendering Tests > hides Efficiency secti
112112
│ » API Time: 100ms (100.0%) │
113113
│ » Tool Time: 0s (0.0%) │
114114
│ │
115-
│ │
116115
│ Model Usage │
117116
│ Model Reqs Input Tokens Cache Reads Output Tokens │
118117
│ ──────────────────────────────────────────────────────────────────────────── │
119118
│ gemini-2.5-pro 1 100 0 100 │
119+
│ │
120120
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
121121
`;
122122

@@ -155,7 +155,6 @@ exports[`<StatsDisplay /> > Quota Display > renders pooled quota information for
155155
│ » API Time: 0s (0.0%) │
156156
│ » Tool Time: 0s (0.0%) │
157157
│ │
158-
│ │
159158
│ auto Usage │
160159
│ 65% usage remaining │
161160
│ Usage limit: 1,100 │
@@ -166,6 +165,7 @@ exports[`<StatsDisplay /> > Quota Display > renders pooled quota information for
166165
│ ──────────────────────────────────────────────────────────── │
167166
│ gemini-2.5-pro - │
168167
│ gemini-2.5-flash - │
168+
│ │
169169
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
170170
`;
171171

@@ -185,11 +185,11 @@ exports[`<StatsDisplay /> > Quota Display > renders quota information for unused
185185
│ » API Time: 0s (0.0%) │
186186
│ » Tool Time: 0s (0.0%) │
187187
│ │
188-
│ │
189188
│ Model Usage │
190189
│ Model Reqs Usage remaining │
191190
│ ──────────────────────────────────────────────────────────── │
192191
│ gemini-2.5-flash - 50.0% resets in 2h │
192+
│ │
193193
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
194194
`;
195195

@@ -209,11 +209,11 @@ exports[`<StatsDisplay /> > Quota Display > renders quota information when quota
209209
│ » API Time: 100ms (100.0%) │
210210
│ » Tool Time: 0s (0.0%) │
211211
│ │
212-
│ │
213212
│ Model Usage │
214213
│ Model Reqs Usage remaining │
215214
│ ──────────────────────────────────────────────────────────── │
216215
│ gemini-2.5-pro 1 75.0% resets in 1h 30m │
216+
│ │
217217
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
218218
`;
219219

@@ -271,14 +271,14 @@ exports[`<StatsDisplay /> > renders a table with two models correctly 1`] = `
271271
│ » API Time: 19.5s (100.0%) │
272272
│ » Tool Time: 0s (0.0%) │
273273
│ │
274-
│ │
275274
│ Model Usage │
276275
│ Model Reqs Input Tokens Cache Reads Output Tokens │
277276
│ ──────────────────────────────────────────────────────────────────────────── │
278277
│ gemini-2.5-pro 3 500 500 2,000 │
279278
│ gemini-2.5-flash 5 15,000 10,000 15,000 │
280279
│ │
281280
│ Savings Highlight: 10,500 (40.4%) of input tokens were served from the cache, reducing costs. │
281+
│ │
282282
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
283283
`;
284284

@@ -299,13 +299,13 @@ exports[`<StatsDisplay /> > renders all sections when all data is present 1`] =
299299
│ » API Time: 100ms (44.8%) │
300300
│ » Tool Time: 123ms (55.2%) │
301301
│ │
302-
│ │
303302
│ Model Usage │
304303
│ Model Reqs Input Tokens Cache Reads Output Tokens │
305304
│ ──────────────────────────────────────────────────────────────────────────── │
306305
│ gemini-2.5-pro 1 50 50 100 │
307306
│ │
308307
│ Savings Highlight: 50 (50.0%) of input tokens were served from the cache, reducing costs. │
308+
│ │
309309
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
310310
`;
311311

0 commit comments

Comments
 (0)