Roo-Code/src
Hannes Rudolph 951cefc0fc
Refactor: Improve file tool context formatting and diff error guidance (#2278)
* refactor: Change read_file result format to XML

Modifies how the result of the `read_file` tool is presented
in the conversation history sent to the AI model.

Previously, the format was:
[read_file for 'path/to/file'] Result:
{content_or_error}

This commit changes the format to use XML tags for better
structure and potentially easier parsing by the model:
<file>
  <path>path/to/file</path>
  <content>
{content_or_error}
  </content>
</file>

This change only affects the `read_file` tool result formatting
within the user context message constructed in `src/core/Cline.ts`.
Other tool result formats remain unchanged.

* fix: Update error message for better clarity in multi-search-replace strategy

Refines the error message returned when no sufficiently similar match is found during the multi-search-replace operation. The message now includes a clearer instruction to use the read_file tool for obtaining the latest file content before attempting to apply the diff again.

* refactor: Update readFileTool to return results in XML format

Modifies the `readFileTool` function to format the output as XML, enhancing the structure of the returned file content. This change aligns with previous updates to ensure consistent result formatting across tools.

* refactor: Simplify result handling for tool responses in Cline

This update refines the handling of tool responses in the `Cline` class by removing the XML formatting for `read_file` results and consolidating the logic for pushing results to the user message content. The changes ensure that all tool results are processed uniformly, improving code clarity and maintainability.

* test: Update read_file tests to validate XML formatted results

This commit modifies the assertions in the `read_file` tool tests to check for the expected XML format in the results. The changes ensure that the output structure aligns with recent updates to the tool's response formatting, enhancing test accuracy and reliability.

* test: Refactor assertions in read_file tests to use expected XML variable

This commit updates the `read_file` tool tests to utilize a predefined variable for the expected XML output, improving readability and maintainability of the test code. The changes ensure consistency in the expected results across multiple test cases.
2025-04-04 18:26:25 -04:00
..
__mocks__ Re-enable ClineProvider tests (#2047) 2025-03-27 21:06:54 -07:00
__tests__ Removed hardcoded filenames to GlobalFileNames constants. (#1904) 2025-03-24 13:32:44 -04:00
activate Revert "Better logic for choosing the view column when opening Roo in a tab" (#2285) 2025-04-04 02:14:33 -04:00
api Jbbrown/bedrock caching (#2071) 2025-04-03 13:05:29 -04:00
core Refactor: Improve file tool context formatting and diff error guidance (#2278) 2025-04-04 18:26:25 -04:00
exports Ironing out some kinks when running evals with high parallelism (#2280) 2025-04-04 09:08:12 -07:00
i18n Link to the settings page from the auto approve toolbar (#2111) 2025-03-30 12:22:53 -04:00
integrations Allow processes to access the Roo Code API via a unix socket (#2232) 2025-04-02 12:42:00 -07:00
schemas Jbbrown/bedrock caching (#2071) 2025-04-03 13:05:29 -04:00
services Roo Vet -> Roo Code (#2269) 2025-04-03 15:57:20 -04:00
shared Add the gemini 2.5 pro preview model with upper bound pricing (#2300) 2025-04-04 15:12:18 -04:00
utils Revert "feat @-mention window path style & file with space (#1924)" (#2162) 2025-03-31 15:56:47 -05:00
extension.ts Allow processes to access the Roo Code API via a unix socket (#2232) 2025-04-02 12:42:00 -07:00