fix: add ApplyPatch support to Cursor preset#1426
Open
svarlamov wants to merge 1 commit into
Open
Conversation
Cursor can emit `tool_name: "ApplyPatch"` for file edits that use the patch format (common with OpenAI/Codex models). Previously these were classified as ToolClass::Skip, leaving edited lines unattributed. Add "ApplyPatch" to the Cursor file-edit whitelist and extract file paths from patch text using the same `*** Update File:` / `*** Add File:` conventions used by Droid, Codex, and GitHub Copilot presets. Fixes #1421 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Can this PR be merged now? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1421
"ApplyPatch"to the Cursor tool classifier so it's treated asToolClass::FileEditinstead of being skipped*** Update File:,*** Add File:,*** Delete File:,*** Move to:) — the same format already supported by Droid, Codex, OpenCode, and GitHub Copilot presetsTest plan
test_cursor_apply_patch_pre_file_edit— preToolUse with patch containing*** Update File:produces PreFileEdit with correct pathtest_cursor_apply_patch_post_file_edit— postToolUse with patch containing multiple file directives extracts all pathstest_cursor_apply_patch_with_absolute_path_in_patch— absolute paths in patch text are handled correctlytest_tool_classification_all_agents— classifier correctly mapsApplyPatchtoFileEditfor Cursor🤖 Generated with Claude Code