Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Dec 8, 2025

Summary

Adds a new search_replace native tool that performs a single search and replace operation on a file, requiring the old_string to uniquely identify the target text with 3-5 lines of context.

Changes

  • Created native tool definition in src/core/prompts/tools/native-tools/search_replace.ts
  • Created tool handler in src/core/tools/SearchReplaceTool.ts
  • Added tool type to packages/types/src/tool.ts
  • Added tool args, display name, and group to src/shared/tools.ts
  • Added parser support in src/core/assistant-message/NativeToolCallParser.ts
  • Added handler case in src/core/assistant-message/presentAssistantMessage.ts
  • Exported from src/core/prompts/tools/native-tools/index.ts
  • Added comprehensive test suite (15 tests)

Tool Parameters

  • file_path (required) - Path to the file (relative or absolute)
  • old_string (required) - Text to find (must be unique in file)
  • new_string (required) - Replacement text (must differ from old_string)

Important

Introduces search_replace tool for single-instance search and replace operations with comprehensive integration and testing.

  • Behavior:
    • Adds search_replace tool for single-instance search and replace operations, requiring unique identification of old_string with context.
    • Integrated into presentAssistantMessage() and NativeToolCallParser for handling and parsing.
  • Tool Definition:
    • Defined in search_replace.ts with parameters file_path, old_string, and new_string.
    • Added to tool.ts and tools.ts for type and parameter support.
  • Handler:
    • Implements SearchReplaceTool in SearchReplaceTool.ts for executing the tool logic.
    • Handles parameter validation, file access, and replacement logic.
  • Testing:
    • Comprehensive tests in searchReplaceTool.spec.ts covering parameter validation, file access, and replacement logic.

This description was created by Ellipsis for 45e23f8. You can customize this summary. It will automatically update as commits are pushed.

Adds a new search_replace tool that performs a single search and replace
operation on a file, requiring the old_string to uniquely identify the
target text with 3-5 lines of context.

Parameters:
- file_path: Path to file (relative or absolute)
- old_string: Text to find (must be unique in file)
- new_string: Replacement text (must differ from old_string)
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Dec 8, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 8, 2025

Oroocle Clock   See task on Roo Cloud

Review complete. The new search_replace native tool and its integration and tests look consistent and ready to merge.

  • No issues identified in this review

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 8, 2025
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Dec 8, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 8, 2025
@mrubens mrubens merged commit fba8508 into main Dec 8, 2025
24 checks passed
@mrubens mrubens deleted the feat/add-search-replace-native-tool branch December 8, 2025 18:45
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Dec 8, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 8, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Dec 8, 2025
file_path: args.file_path,
old_string: args.old_string,
new_string: args.new_string,
} as NativeArgsFor<TName>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roomote Remove this type override.

Note: We need to later look into typing for nativeArgs in general.

Copy link
Contributor

@roomote roomote bot Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixaroo Clock   See task on Roo Cloud

Fixed the reported issue. Since PR #9918 was already merged, created follow-up PR #9922 with the fix. All local checks passed.

View commit | View follow-up PR | Revert commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Preliminary Review size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants