Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

New Roo Tool insert and search replace tools - #538

Merged
mrubens merged 15 commits into
RooCodeInc:mainfrom
samhvw8:feat/insert_and_search_replace_tools
Jan 28, 2025
Merged

New Roo Tool insert and search replace tools#538
mrubens merged 15 commits into
RooCodeInc:mainfrom
samhvw8:feat/insert_and_search_replace_tools

Conversation

@samhvw8

@samhvw8 samhvw8 commented Jan 24, 2025

Copy link
Copy Markdown
Contributor

Description

New two tool that insert code block and search and replace term with regex
both two tool support multiple operations

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

  • My code follows the patterns of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Additional context

Related Issues

Reviewers


Important

Introduce insert_code_block and search_and_replace tools with experimental feature toggles and corresponding tests and UI updates.

  • New Features:
    • Add insert_code_block tool for inserting code blocks at specific lines in Cline.ts.
    • Add search_and_replace tool for regex-based search and replace in Cline.ts.
  • Tool Descriptions:
    • Add descriptions for insert_code_block and search_and_replace in tools/index.ts.
  • Experimental Features:
    • Add experimental feature toggles for new tools in experiments.ts and SettingsView.tsx.
  • Testing:
    • Add tests for new tools in system.test.ts and ClineProvider.test.ts.
  • UI Updates:
    • Update SettingsView.tsx to include checkboxes for enabling experimental tools.

This description was created by Ellipsis for 909d4c098128efb56b3cfe2add1e73cc135e155f. It will automatically update as commits are pushed.

@changeset-bot

changeset-bot Bot commented Jan 24, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5579922

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@samhvw8
samhvw8 marked this pull request as draft January 24, 2025 18:09
Comment thread src/core/diff/insert-groups.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider adding validation to ensure that indices in insertGroups are within the bounds of the original array and are non-negative. This will prevent potential errors or unexpected behavior.

@samhvw8
samhvw8 force-pushed the feat/insert_and_search_replace_tools branch from 03bfee4 to 9750f91 Compare January 26, 2025 20:51
@samhvw8
samhvw8 marked this pull request as ready for review January 26, 2025 20:52
Comment thread src/core/webview/ClineProvider.ts Outdated
Comment thread src/core/webview/ClineProvider.ts Outdated
Comment on lines 1192 to 1229

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In general I'm curious why this doesn't just look at the extension state like the other settings

Comment thread src/shared/ExtensionMessage.ts Outdated
Comment thread src/shared/experiments.ts Outdated
Comment thread src/shared/experiments.ts Outdated
Comment thread src/shared/experiments.ts Outdated
Comment thread src/shared/experiments.ts Outdated
@mrubens

mrubens commented Jan 27, 2025

Copy link
Copy Markdown
Collaborator

Nice, left some comments but this definitely seems like a step in the right direction for managing these experiments!

@samhvw8
samhvw8 force-pushed the feat/insert_and_search_replace_tools branch from 909d4c0 to 42a1e99 Compare January 27, 2025 08:00
Comment thread src/core/prompts/tools/insert-code-block.ts Outdated
Comment thread webview-ui/src/components/settings/SettingsView.tsx Outdated
setEnhancementApiConfigId: (value: string) => void
experimentalDiffStrategy: boolean
setExperimentalDiffStrategy: (value: boolean) => void
autoApprovalEnabled?: boolean

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this removal intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, it's intentional because ExtensionStateContextType extend ExtensionState, and autoApprovalEnabled still have in that ExtensionState, so i clean up a bit

Comment thread src/core/Cline.ts
mrubens and others added 9 commits January 28, 2025 21:05
- Add experiments.ts to manage experimental features
- Refactor experimental diff strategy into experiments system
- Add UI components for managing experimental features
- Add tests for experimental tools
- Update system prompts to handle experiments
Change ExperimentId type to be value-based rather than key-based
Make experiment record types more strict with proper typing
Pass full experiment config object instead of single boolean flag
Update type definitions and usages across codebase
- Remove redundant id field from ExperimentConfig interface
- Update UI components to use experiment keys directly
- Improve type safety by using key-based mapping instead of object values
@samhvw8
samhvw8 force-pushed the feat/insert_and_search_replace_tools branch from 6e34a69 to 411182a Compare January 28, 2025 14:06
- Some modes have restrictions on which files they can edit. If you attempt to edit a restricted file, the operation will be rejected with a FileRestrictionError that will specify which file patterns are allowed for the current mode.
- Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write.
* For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$"
- Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This was a duplicate of two lines up

Comment on lines -13 to -14
const settingsDir = context ? path.join(context.globalStorageUri.fsPath, "settings") : "<settings directory>"
const customModesPath = path.join(settingsDir, "cline_custom_modes.json")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unused

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants