buroventures-harald-code
Version:
Harald Code - AI-powered coding assistant CLI
68 lines • 2.6 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Text } from 'ink';
import { Colors } from '../colors.js';
export const ContextSummaryDisplay = ({ geminiMdFileCount, contextFileNames, mcpServers, blockedMcpServers, showToolDescriptions, ideContext, }) => {
const mcpServerCount = Object.keys(mcpServers || {}).length;
const blockedMcpServerCount = blockedMcpServers?.length || 0;
const openFileCount = ideContext?.workspaceState?.openFiles?.length ?? 0;
if (geminiMdFileCount === 0 &&
mcpServerCount === 0 &&
blockedMcpServerCount === 0 &&
openFileCount === 0) {
return _jsx(Text, { children: " " }); // Render an empty space to reserve height
}
const openFilesText = (() => {
if (openFileCount === 0) {
return '';
}
return `${openFileCount} open file${openFileCount > 1 ? 's' : ''} (ctrl+e to view)`;
})();
const geminiMdText = (() => {
if (geminiMdFileCount === 0) {
return '';
}
const allNamesTheSame = new Set(contextFileNames).size < 2;
const name = allNamesTheSame ? contextFileNames[0] : 'context';
return `${geminiMdFileCount} ${name} file${geminiMdFileCount > 1 ? 's' : ''}`;
})();
const mcpText = (() => {
if (mcpServerCount === 0 && blockedMcpServerCount === 0) {
return '';
}
const parts = [];
if (mcpServerCount > 0) {
parts.push(`${mcpServerCount} MCP server${mcpServerCount > 1 ? 's' : ''}`);
}
if (blockedMcpServerCount > 0) {
let blockedText = `${blockedMcpServerCount} Blocked`;
if (mcpServerCount === 0) {
blockedText += ` MCP server${blockedMcpServerCount > 1 ? 's' : ''}`;
}
parts.push(blockedText);
}
return parts.join(', ');
})();
let summaryText = 'Using: ';
const summaryParts = [];
if (openFilesText) {
summaryParts.push(openFilesText);
}
if (geminiMdText) {
summaryParts.push(geminiMdText);
}
if (mcpText) {
summaryParts.push(mcpText);
}
summaryText += summaryParts.join(' | ');
// Add ctrl+t hint when MCP servers are available
if (mcpServers && Object.keys(mcpServers).length > 0) {
if (showToolDescriptions) {
summaryText += ' (ctrl+t to toggle)';
}
else {
summaryText += ' (ctrl+t to view)';
}
}
return _jsx(Text, { color: Colors.Gray, children: summaryText });
};
//# sourceMappingURL=ContextSummaryDisplay.js.map