Use consistent param names (#12517)

This commit is contained in:
Tommaso Sciortino
2025-11-06 15:03:52 -08:00
committed by GitHub
parent 5f1208ad81
commit f05d937f39
27 changed files with 553 additions and 525 deletions

View File

@@ -88,7 +88,7 @@ export interface RipGrepToolParams {
/**
* The directory to search in (optional, defaults to current directory relative to root)
*/
path?: string;
dir_path?: string;
/**
* File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")
@@ -163,8 +163,8 @@ class GrepToolInvocation extends BaseToolInvocation<
async execute(signal: AbortSignal): Promise<ToolResult> {
try {
const workspaceContext = this.config.getWorkspaceContext();
const searchDirAbs = this.resolveAndValidatePath(this.params.path);
const searchDirDisplay = this.params.path || '.';
const searchDirAbs = this.resolveAndValidatePath(this.params.dir_path);
const searchDirDisplay = this.params.dir_path || '.';
// Determine which directories to search
let searchDirectories: readonly string[];
@@ -416,14 +416,14 @@ class GrepToolInvocation extends BaseToolInvocation<
if (this.params.include) {
description += ` in ${this.params.include}`;
}
if (this.params.path) {
if (this.params.dir_path) {
const resolvedPath = path.resolve(
this.config.getTargetDir(),
this.params.path,
this.params.dir_path,
);
if (
resolvedPath === this.config.getTargetDir() ||
this.params.path === '.'
this.params.dir_path === '.'
) {
description += ` within ./`;
} else {
@@ -470,7 +470,7 @@ export class RipGrepTool extends BaseDeclarativeTool<
"The regular expression (regex) pattern to search for within file contents (e.g., 'function\\s+myFunction', 'import\\s+\\{.*\\}\\s+from\\s+.*').",
type: 'string',
},
path: {
dir_path: {
description:
'Optional: The absolute path to the directory to search within. If omitted, searches the current working directory.',
type: 'string',
@@ -546,9 +546,9 @@ export class RipGrepTool extends BaseDeclarativeTool<
}
// Only validate path if one is provided
if (params.path) {
if (params.dir_path) {
try {
this.resolveAndValidatePath(params.path);
this.resolveAndValidatePath(params.dir_path);
} catch (error) {
return getErrorMessage(error);
}