-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: add search_and_replace tool for batch text replacements #9549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Re-review of the latest changes is complete. One follow-up item remains before this PR is ready to merge.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
6343d7a to
520354e
Compare
| operations: SearchReplaceOperation[] | ||
| } | ||
|
|
||
| export class SearchAndReplaceTool extends BaseTool<"search_and_replace"> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new native search_and_replace tool does not have any automated tests covering successful replacements, partial failures, or error paths. Since it can modify arbitrary user files, missing tests here increases the risk of regressions (for example around multi-operation flows, write-protected files, or rooignore handling); adding unit tests similar to the existing edit tools would make this safer to evolve.
Fix it with Roo Code or mention @roomote and request a fix.
Adds a new native tool that allows multiple search/replace operations in a single file edit, reducing round-trips for common editing patterns. - Add search_and_replace to tool types and tool groups - Implement SearchAndReplaceTool with streaming support - Add native tool schema and parser support - Support partial matching and error recovery for individual operations
…cing the apply_diff.
514b68c to
993c34b
Compare
- Add search_and_replace as a customTool in the edit group (opt-in only) - Fix tool name from 'apply_diff' to 'search_and_replace' in native tools - Add includedTools parameter to isToolAllowedForMode and validateToolUse - customTools are only allowed when explicitly included via modelInfo.includedTools - Pass includedTools from modelInfo in presentAssistantMessage for validation - Add tests for customTools functionality in modes.spec.ts This makes search_and_replace a standalone opt-in tool that doesn't replace apply_diff. Users can enable it via modelInfo.includedTools configuration.
Review updated for the latest PR state. One follow-up item remains for the new search_and_replace tool.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| operations: SearchReplaceOperation[] | ||
| } | ||
|
|
||
| export class SearchAndReplaceTool extends BaseTool<"search_and_replace"> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new search_and_replace tool performs batch edits on arbitrary user files but currently has no automated tests, which makes it easy to regress behavior like multi-operation flows, error aggregation, and protections around rooignore/write-protected files. Adding focused unit tests that cover successful single/multi-operation replacements, partial failures (some operations not matching or matching multiple times), and error paths around missing files or permission constraints would make future changes safer.
Fix it with Roo Code or mention @roomote and request a fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it correctly handle rooignore and files outside the workspace?
Summary
Adds a new native
search_and_replacetool that allows multiple search/replace operations in a single file edit, reducing round-trips for common editing patterns.Changes
search_and_replaceto tool namesFeatures
Testing
Important
Add
search_and_replacetool for batch text replacements with streaming support and error handling.search_and_replacetool totool.ts,NativeToolCallParser.ts, andpresentAssistantMessage.ts.SearchAndReplaceTool.tswith support for streaming and error handling.index.tsand defines it insearch_and_replace.ts.validateToolUse.tsand updatesmodes.spec.tsfor testing.modes.spec.ts.This description was created by
for dc64f16. You can customize this summary. It will automatically update as commits are pushed.