mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 05:24:34 -07:00
Utilize pipelining of grep_search -> read_file to eliminate turns (#19574)
This commit is contained in:
committed by
GitHub
parent
727f9b67b1
commit
5d98ed5820
@@ -36,6 +36,7 @@ import {
|
||||
} from '../utils/editCorrector.js';
|
||||
import { detectLineEnding } from '../utils/textUtils.js';
|
||||
import { DEFAULT_DIFF_OPTIONS, getDiffStat } from './diffOptions.js';
|
||||
import { getDiffContextSnippet } from './diff-utils.js';
|
||||
import type {
|
||||
ModifiableDeclarativeTool,
|
||||
ModifyContext,
|
||||
@@ -351,6 +352,15 @@ class WriteFileToolInvocation extends BaseToolInvocation<
|
||||
);
|
||||
}
|
||||
|
||||
// Return a diff of the file before and after the write so that the agent
|
||||
// can avoid the need to spend a turn doing a verification read.
|
||||
const snippet = getDiffContextSnippet(
|
||||
isNewFile ? '' : originalContent,
|
||||
finalContent,
|
||||
5,
|
||||
);
|
||||
llmSuccessMessageParts.push(`Here is the updated code:\n${snippet}`);
|
||||
|
||||
// Log file operation for telemetry (without diff_stat to avoid double-counting)
|
||||
const mimetype = getSpecificMimeType(this.resolvedPath);
|
||||
const programmingLanguage = getLanguageFromFilePath(this.resolvedPath);
|
||||
|
||||
Reference in New Issue
Block a user