From 8e6a565adbec90d2216fbc2e06d10bf9f0c0c1bf Mon Sep 17 00:00:00 2001
From: Pyush Sinha <pyushsinha20@gmail.com>
Date: Thu, 7 Aug 2025 11:16:47 -0700
Subject: fix: re render context usage indicator  (#5102)

---
 .../cli/src/ui/components/ContextUsageDisplay.tsx  | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 packages/cli/src/ui/components/ContextUsageDisplay.tsx

(limited to 'packages/cli/src/ui/components/ContextUsageDisplay.tsx')

diff --git a/packages/cli/src/ui/components/ContextUsageDisplay.tsx b/packages/cli/src/ui/components/ContextUsageDisplay.tsx
new file mode 100644
index 00000000..037be333
--- /dev/null
+++ b/packages/cli/src/ui/components/ContextUsageDisplay.tsx
@@ -0,0 +1,25 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import { Text } from 'ink';
+import { Colors } from '../colors.js';
+import { tokenLimit } from '@google/gemini-cli-core';
+
+export const ContextUsageDisplay = ({
+  promptTokenCount,
+  model,
+}: {
+  promptTokenCount: number;
+  model: string;
+}) => {
+  const percentage = promptTokenCount / tokenLimit(model);
+
+  return (
+    <Text color={Colors.Gray}>
+      ({((1 - percentage) * 100).toFixed(0)}% context left)
+    </Text>
+  );
+};
-- 
cgit v1.2.3

