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: {
'import/resolver': {
typescript: true,
node: true,
},
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,8 +20,7 @@ const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
return (
<Box flexDirection="column" borderStyle="round" borderColor={borderColor}>
{toolCalls.map((tool) => {
return (
{toolCalls.map((tool) => (
<React.Fragment key={tool.callId}>
<ToolMessage
key={tool.callId} // Use callId as the key
@ -38,8 +37,7 @@ const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
></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

@ -3,8 +3,7 @@ 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 } from '../../core/gemini-stream.js';
import { StreamingState } from '../../core/gemini-stream.js';
import { processGeminiStream , StreamingState } from '../../core/gemini-stream.js';
const addHistoryItem = (
setHistory: React.Dispatch<React.SetStateAction<HistoryItem[]>>,

View File

@ -197,7 +197,7 @@ export class MarkdownRenderer {
* @param text The full markdown string to render.
* @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 [];
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).
* @returns A promise resolving to the final analysis outcome.
*/
public async analyze(
async analyze(
pid: ProcessHandle,
tempStdoutFilePath: string,
tempStderrFilePath: string,
@ -91,8 +91,8 @@ export class BackgroundTerminalAnalyzer {
while (attempts < this.maxAttempts) {
attempts++;
let currentStdout: string = '';
let currentStderr: string = '';
let currentStdout = '';
let currentStderr = '';
// --- Robust File Reading ---
try {

View File

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