Commit Graph

52 Commits

Author SHA1 Message Date
Daniel Riccio
f696f8e0f1 refactor: remove debug functionality 2025-01-14 18:03:03 -05:00
Daniel Riccio
e6d3db6075 refactor: use confidenceThreshold from the settings in new diff strategy 2025-01-14 17:59:46 -05:00
Daniel Riccio
e00ec0cc3f test: add unit tests for NewUnifiedDiffStrategy constructor and confidence threshold behavior
- Introduced tests for the NewUnifiedDiffStrategy constructor to verify default and custom confidence thresholds.
- Ensured that the minimum confidence threshold is enforced, preventing values below 0.8.
- Enhanced test coverage for the strategy's initialization logic, improving overall reliability and maintainability.
2025-01-14 17:57:55 -05:00
Daniel Riccio
f6e85fa133 feat: introduce experimental diff strategy toggle and enhance diff handling
- Added support for an experimental diff strategy in the Cline class, allowing users to opt for a new unified diff approach.
- Updated the getDiffStrategy function to accommodate the experimental strategy, adjusting the fuzzy match threshold accordingly.
- Integrated experimentalDiffStrategy into the global state management, enabling persistence across sessions.
- Enhanced the ClineProvider and related components to handle the new experimental strategy, including UI updates for user settings.
- Improved task history management to include the experimentalDiffStrategy setting, ensuring consistency in task execution.
- Updated relevant interfaces and types to reflect the new experimentalDiffStrategy property.
2025-01-14 17:57:09 -05:00
Daniel Riccio
a211927097 refactor: enhance error handling and debugging in NewUnifiedDiffStrategy
- Improved error messages for cases where no hunks are found in the diff, providing clearer guidance on format requirements.
- Added detailed debug information for search and edit failures, including context line ratios and potential issues to assist users in troubleshooting.
- Streamlined the logic for determining the cause of edit failures, distinguishing between search and content mismatch errors.
- Enhanced overall readability and maintainability of the code with consistent formatting and structured comments.
2025-01-14 17:09:20 -05:00
Daniel Riccio
5c420bb7e1 refactor: cleanup 2025-01-14 17:02:39 -05:00
Daniel Riccio
b30cb29358 refactor: cleanup 2025-01-14 17:01:46 -05:00
Daniel Riccio
a323a1008e refactor: enhance Git fallback strategy in edit processing
- Improved logging within the applyGitFallback function to provide clearer insights during the commit and cherry-pick processes.
- Streamlined error handling to ensure more informative console outputs when operations fail.
- Maintained consistent formatting and indentation for better readability and maintainability of the code.
- Ensured temporary directory cleanup is handled correctly in all scenarios, preventing potential resource leaks.
2025-01-14 17:00:51 -05:00
Daniel Riccio
3d901929c2 test: add comprehensive tests for NewUnifiedDiffStrategy error handling and edge cases 2025-01-14 16:44:15 -05:00
Daniel Riccio
534888af97 refactor: improve NewUnifiedDiffStrategy with enhanced formatting and error handling
- Cleaned up formatting in the parseUnifiedDiff method to ensure consistent indentation and spacing.
- Updated documentation to clarify format requirements for generating unified diffs.
- Added error handling for cases where no hunks are found in the provided diff, improving robustness.
- Enhanced overall readability of the code by standardizing comments and structure.
2025-01-14 12:20:52 -05:00
Daniel Riccio
d25f370013 refactor: enhance NewUnifiedDiffStrategy for improved diff parsing and context handling
- Refactored the parseUnifiedDiff method to streamline the processing of diff lines and improve context line management.
- Added handling for empty context lines to ensure accurate representation in hunks.
- Updated the tool description to clarify requirements for generating unified diffs, emphasizing the importance of preserving indentation and grouping related changes.
- Improved overall readability and consistency of the code by standardizing formatting and indentation practices.
2025-01-14 12:01:09 -05:00
Daniel Riccio
258024aa5a refactor: enhance search strategies with adaptive thresholds and overlapping windows
- Introduced adaptive confidence thresholds based on file size to improve search accuracy.
- Implemented overlapping window functionality in search strategies to capture matches more effectively.
- Added helper functions for evaluating content uniqueness and creating overlapping windows.
- Enhanced existing search functions (exact, similarity, and Levenshtein) to utilize new strategies for better match validation.
- Improved logging for search results to facilitate debugging and analysis of search performance.
2025-01-14 12:00:29 -05:00
Daniel Riccio
f007f64344 refactor: increase minimum confidence threshold in search strategies
- Updated the minimum confidence level from 0.95 to 0.97 to enhance the accuracy of search results.
- Adjusted confidence calculation in the findLevenshteinMatch function to ensure more reliable matching.
2025-01-10 17:36:43 -05:00
Daniel Riccio
0d004b5c77 refactor: increase context lines in NewUnifiedDiffStrategy
- Updated the maximum context lines from 3 to 6 in the parseUnifiedDiff method to provide more context around changes.
2025-01-10 17:35:22 -05:00
Daniel Riccio
6d68edef3e refactor: implement Git fallback strategy in edit processing
- Introduced a new Git fallback strategy for handling edits when confidence levels are low.
- Replaced the previous Git edit strategy with a more robust approach that utilizes temporary directories and commits for original, search, and replace states.
- Enhanced error handling and logging for better debugging during the edit process.
- Updated the main edit function to incorporate the Git fallback strategy, ensuring it is attempted when other strategies fail.
- Improved overall structure and readability of the applyGitFallback function, streamlining the process of applying changes using Git.
2025-01-10 17:34:44 -05:00
Daniel Riccio
ab31aea551 refactor: enhance context handling and confidence validation in edit strategies
- Improved the applyContextMatching function to better track context lines and handle changes more accurately.
- Updated the applyEdit function to enforce a stricter confidence check, now requiring a confidence level of 1 for successful edits.
- Refined the processing logic for addition and removal changes, ensuring more reliable diff application.
- Enhanced debugging capabilities with clearer logging and validation checks for edit results.
2025-01-09 16:38:32 -05:00
Daniel Riccio
5351b3d981 refactor: improve the prompt to prevent absurd amounts of context being generated 2025-01-09 12:05:36 -05:00
Daniel Riccio
44dc489e49 revert: lower the confidence levels 2025-01-08 17:18:09 -05:00
Daniel Riccio
9591ae062a Refactor edit strategies and confidence validation in unified diff processing
- Enhanced the applyContextMatching and applyDMP functions to improve handling of context and edit changes.
- Updated confidence validation logic to ensure stricter checks, now requiring a minimum confidence of 1 for successful edits.
- Refined the way changes are processed, including better tracking of removal and addition changes.
- Improved the validation of edit results by incorporating strategy-specific checks and logging for better debugging.
- Adjusted the applyEdit function to ensure strategies are applied in a more robust manner, with clearer handling of debug mode.
2025-01-08 17:13:46 -05:00
Daniel Riccio
995692c48e Improve strategies and confidence system 2025-01-08 12:28:31 -05:00
Daniel Riccio
594481643b Add New Unified Diff Strategy Implementation
- Introduced a new unified diff strategy with support for context matching, DMP, and Git-based edits.
- Implemented helper functions for parsing unified diffs and evaluating similarity.
- Added types for changes, hunks, and diffs to enhance type safety.
- Created a main edit function that applies strategies sequentially based on confidence levels.
- Included detailed descriptions and usage examples for the new strategy.
2025-01-07 19:01:12 -05:00
Daniel Riccio
2857dd4996 Refactor test cases in search-replace and unified strategies to use async/await for applyDiff method, ensuring consistent handling of asynchronous operations across all tests. 2025-01-07 19:00:29 -05:00
Daniel Riccio
70cf27071b Refactor applyDiff methods in search-replace and unified strategies to return Promises for asynchronous handling 2025-01-07 18:59:55 -05:00
Daniel Riccio
420c6c72dd Replace SearchReplaceDiffStrategy with NewUnifiedDiffStrategy in getDiffStrategy function 2025-01-07 18:59:16 -05:00
Daniel Riccio
612d7020f3 Add unit tests for NewUnifiedDiffStrategy 2025-01-07 18:58:23 -05:00
Daniel Riccio
4356cffb0d Refactor applyDiff method to return a Promise and add logging for diff results 2025-01-07 18:57:40 -05:00
Matt Rubens
3aca5e813e Make fuzzy diff matching configurable (and default to off) 2024-12-18 15:26:44 -05:00
Matt Rubens
38f33de642 Fix bad matching bug with empty lines 2024-12-17 09:28:50 -05:00
Matt Rubens
800db618bb Strip line numbers from write_to_file 2024-12-17 09:28:37 -05:00
Matt Rubens
7163b173e8 Fix test 2024-12-17 01:24:10 -05:00
Matt Rubens
792780e78d Go back to older prompt 2024-12-17 01:15:15 -05:00
Matt Rubens
eb56cac16b Do fuzzy match search from the middle out and expand window to 20 lines 2024-12-17 00:10:15 -05:00
Matt Rubens
06202be46f Remove debug checkbox 2024-12-16 22:58:04 -05:00
Matt Rubens
475776da98 Bugfix to strip line numbers with leading space 2024-12-16 17:45:00 -05:00
Matt Rubens
905c68dd9e Handle pure insertions and deletions with diffs 2024-12-16 16:50:45 -05:00
Matt Rubens
61b2104345 Fix bug where start/end line not passed to diff 2024-12-16 12:26:40 -05:00
Matt Rubens
c2b4b05459 Diff debugging 2024-12-16 12:19:44 -05:00
Matt Rubens
e6c79eff80 Instead of trusting the prompt, just strip line numbers from diff contents 2024-12-15 22:40:59 -05:00
Matt Rubens
4b27264a21 Revert "Merge pull request #125 from RooVetGit/search_replace_prompt_hotfix"
This reverts commit 7d7a8563b7, reversing
changes made to 868f4cddc9.
2024-12-15 22:38:21 -05:00
Matt Rubens
0c08c0fe96 Search/replace prompt hotfix for Gemini 2024-12-15 21:00:15 -05:00
Matt Rubens
24474683f4 Fix test 2024-12-15 19:56:11 -05:00
Matt Rubens
c1dfdeda22 Better error messages for diffs 2024-12-15 19:48:55 -05:00
Matt Rubens
25da0b1907 Negative indentation 2024-12-15 16:53:48 -05:00
Matt Rubens
468d317f2f More indentation tests 2024-12-15 15:28:24 -05:00
Matt Rubens
e4c23fb61d Prioritize exact line matches in search/replace 2024-12-15 15:19:58 -05:00
Matt Rubens
2292372e42 Improvements to search/replace diff 2024-12-14 20:45:06 -05:00
Matt Rubens
f3b77c9c62 Support fuzzy matching for apply_diff 2024-12-14 13:52:47 -05:00
Matt Rubens
b2c8805e5b Update the prompt to encourage diff edits when the box is checked 2024-12-13 23:31:01 -05:00
Matt Rubens
77d7fc0a44 Fix indentation bug with diff replacing a single search line 2024-12-13 00:05:23 -05:00
Matt Rubens
ba8bed90d8 Handle Windows line endings (#62) 2024-12-10 20:24:51 -05:00