Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Roo Cline Changelog

## [2.1.14]

- Fix bug where diffs were not being applied correctly and try Aider's unified diff prompt

## [2.1.13]

- Fix https://github.com/RooVetGit/Roo-Cline/issues/50 where sound effects were not respecting settings
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Roo Cline",
"description": "A fork of Cline, an autonomous coding agent, with some added experimental configuration and automation features.",
"publisher": "RooVeterinaryInc",
"version": "2.1.13",
"version": "2.1.14",
"icon": "assets/icons/rocket.png",
"galleryBanner": {
"color": "#617A91",
Expand Down
29 changes: 25 additions & 4 deletions src/core/Cline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1231,11 +1231,32 @@ export class Cline {
break
}

await fs.writeFile(absolutePath, newContent)
await vscode.window.showTextDocument(vscode.Uri.file(absolutePath), { preview: false })
const { newProblemsMessage, userEdits, finalContent } =
await this.diffViewProvider.saveChanges()
this.didEditFile = true // used to determine if we should wait for busy terminal to update before sending api request
if (userEdits) {
await this.say(
"user_feedback_diff",
JSON.stringify({
tool: fileExists ? "editedExistingFile" : "newFileCreated",
path: getReadablePath(cwd, relPath),
diff: userEdits,
} satisfies ClineSayTool),
)
pushToolResult(
`The user made the following updates to your content:\n\n${userEdits}\n\n` +
`The updated content, which includes both your original modifications and the user's edits, has been successfully saved to ${relPath.toPosix()}. Here is the full, updated content of the file:\n\n` +
`<final_file_content path="${relPath.toPosix()}">\n${finalContent}\n</final_file_content>\n\n` +
`Please note:\n` +
`1. You do not need to re-write the file with these changes, as they have already been applied.\n` +
`2. Proceed with the task using this updated file content as the new baseline.\n` +
`3. If the user's edits have addressed part of the task or changed the requirements, adjust your approach accordingly.` +
`${newProblemsMessage}`,
)
} else {
pushToolResult(`Changes successfully applied to ${relPath.toPosix()}:\n\n${newProblemsMessage}`)
}
await this.diffViewProvider.reset()

pushToolResult(`Changes successfully applied to ${relPath.toPosix()}:\n\n${diffRepresentation}`)
break
}
} catch (error) {
Expand Down
23 changes: 21 additions & 2 deletions src/core/prompts/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,29 @@ Your file content here

${diffEnabled ? `
## apply_diff
Description: Apply a diff to a file at the specified path. The diff should be in unified format (diff -u) and can be used to apply changes to a file. This tool is useful when you need to make specific modifications to a file based on a set of changes provided in a diff.
Description: Apply a diff to a file at the specified path. The diff should be in unified format ('diff -U0') and can be used to apply changes to a file. This tool is useful when you need to make specific modifications to a file based on a set of changes provided in a diff.

- Make sure you include the first 2 lines with the file paths.
- Don't include timestamps with the file paths.
- Start each hunk of changes with a '@@ ... @@' line. Don't include line numbers like 'diff -U0' does. The user's patch tool doesn't need them.
- The user's patch tool needs CORRECT patches that apply cleanly against the current contents of the file!
- Think carefully and make sure you include and mark all lines that need to be removed or changed as '-' lines.
- Make sure you mark all new or modified lines with '+'.
- Don't leave out any lines or the diff patch won't apply correctly.
- Indentation matters in the diffs!
- Start a new hunk for each section of the file that needs changes.
- Only output hunks that specify changes with '+' or '-' lines.
- Skip any hunks that are entirely unchanging ' ' lines.
- Output hunks in whatever order makes the most sense.
- Hunks don't need to be in any particular order.
- When editing a function, method, loop, etc use a hunk to replace the *entire* code block.
- Delete the entire existing version with '-' lines and then add a new, updated version with '+' lines.
- This will help you generate correct code and correct diffs.
- To move code within a file, use 2 hunks: 1 to delete it from its current location, 1 to insert it in the new location.

Parameters:
- path: (required) The path of the file to apply the diff to (relative to the current working directory ${cwd.toPosix()})
- diff: (required) The diff in unified format (diff -u) to apply to the file.
- diff: (required) The diff in unified format (diff -U0) to apply to the file.
Usage:
<apply_diff>
<path>File path here</path>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const isWAV = (filepath: string): boolean => {
return path.extname(filepath).toLowerCase() === ".wav"
}

let isSoundEnabled = true
let isSoundEnabled = false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't help sneaking this one in, just to be safe.

Copy link
Contributor

@lloydchang lloydchang Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feedback from https://discord.com/channels/1275535550845292637/1275535550845292640/1315443495711936634

alexamd13 wrote about sound effects:

overly unnecessary for your average user, if they see a task has been complete, they'll already see it via text


/**
* Set sound configuration
Expand Down
Loading