diff options
| author | N. Taylor Mullen <[email protected]> | 2025-06-01 15:48:48 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-01 22:48:48 +0000 |
| commit | c51d6cc9d34bb3ff083f359cdd300502ea901ec8 (patch) | |
| tree | ed0803b949d0b4a163710c672c83d5593ddeff5c /packages/cli/src/ui/components/ContextSummaryDisplay.tsx | |
| parent | f7a2442faca5e3c51bab753672130968456a4c23 (diff) | |
fix: Display MCP server count in context summary (#674)
Diffstat (limited to 'packages/cli/src/ui/components/ContextSummaryDisplay.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/ContextSummaryDisplay.tsx | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/packages/cli/src/ui/components/ContextSummaryDisplay.tsx b/packages/cli/src/ui/components/ContextSummaryDisplay.tsx new file mode 100644 index 00000000..3cfb4d8d --- /dev/null +++ b/packages/cli/src/ui/components/ContextSummaryDisplay.tsx @@ -0,0 +1,51 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import React from 'react'; +import { Text } from 'ink'; +import { Colors } from '../colors.js'; +import { type MCPServerConfig } from '@gemini-code/core'; + +interface ContextSummaryDisplayProps { + geminiMdFileCount: number; + contextFileName: string; + mcpServers?: Record<string, MCPServerConfig>; +} + +export const ContextSummaryDisplay: React.FC<ContextSummaryDisplayProps> = ({ + geminiMdFileCount, + contextFileName, + mcpServers, +}) => { + const mcpServerCount = Object.keys(mcpServers || {}).length; + + if (geminiMdFileCount === 0 && mcpServerCount === 0) { + return <Text> </Text>; // Render an empty space to reserve height + } + + const geminiMdText = + geminiMdFileCount > 0 + ? `${geminiMdFileCount} ${contextFileName} file${geminiMdFileCount > 1 ? 's' : ''}` + : ''; + + const mcpText = + mcpServerCount > 0 + ? `${mcpServerCount} MCP server${mcpServerCount > 1 ? 's' : ''}` + : ''; + + let summaryText = 'Using '; + if (geminiMdText) { + summaryText += geminiMdText; + } + if (geminiMdText && mcpText) { + summaryText += ' and '; + } + if (mcpText) { + summaryText += mcpText; + } + + return <Text color={Colors.SubtleComment}>{summaryText}</Text>; +}; |
