Skip to content
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

feat(patch): introduce ApplyPatchV2 with enhanced fuzzy matching #242

Merged
merged 26 commits into from
Jan 29, 2025

Conversation

tusharmath
Copy link
Collaborator

@tusharmath tusharmath commented Jan 27, 2025

This PR introduces a new version of the patch functionality with several improvements:

  • Enhanced fuzzy matching with configurable similarity threshold (currently set at 0.7)
  • Better handling of special cases:
    • Unicode and emoji support
    • Whitespace preservation
    • Tab character handling
    • Multiple line endings (\n, \r, \r\n)
  • Support for complex operations:
    • Sequential replacements
    • Non-overlapping matches
    • Empty search/replace for append/delete operations
    • Single line deletion
  • Comprehensive test coverage with snapshot tests
  • Improved error handling and validation

Breaking Changes:

  • None. The original ApplyPatch remains unchanged while ApplyPatchV2 is introduced as a new tool

Testing:

  • Added extensive snapshot tests covering all major functionality
  • Each test case is documented with clear descriptions
  • Test coverage includes edge cases and special character handling

This PR introduces a new version of the patch functionality with several improvements:

- Enhanced fuzzy matching with configurable similarity threshold
- Better handling of special cases:
  - Unicode and emoji support
  - Whitespace preservation
  - Tab character handling
  - Multiple line endings (\n, \r, \r\n)
- Support for complex operations:
  - Sequential replacements
  - Non-overlapping matches
  - Empty search/replace for append/delete operations
  - Single line deletion
- Comprehensive test coverage with snapshot tests
- Improved error handling and validation

Breaking Changes:
- None. The original ApplyPatch remains unchanged while ApplyPatchV2 is introduced as a new tool

Related: #N/A
@tusharmath tusharmath changed the title json search replace feat(patch): introduce ApplyPatchV2 with enhanced fuzzy matching Jan 28, 2025
@tusharmath tusharmath enabled auto-merge (squash) January 28, 2025 07:57
…json-search-replace

# Conflicts:
#	crates/forge_app/src/service/snapshots/forge_app__service__system_prompt__tests__tool_unsupported.snap
#	crates/forge_tool/src/fs/fs_write.rs
#	crates/forge_tool/src/fs/snapshots/forge_tool__fs__fs_write__test__fs_write_file_exists.snap
@tusharmath tusharmath merged commit fda37a7 into main Jan 29, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant