-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: add search_replace native tool for single-replacement operations #9918
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
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)
Review complete. The new search_replace native tool and its integration and tests look consistent and ready to merge.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| file_path: args.file_path, | ||
| old_string: args.old_string, | ||
| new_string: args.new_string, | ||
| } as NativeArgsFor<TName> |
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.
@roomote Remove this type override.
Note: We need to later look into typing for nativeArgs in general.
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.
Fixaroo
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.
Summary
Adds a new
search_replacenative tool that performs a single search and replace operation on a file, requiring theold_stringto uniquely identify the target text with 3-5 lines of context.Changes
src/core/prompts/tools/native-tools/search_replace.tssrc/core/tools/SearchReplaceTool.tspackages/types/src/tool.tssrc/shared/tools.tssrc/core/assistant-message/NativeToolCallParser.tssrc/core/assistant-message/presentAssistantMessage.tssrc/core/prompts/tools/native-tools/index.tsTool 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_replacetool for single-instance search and replace operations with comprehensive integration and testing.search_replacetool for single-instance search and replace operations, requiring unique identification ofold_stringwith context.presentAssistantMessage()andNativeToolCallParserfor handling and parsing.search_replace.tswith parametersfile_path,old_string, andnew_string.tool.tsandtools.tsfor type and parameter support.SearchReplaceToolinSearchReplaceTool.tsfor executing the tool logic.searchReplaceTool.spec.tscovering parameter validation, file access, and replacement logic.This description was created by
for 45e23f8. You can customize this summary. It will automatically update as commits are pushed.