diff --git a/.changeset/nine-dolphins-judge.md b/.changeset/nine-dolphins-judge.md new file mode 100644 index 0000000000..bfcf8b4abe --- /dev/null +++ b/.changeset/nine-dolphins-judge.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Modified diff regex to account for trailing > in search & replace blocks diff --git a/src/core/assistant-message/diff.ts b/src/core/assistant-message/diff.ts index e03d77243a..f5696fc652 100644 --- a/src/core/assistant-message/diff.ts +++ b/src/core/assistant-message/diff.ts @@ -8,11 +8,13 @@ const LEGACY_SEARCH_BLOCK_CHAR = "<" const LEGACY_REPLACE_BLOCK_CHAR = ">" // Replace the exact string constants with flexible regex patterns -const SEARCH_BLOCK_START_REGEX = /^[-]{3,} SEARCH$/ +const SEARCH_BLOCK_START_REGEX = /^[-]{3,} SEARCH>?$/ +const LEGACY_SEARCH_BLOCK_START_REGEX = /^[<]{3,} SEARCH>?$/ + const SEARCH_BLOCK_END_REGEX = /^[=]{3,}$/ -const REPLACE_BLOCK_END_REGEX = /^[+]{3,} REPLACE$/ -const LEGACY_SEARCH_BLOCK_START_REGEX = /^[<]{3,} SEARCH$/ -const LEGACY_REPLACE_BLOCK_END_REGEX = /^[>]{3,} REPLACE$/ + +const REPLACE_BLOCK_END_REGEX = /^[+]{3,} REPLACE>?$/ +const LEGACY_REPLACE_BLOCK_END_REGEX = /^[>]{3,} REPLACE>?$/ // Helper functions to check if a line matches the flexible patterns function isSearchBlockStart(line: string): boolean {