mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-12 22:31:12 -07:00
Cleanup low value comments. (#248)
This commit is contained in:
@@ -53,10 +53,10 @@ interface CalculatedEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of the Edit tool logic (moved from CLI)
|
||||
* Implementation of the Edit tool logic
|
||||
*/
|
||||
export class EditTool extends BaseTool<EditToolParams, ToolResult> {
|
||||
static readonly Name = 'replace'; // Keep static name
|
||||
static readonly Name = 'replace';
|
||||
private shouldAlwaysEdit = false;
|
||||
|
||||
/**
|
||||
@@ -371,7 +371,7 @@ export class EditTool extends BaseTool<EditToolParams, ToolResult> {
|
||||
editData.newContent,
|
||||
'Current',
|
||||
'Proposed',
|
||||
{ context: 3 }, // Removed ignoreWhitespace for potentially more accurate display diff
|
||||
{ context: 3 },
|
||||
);
|
||||
displayResult = { fileDiff };
|
||||
}
|
||||
|
||||
@@ -27,11 +27,10 @@ export interface GlobToolParams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of the Glob tool logic (moved from CLI)
|
||||
* Implementation of the Glob tool logic
|
||||
*/
|
||||
export class GlobTool extends BaseTool<GlobToolParams, ToolResult> {
|
||||
static readonly Name = 'glob'; // Keep static name
|
||||
|
||||
static readonly Name = 'glob';
|
||||
/**
|
||||
* Creates a new instance of the GlobLogic
|
||||
* @param rootDirectory Root directory to ground this tool in.
|
||||
@@ -39,8 +38,8 @@ export class GlobTool extends BaseTool<GlobToolParams, ToolResult> {
|
||||
constructor(private rootDirectory: string) {
|
||||
super(
|
||||
GlobTool.Name,
|
||||
'FindFiles', // Display name handled by CLI wrapper
|
||||
'Efficiently finds files matching specific glob patterns (e.g., `src/**/*.ts`, `**/*.md`), returning absolute paths sorted by modification time (newest first). Ideal for quickly locating files based on their name or path structure, especially in large codebases.', // Description handled by CLI wrapper
|
||||
'FindFiles',
|
||||
'Efficiently finds files matching specific glob patterns (e.g., `src/**/*.ts`, `**/*.md`), returning absolute paths sorted by modification time (newest first). Ideal for quickly locating files based on their name or path structure, especially in large codebases.',
|
||||
{
|
||||
properties: {
|
||||
pattern: {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import { FunctionDeclaration, Schema } from '@google/genai';
|
||||
// Removed import for ../ui/types.js as confirmation is UI-specific
|
||||
|
||||
/**
|
||||
* Interface representing the base Tool functionality
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface WebFetchToolParams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of the WebFetch tool logic (moved from CLI)
|
||||
* Implementation of the WebFetch tool logic
|
||||
*/
|
||||
export class WebFetchTool extends BaseTool<WebFetchToolParams, ToolResult> {
|
||||
static readonly Name: string = 'web_fetch';
|
||||
@@ -70,8 +70,6 @@ export class WebFetchTool extends BaseTool<WebFetchToolParams, ToolResult> {
|
||||
return `Fetching content from ${displayUrl}`;
|
||||
}
|
||||
|
||||
// Removed shouldConfirmExecute - handled by CLI
|
||||
|
||||
async execute(params: WebFetchToolParams): Promise<ToolResult> {
|
||||
const validationError = this.validateParams(params);
|
||||
if (validationError) {
|
||||
@@ -86,10 +84,9 @@ export class WebFetchTool extends BaseTool<WebFetchToolParams, ToolResult> {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
// Identify the client making the request
|
||||
'User-Agent': 'GeminiCode-ServerLogic/1.0',
|
||||
},
|
||||
signal: AbortSignal.timeout(15000), // Use AbortSignal for timeout
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import * as Diff from 'diff'; // Keep for result generation
|
||||
import * as Diff from 'diff';
|
||||
import {
|
||||
BaseTool,
|
||||
ToolResult,
|
||||
@@ -14,11 +14,10 @@ import {
|
||||
ToolEditConfirmationDetails,
|
||||
ToolConfirmationOutcome,
|
||||
ToolCallConfirmationDetails,
|
||||
} from './tools.js'; // Updated import (Removed ToolResultDisplay)
|
||||
} from './tools.js';
|
||||
import { SchemaValidator } from '../utils/schemaValidator.js'; // Updated import
|
||||
import { makeRelative, shortenPath } from '../utils/paths.js'; // Updated import
|
||||
import { isNodeError } from '../utils/errors.js'; // Import isNodeError
|
||||
|
||||
import { isNodeError } from '../utils/errors.js';
|
||||
/**
|
||||
* Parameters for the WriteFile tool
|
||||
*/
|
||||
@@ -35,7 +34,7 @@ export interface WriteFileToolParams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of the WriteFile tool logic (moved from CLI)
|
||||
* Implementation of the WriteFile tool logic
|
||||
*/
|
||||
export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
|
||||
static readonly Name: string = 'write_file';
|
||||
@@ -49,7 +48,6 @@ export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
|
||||
{
|
||||
properties: {
|
||||
file_path: {
|
||||
// Renamed from filePath in original schema
|
||||
description:
|
||||
"The absolute path to the file to write to (e.g., '/home/user/project/file.txt'). Relative paths are not supported.",
|
||||
type: 'string',
|
||||
@@ -59,7 +57,7 @@ export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
required: ['file_path', 'content'], // Use correct param names
|
||||
required: ['file_path', 'content'],
|
||||
type: 'object',
|
||||
},
|
||||
);
|
||||
@@ -97,15 +95,13 @@ export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Removed shouldConfirmExecute - handled by CLI
|
||||
|
||||
getDescription(params: WriteFileToolParams): string {
|
||||
const relativePath = makeRelative(params.file_path, this.rootDirectory);
|
||||
return `Writing to ${shortenPath(relativePath)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the confirmation prompt for the WriteFile tool in the CLI.
|
||||
* Handles the confirmation prompt for the WriteFile tool.
|
||||
*/
|
||||
async shouldConfirmExecute(
|
||||
params: WriteFileToolParams,
|
||||
@@ -203,7 +199,6 @@ export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
|
||||
? `Successfully created and wrote to new file: ${params.file_path}`
|
||||
: `Successfully overwrote file: ${params.file_path}`;
|
||||
|
||||
// The returnDisplay contains the diff
|
||||
const displayResult: FileDiff = { fileDiff };
|
||||
|
||||
return {
|
||||
@@ -218,6 +213,4 @@ export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// ensureParentDirectoriesExist logic moved into execute
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user