mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 05:24:34 -07:00
feat(core): rename grep_search include parameter to include_pattern (#20328)
This commit is contained in:
@@ -48,7 +48,7 @@ export interface GrepToolParams {
|
||||
/**
|
||||
* File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")
|
||||
*/
|
||||
include?: string;
|
||||
include_pattern?: string;
|
||||
|
||||
/**
|
||||
* Optional: A regular expression pattern to exclude from the search results.
|
||||
@@ -227,7 +227,7 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
const matches = await this.performGrepSearch({
|
||||
pattern: this.params.pattern,
|
||||
path: searchDir,
|
||||
include: this.params.include,
|
||||
include_pattern: this.params.include_pattern,
|
||||
exclude_pattern: this.params.exclude_pattern,
|
||||
maxMatches: remainingLimit,
|
||||
max_matches_per_file: this.params.max_matches_per_file,
|
||||
@@ -317,7 +317,7 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
private async performGrepSearch(options: {
|
||||
pattern: string;
|
||||
path: string; // Expects absolute path
|
||||
include?: string;
|
||||
include_pattern?: string;
|
||||
exclude_pattern?: string;
|
||||
maxMatches: number;
|
||||
max_matches_per_file?: number;
|
||||
@@ -326,7 +326,7 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
const {
|
||||
pattern,
|
||||
path: absolutePath,
|
||||
include,
|
||||
include_pattern,
|
||||
exclude_pattern,
|
||||
maxMatches,
|
||||
max_matches_per_file,
|
||||
@@ -356,8 +356,8 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
if (max_matches_per_file) {
|
||||
gitArgs.push('--max-count', max_matches_per_file.toString());
|
||||
}
|
||||
if (include) {
|
||||
gitArgs.push('--', include);
|
||||
if (include_pattern) {
|
||||
gitArgs.push('--', include_pattern);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -424,8 +424,8 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
if (max_matches_per_file) {
|
||||
grepArgs.push('--max-count', max_matches_per_file.toString());
|
||||
}
|
||||
if (include) {
|
||||
grepArgs.push(`--include=${include}`);
|
||||
if (include_pattern) {
|
||||
grepArgs.push(`--include=${include_pattern}`);
|
||||
}
|
||||
grepArgs.push(pattern);
|
||||
grepArgs.push('.');
|
||||
@@ -471,7 +471,7 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
'GrepLogic: Falling back to JavaScript grep implementation.',
|
||||
);
|
||||
strategyUsed = 'javascript fallback';
|
||||
const globPattern = include ? include : '**/*';
|
||||
const globPattern = include_pattern ? include_pattern : '**/*';
|
||||
const ignorePatterns = this.fileExclusions.getGlobExcludes();
|
||||
|
||||
const filesStream = globStream(globPattern, {
|
||||
@@ -551,8 +551,8 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
|
||||
getDescription(): string {
|
||||
let description = `'${this.params.pattern}'`;
|
||||
if (this.params.include) {
|
||||
description += ` in ${this.params.include}`;
|
||||
if (this.params.include_pattern) {
|
||||
description += ` in ${this.params.include_pattern}`;
|
||||
}
|
||||
if (this.params.dir_path) {
|
||||
const resolvedPath = path.resolve(
|
||||
|
||||
Reference in New Issue
Block a user