Initial auto-fixing of linting errors.

- This is the result of runing `npm lint -- -fix`
This commit is contained in:
Taylor Mullen 2025-04-18 10:53:16 -04:00 committed by N. Taylor Mullen
parent cb30351403
commit e0339993ae
20 changed files with 37 additions and 50 deletions

View File

@ -53,7 +53,6 @@ export default tseslint.config(
}, },
settings: { settings: {
'import/resolver': { 'import/resolver': {
typescript: true,
node: true, node: true,
}, },
}, },

View File

@ -6,7 +6,7 @@ const DEFAULT_GEMINI_MODEL = 'gemini-2.5-flash-preview-04-17';
export interface CliArgs { export interface CliArgs {
target_dir: string | undefined; target_dir: string | undefined;
model: string | undefined; model: string | undefined;
_: (string | number)[]; // Captures positional arguments _: Array<string | number>; // Captures positional arguments
// Add other expected args here if needed // Add other expected args here if needed
// e.g., verbose?: boolean; // e.g., verbose?: boolean;
} }

View File

@ -44,7 +44,7 @@ export class GeminiClient {
this.ai = new GoogleGenAI({ apiKey }); this.ai = new GoogleGenAI({ apiKey });
} }
public async startChat(): Promise<Chat> { async startChat(): Promise<Chat> {
const tools = toolRegistry.getToolSchemas(); const tools = toolRegistry.getToolSchemas();
const model = getModel(); const model = getModel();
@ -75,7 +75,7 @@ ${folderStructure}
try { try {
const chat = this.ai.chats.create({ const chat = this.ai.chats.create({
model: model, model,
config: { config: {
systemInstruction: CoreSystemPrompt, systemInstruction: CoreSystemPrompt,
...this.defaultHyperParameters, ...this.defaultHyperParameters,
@ -103,14 +103,12 @@ ${folderStructure}
} }
} }
public addMessageToHistory(chat: Chat, message: Content): void { addMessageToHistory(chat: Chat, message: Content): void {
const history = chat.getHistory(); const history = chat.getHistory();
history.push(message); history.push(message);
this.ai.chats;
chat;
} }
public async *sendMessageStream( async *sendMessageStream(
chat: Chat, chat: Chat,
request: PartListUnion, request: PartListUnion,
signal?: AbortSignal, signal?: AbortSignal,
@ -180,7 +178,7 @@ ${folderStructure}
} }
if (pendingToolCalls.length > 0) { if (pendingToolCalls.length > 0) {
const toolPromises: Promise<ToolExecutionOutcome>[] = const toolPromises: Array<Promise<ToolExecutionOutcome>> =
pendingToolCalls.map(async (pendingToolCall) => { pendingToolCalls.map(async (pendingToolCall) => {
const tool = toolRegistry.getTool(pendingToolCall.name); const tool = toolRegistry.getTool(pendingToolCall.name);
@ -311,7 +309,7 @@ ${folderStructure}
return { return {
functionResponse: { functionResponse: {
name: name, name,
id: executedTool.callId, id: executedTool.callId,
response: toolOutcomePayload, response: toolOutcomePayload,
}, },
@ -444,7 +442,7 @@ Respond *only* in JSON format according to the following schema. Do not include
* @returns A promise that resolves to the parsed JSON object matching the schema. * @returns A promise that resolves to the parsed JSON object matching the schema.
* @throws Throws an error if the API call fails or the response is not valid JSON. * @throws Throws an error if the API call fails or the response is not valid JSON.
*/ */
public async generateJson( async generateJson(
contents: Content[], contents: Content[],
schema: SchemaUnion, schema: SchemaUnion,
): Promise<any> { ): Promise<any> {
@ -458,7 +456,7 @@ Respond *only* in JSON format according to the following schema. Do not include
responseSchema: schema, responseSchema: schema,
responseMimeType: 'application/json', responseMimeType: 'application/json',
}, },
contents: contents, // Pass the full Content array contents, // Pass the full Content array
}); });
const responseText = result.text; const responseText = result.text;

View File

@ -1,6 +1,5 @@
import { ToolCallEvent } from '../ui/types.js'; import { ToolCallEvent , HistoryItem } from '../ui/types.js';
import { Part } from '@google/genai'; import { Part } from '@google/genai';
import { HistoryItem } from '../ui/types.js';
import { import {
handleToolCallChunk, handleToolCallChunk,
addErrorMessageToHistory, addErrorMessageToHistory,

View File

@ -118,7 +118,7 @@ export const handleToolCallChunk = (
description, description,
resultDisplay: chunk.resultDisplay, resultDisplay: chunk.resultDisplay,
status: chunk.status, status: chunk.status,
confirmationDetails: confirmationDetails, confirmationDetails,
}; };
const activeGroupId = currentToolGroupIdRef.current; const activeGroupId = currentToolGroupIdRef.current;

View File

@ -351,7 +351,7 @@ export class GrepTool extends BaseTool<GrepToolParams, GrepToolResult> {
results.push({ results.push({
// Use relative path, or just the filename if it's in the base path itself // Use relative path, or just the filename if it's in the base path itself
filePath: relativeFilePath || path.basename(absoluteFilePath), filePath: relativeFilePath || path.basename(absoluteFilePath),
lineNumber: lineNumber, lineNumber,
line: lineContent, // Use the full extracted line content line: lineContent, // Use the full extracted line content
}); });
} }
@ -555,7 +555,7 @@ export class GrepTool extends BaseTool<GrepToolParams, GrepToolResult> {
path.relative(absolutePath, fileAbsolutePath) || path.relative(absolutePath, fileAbsolutePath) ||
path.basename(fileAbsolutePath), path.basename(fileAbsolutePath),
lineNumber: index + 1, lineNumber: index + 1,
line: line, line,
}); });
} }
}); });

View File

@ -36,7 +36,7 @@ export class ReadFileTool extends BaseTool<
ReadFileToolParams, ReadFileToolParams,
ReadFileToolResult ReadFileToolResult
> { > {
public static readonly Name: string = 'read_file'; static readonly Name: string = 'read_file';
// Maximum number of lines to read by default // Maximum number of lines to read by default
private static readonly DEFAULT_MAX_LINES = 2000; private static readonly DEFAULT_MAX_LINES = 2000;

View File

@ -127,7 +127,7 @@ export class TerminalTool extends BaseTool<
TerminalToolParams, TerminalToolParams,
TerminalToolResult TerminalToolResult
> { > {
public static Name: string = 'execute_bash_command'; static Name: string = 'execute_bash_command';
private readonly rootDirectory: string; private readonly rootDirectory: string;
private readonly outputLimit: number; private readonly outputLimit: number;
@ -387,7 +387,7 @@ Use this tool for running build steps (\`npm install\`, \`make\`), linters (\`es
const confirmationDetails: ToolExecuteConfirmationDetails = { const confirmationDetails: ToolExecuteConfirmationDetails = {
title: 'Confirm Shell Command', title: 'Confirm Shell Command',
command: params.command, command: params.command,
rootCommand: rootCommand, rootCommand,
description: `Execute in '${this.currentCwd}':\n${description}`, description: `Execute in '${this.currentCwd}':\n${description}`,
onConfirm: async (outcome: ToolConfirmationOutcome) => { onConfirm: async (outcome: ToolConfirmationOutcome) => {
if (outcome === ToolConfirmationOutcome.ProceedAlways) { if (outcome === ToolConfirmationOutcome.ProceedAlways) {

View File

@ -76,10 +76,10 @@ export abstract class BaseTool<
* @param parameterSchema JSON Schema defining the parameters * @param parameterSchema JSON Schema defining the parameters
*/ */
constructor( constructor(
public readonly name: string, readonly name: string,
public readonly displayName: string, readonly displayName: string,
public readonly description: string, readonly description: string,
public readonly parameterSchema: Record<string, unknown>, readonly parameterSchema: Record<string, unknown>,
) {} ) {}
/** /**

View File

@ -37,7 +37,7 @@ export class WriteFileTool extends BaseTool<
WriteFileToolParams, WriteFileToolParams,
WriteFileToolResult WriteFileToolResult
> { > {
public static readonly Name: string = 'write_file'; static readonly Name: string = 'write_file';
private shouldAlwaysWrite = false; private shouldAlwaysWrite = false;
/** /**

View File

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

View File

@ -7,8 +7,7 @@ interface HeaderProps {
cwd: string; cwd: string;
} }
const Header: React.FC<HeaderProps> = ({ cwd }) => { const Header: React.FC<HeaderProps> = ({ cwd }) => (
return (
<> <>
{/* Static Header Art */} {/* Static Header Art */}
<Box marginBottom={1}> <Box marginBottom={1}>
@ -35,6 +34,5 @@ const Header: React.FC<HeaderProps> = ({ cwd }) => {
</Box> </Box>
</> </>
); );
};
export default Header; export default Header;

View File

@ -17,9 +17,9 @@ interface HistoryDisplayProps {
const HistoryDisplay: React.FC<HistoryDisplayProps> = ({ const HistoryDisplay: React.FC<HistoryDisplayProps> = ({
history, history,
onSubmit, onSubmit,
}) => { }) =>
// No grouping logic needed here anymore // No grouping logic needed here anymore
return ( (
<Box flexDirection="column"> <Box flexDirection="column">
{history.map((item) => ( {history.map((item) => (
<Box key={item.id} marginBottom={1}> <Box key={item.id} marginBottom={1}>
@ -36,7 +36,7 @@ const HistoryDisplay: React.FC<HistoryDisplayProps> = ({
</Box> </Box>
))} ))}
</Box> </Box>
); )
}; ;
export default HistoryDisplay; export default HistoryDisplay;

View File

@ -32,6 +32,6 @@ const InputPrompt: React.FC<InputPromptProps> = ({
</Box> </Box>
</Box> </Box>
); );
}; }
export default InputPrompt; export default InputPrompt;

View File

@ -2,8 +2,7 @@ import React from 'react';
import { Box, Text } from 'ink'; import { Box, Text } from 'ink';
import { UI_WIDTH } from '../constants.js'; import { UI_WIDTH } from '../constants.js';
const Tips: React.FC = () => { const Tips: React.FC = () => (
return (
<Box flexDirection="column" marginBottom={1} width={UI_WIDTH}> <Box flexDirection="column" marginBottom={1} width={UI_WIDTH}>
<Text>Tips for getting started:</Text> <Text>Tips for getting started:</Text>
<Text> <Text>
@ -17,6 +16,5 @@ const Tips: React.FC = () => {
<Text>4. Be specific for the best results.</Text> <Text>4. Be specific for the best results.</Text>
</Box> </Box>
); );
};
export default Tips; export default Tips;

View File

@ -20,8 +20,7 @@ const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
return ( return (
<Box flexDirection="column" borderStyle="round" borderColor={borderColor}> <Box flexDirection="column" borderStyle="round" borderColor={borderColor}>
{toolCalls.map((tool) => { {toolCalls.map((tool) => (
return (
<React.Fragment key={tool.callId}> <React.Fragment key={tool.callId}>
<ToolMessage <ToolMessage
key={tool.callId} // Use callId as the key key={tool.callId} // Use callId as the key
@ -38,8 +37,7 @@ const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
></ToolConfirmationMessage> ></ToolConfirmationMessage>
)} )}
</React.Fragment> </React.Fragment>
); ))}
})}
{/* Optional: Add padding below the last item if needed, {/* Optional: Add padding below the last item if needed,
though ToolMessage already has some vertical space implicitly */} though ToolMessage already has some vertical space implicitly */}
{/* {tools.length > 0 && <Box height={1} />} */} {/* {tools.length > 0 && <Box height={1} />} */}

View File

@ -3,8 +3,7 @@ import { useInput } from 'ink';
import { GeminiClient } from '../../core/gemini-client.js'; import { GeminiClient } from '../../core/gemini-client.js';
import { type Chat, type PartListUnion } from '@google/genai'; import { type Chat, type PartListUnion } from '@google/genai';
import { HistoryItem } from '../types.js'; import { HistoryItem } from '../types.js';
import { processGeminiStream } from '../../core/gemini-stream.js'; import { processGeminiStream , StreamingState } from '../../core/gemini-stream.js';
import { StreamingState } from '../../core/gemini-stream.js';
const addHistoryItem = ( const addHistoryItem = (
setHistory: React.Dispatch<React.SetStateAction<HistoryItem[]>>, setHistory: React.Dispatch<React.SetStateAction<HistoryItem[]>>,

View File

@ -197,7 +197,7 @@ export class MarkdownRenderer {
* @param text The full markdown string to render. * @param text The full markdown string to render.
* @returns An array of React nodes representing markdown blocks. * @returns An array of React nodes representing markdown blocks.
*/ */
public static render(text: string): React.ReactNode[] { static render(text: string): React.ReactNode[] {
if (!text) return []; if (!text) return [];
const lines = text.split('\n'); const lines = text.split('\n');

View File

@ -75,7 +75,7 @@ export class BackgroundTerminalAnalyzer {
* @param command The command string that was executed (for context in prompts). * @param command The command string that was executed (for context in prompts).
* @returns A promise resolving to the final analysis outcome. * @returns A promise resolving to the final analysis outcome.
*/ */
public async analyze( async analyze(
pid: ProcessHandle, pid: ProcessHandle,
tempStdoutFilePath: string, tempStdoutFilePath: string,
tempStderrFilePath: string, tempStderrFilePath: string,
@ -91,8 +91,8 @@ export class BackgroundTerminalAnalyzer {
while (attempts < this.maxAttempts) { while (attempts < this.maxAttempts) {
attempts++; attempts++;
let currentStdout: string = ''; let currentStdout = '';
let currentStderr: string = ''; let currentStderr = '';
// --- Robust File Reading --- // --- Robust File Reading ---
try { try {

View File

@ -61,7 +61,7 @@ async function readFullStructure(
const name = path.basename(folderPath); const name = path.basename(folderPath);
// Initialize with isIgnored: false // Initialize with isIgnored: false
const folderInfo: Omit<FullFolderInfo, 'totalChildren' | 'totalFiles'> = { const folderInfo: Omit<FullFolderInfo, 'totalChildren' | 'totalFiles'> = {
name: name, name,
path: folderPath, path: folderPath,
files: [], files: [],
subFolders: [], subFolders: [],