Run npm run format

- This has the entirety of the changes.

Part of https://b.corp.google.com/issues/411720532
This commit is contained in:
Taylor Mullen
2025-04-18 18:08:43 -04:00
committed by N. Taylor Mullen
parent fa264e4286
commit 383b917784
26 changed files with 211 additions and 208 deletions

View File

@@ -6,12 +6,12 @@ interface FooterProps {
}
const Footer: React.FC<FooterProps> = ({ queryLength }) => (
<Box marginTop={1} justifyContent="space-between">
<Box minWidth={15}>
<Text color="gray">{queryLength === 0 ? '? for shortcuts' : ''}</Text>
</Box>
<Text color="blue">Gemini</Text>
<Box marginTop={1} justifyContent="space-between">
<Box minWidth={15}>
<Text color="gray">{queryLength === 0 ? '? for shortcuts' : ''}</Text>
</Box>
);
<Text color="blue">Gemini</Text>
</Box>
);
export default Footer;

View File

@@ -8,31 +8,31 @@ interface HeaderProps {
}
const Header: React.FC<HeaderProps> = ({ cwd }) => (
<>
{/* Static Header Art */}
<Box marginBottom={1}>
<Text color="blue">{`
<>
{/* Static Header Art */}
<Box marginBottom={1}>
<Text color="blue">{`
______ ________ ____ ____ _____ ____ _____ _____
.' ___ ||_ __ ||_ \\ / _||_ _||_ \\|_ _||_ _|
/ .' \\_| | |_ \\_| | \\/ | | | | \\ | | | |
| | ____ | _| _ | |\\ /| | | | | |\\ \\| | | |
\\ \`.___] |_| |__/ | _| |_\\/_| |_ _| |_ _| |_\\ |_ _| |_
\`._____.'|________||_____||_____||_____||_____|\\____||_____|`}</Text>
</Box>
{/* CWD Display */}
<Box
borderStyle="round"
borderColor="blue"
paddingX={BOX_PADDING_X}
flexDirection="column"
marginBottom={1}
width={UI_WIDTH}
>
<Box paddingLeft={2}>
<Text color="gray">cwd: {shortenPath(cwd, /*maxLength*/ 70)}</Text>
</Box>
{/* CWD Display */}
<Box
borderStyle="round"
borderColor="blue"
paddingX={BOX_PADDING_X}
flexDirection="column"
marginBottom={1}
width={UI_WIDTH}
>
<Box paddingLeft={2}>
<Text color="gray">cwd: {shortenPath(cwd, /*maxLength*/ 70)}</Text>
</Box>
</Box>
</>
);
</Box>
</>
);
export default Header;

View File

@@ -17,26 +17,23 @@ interface HistoryDisplayProps {
const HistoryDisplay: React.FC<HistoryDisplayProps> = ({
history,
onSubmit,
}) =>
}) => (
// No grouping logic needed here anymore
(
<Box flexDirection="column">
{history.map((item) => (
<Box key={item.id} marginBottom={1}>
{/* Render standard message types */}
{item.type === 'user' && <UserMessage text={item.text} />}
{item.type === 'gemini' && <GeminiMessage text={item.text} />}
{item.type === 'info' && <InfoMessage text={item.text} />}
{item.type === 'error' && <ErrorMessage text={item.text} />}
{/* Render the tool group component */}
{item.type === 'tool_group' && (
<ToolGroupMessage toolCalls={item.tools} onSubmit={onSubmit} />
)}
</Box>
))}
</Box>
)
;
<Box flexDirection="column">
{history.map((item) => (
<Box key={item.id} marginBottom={1}>
{/* Render standard message types */}
{item.type === 'user' && <UserMessage text={item.text} />}
{item.type === 'gemini' && <GeminiMessage text={item.text} />}
{item.type === 'info' && <InfoMessage text={item.text} />}
{item.type === 'error' && <ErrorMessage text={item.text} />}
{/* Render the tool group component */}
{item.type === 'tool_group' && (
<ToolGroupMessage toolCalls={item.tools} onSubmit={onSubmit} />
)}
</Box>
))}
</Box>
);
export default HistoryDisplay;

View File

@@ -3,8 +3,6 @@ import { Box, Text } from 'ink';
import TextInput from 'ink-text-input';
import { globalConfig } from '../../config/config.js';
interface InputPromptProps {
query: string;
setQuery: (value: string) => void;
@@ -34,6 +32,6 @@ const InputPrompt: React.FC<InputPromptProps> = ({
</Box>
</Box>
);
}
};
export default InputPrompt;

View File

@@ -3,18 +3,18 @@ import { Box, Text } from 'ink';
import { UI_WIDTH } from '../constants.js';
const Tips: React.FC = () => (
<Box flexDirection="column" marginBottom={1} width={UI_WIDTH}>
<Text>Tips for getting started:</Text>
<Text>
1. <Text bold>/help</Text> for more information.
</Text>
<Text>
2. <Text bold>/init</Text> to create a GEMINI.md for instructions &
context.
</Text>
<Text>3. Ask coding questions, edit code or run commands.</Text>
<Text>4. Be specific for the best results.</Text>
</Box>
);
<Box flexDirection="column" marginBottom={1} width={UI_WIDTH}>
<Text>Tips for getting started:</Text>
<Text>
1. <Text bold>/help</Text> for more information.
</Text>
<Text>
2. <Text bold>/init</Text> to create a GEMINI.md for instructions &
context.
</Text>
<Text>3. Ask coding questions, edit code or run commands.</Text>
<Text>4. Be specific for the best results.</Text>
</Box>
);
export default Tips;

View File

@@ -21,23 +21,23 @@ const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
return (
<Box flexDirection="column" borderStyle="round" borderColor={borderColor}>
{toolCalls.map((tool) => (
<React.Fragment key={tool.callId}>
<ToolMessage
key={tool.callId} // Use callId as the key
name={tool.name}
description={tool.description}
resultDisplay={tool.resultDisplay}
status={tool.status}
/>
{tool.status === ToolCallStatus.Confirming &&
tool.confirmationDetails && (
<ToolConfirmationMessage
confirmationDetails={tool.confirmationDetails}
onSubmit={onSubmit}
></ToolConfirmationMessage>
)}
</React.Fragment>
))}
<React.Fragment key={tool.callId}>
<ToolMessage
key={tool.callId} // Use callId as the key
name={tool.name}
description={tool.description}
resultDisplay={tool.resultDisplay}
status={tool.status}
/>
{tool.status === ToolCallStatus.Confirming &&
tool.confirmationDetails && (
<ToolConfirmationMessage
confirmationDetails={tool.confirmationDetails}
onSubmit={onSubmit}
></ToolConfirmationMessage>
)}
</React.Fragment>
))}
{/* Optional: Add padding below the last item if needed,
though ToolMessage already has some vertical space implicitly */}
{/* {tools.length > 0 && <Box height={1} />} */}

View File

@@ -58,4 +58,4 @@ export function useInitializationErrorEffect(
]);
}
}, [initError, history, setHistory]); // Include setHistory in dependency array
}
}

View File

@@ -3,7 +3,10 @@ import { useInput } from 'ink';
import { GeminiClient } from '../../core/gemini-client.js';
import { type Chat, type PartListUnion } from '@google/genai';
import { HistoryItem } from '../types.js';
import { processGeminiStream , StreamingState } from '../../core/gemini-stream.js';
import {
processGeminiStream,
StreamingState,
} from '../../core/gemini-stream.js';
import { globalConfig } from '../../config/config.js';
import { getErrorMessage, isNodeError } from '../../utils/errors.js';