Commit graph

2395 commits

Author SHA1 Message Date
Ross McFarland
260fc30043
feat(settings): Rate-limit setting updated to be per-profile (#2376)
* Rate-limit setting updated to be per-profile

* Correct rateLimitSeconds translations

* Add missing d to rateLimitSecondsMigrate

* Fix fr rate-limit translation
2025-04-07 16:24:38 -04:00
KJ7LNW
af9e471c92
dev: dynamic Vite port detection for webview development (#2339)
Implements a solution for the Vite port collision issue that allows easier development of Roo across multiple instances of VSCode in different Roo repository directories.

This may also fix crashes and strange behavior between multiple running instances that would otherwise create port conflicts. This is solved using the following automated process:
- When Vite automatically selects an alternative port, a custom plugin automatically writes the port to a '.vite-port' file in the repository root
- ClineProvider automatically reads the port from this file, falling back gracefully to port 5173 if the file doesn't exist
- No user intervention is necessary as the entire process is handled automatically
- Added detailed logging for debugging
- Added .vite-port to .gitignore

The extension now connects to the correct Vite development server port automatically, even when the default port (5173) is already in use.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
2025-04-07 15:12:41 -04:00
Matt Rubens
d0661fb0c7
Don't automatically convert types when parsing XML (#2389)
* Don't automatically convert types when parsing XML

* PR feedback
2025-04-07 14:57:02 -04:00
Nico Bihan
320ef77d79
Added to Vertex AI Provider gemini 2.5 Pro Preview (#2384)
* Added Gemini 2.5 Pro model to Vertex AI Provider

* Adds Gemini 2.5 Pro preview model

Adds configuration for the new Gemini 2.5 Pro preview model,
including its token limits, context window size, image support, and
pricing information.
2025-04-07 12:15:09 -04:00
Yu SERIZAWA
580672ffc8
feat: enhance rule file loading with .roo/rules directory support (#2354)
* feat: enhance rule file loading with .roo/rules directory support

- Introduced functions to safely read files and check for directory existence.
- Added capability to read all text files from a specified directory in alphabetical order.
- Updated `loadRuleFiles` to prioritize loading rules from a `.roo/rules/` directory, falling back to existing rule files if necessary.
- Enhanced `addCustomInstructions` to support loading mode-specific rules from a `.roo/rules-{mode}/` directory, improving flexibility in rule management.

This change improves the organization and retrieval of rule files, allowing for better modularity and maintainability.

* Updated strings and translations

* Add tests

* Revert changes to system prompt translations

* Fix path resolution

* Make instruction structure clearer

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
2025-04-07 11:46:30 -04:00
Matt Rubens
0e4be83c35
Fixes to resumeTask and isTaskInHistory (#2380) 2025-04-07 11:41:08 -04:00
Franciszek Piszcz
cf74568f66
feat(RooCodeAPI): implement resumeTask and isTaskInHistory (#1672) 2025-04-07 08:19:47 -07:00
Marco Quinten
f5a4b425da
feat(browserTool): Implement hover action (#2368)
* Implement hover action for the browser action tool

* Update snapshots
2025-04-07 09:35:14 -04:00
Marco Quinten
fff8fdd3f3
feat(browserTool): Implement resize action (#2370)
* Implement resize action for browser action tool

* Update snapshots
2025-04-07 09:34:32 -04:00
Aleksandr Kirillov
88cac3c9d8
feat: add command to focus Roo Code input field (#2369)
* feat: add command to focus Roo Code input field

* fixup! feat: add command to focus Roo Code input field

* fixup! feat: add command to focus Roo Code input field
2025-04-07 07:54:49 -04:00
Greg Taylor
57d97319dc
fix: persist settings on api.setConfiguration (#2341)
Values weren't being saved to the settings store, preventing
switching to newly created profiles.

Co-authored-by: Greg Taylor <gregtaylor@netflix.com>
2025-04-06 08:19:30 -07:00
KJ7LNW
5fb9af40fb
feat: enhance Rust tree-sitter parser with advanced language structures (#2335)
* test: add comprehensive Rust Tree-sitter tests

Add test suite for Rust language support in Tree-sitter:
- Verify parsing of struct definitions
- Verify parsing of method definitions within impl blocks
- Verify parsing of standalone function definitions
- Add tests for complex Rust structures
- Include skipped debug test for future diagnostics

These tests confirm the existing Rust support in Tree-sitter is working correctly and provide a foundation for future enhancements to the Rust parser.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: enhance Rust tree-sitter parser with advanced language structures

- Add support for additional Rust language structures:
  - Enum definitions
  - Trait definitions
  - Impl trait for struct
  - Generic structs with lifetime parameters
  - Macro definitions
  - Module definitions
  - Union types
  - Closures
  - Match expressions
  - Where clauses
  - Async functions
  - Impl blocks with generic parameters
  - Complex trait bounds

- Update tests to verify capture of these structures
- Modify debug helper to use environment variables

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

---------

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
2025-04-05 22:11:43 -04:00
KJ7LNW
5e0c9a71e4
fix: clamp negative line numbers when reading files (#2337)
Improve handling of AI-generated line numbers:
- Clamp negative startLine values to 0 instead of throwing errors
- Convert non-integer line numbers to integers automatically
- Only reject when line numbers aren't numbers at all

These changes prevent unnecessary model retries by handling imperfect
AI-generated line numbers gracefully, making the system more robust
when interacting with AI models.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
2025-04-05 22:10:11 -04:00
Diarmid Mackenzie
7661ef97cd
Tidy up following ClineProvider refactor (#2182)
* Remove unused imports

* Restore protected status for mcpHub property

* More mcpHub tidy-up

* Remove need for access to private "view" property

Increase type flexibility so we can directly use postMessageToWebview()

* Make ensureCacheDirectoryExists private again

expose new public writeDataToCache() method to commonize code.
also decided to leave updateApiConfiguration as public, since widely used in diverse ways.

* Match naming of readModelsFromCache.

Symmetric naming of functions that complement each other.

* Decision: Leave readModelsFromCache as public

* Make updateGlobalState and setGlobalState private again

Stop using deprecated (private) method.  Use contextProxy set/getValue methods instead.
Utility functions provided for brevity.

* Add clarifying comment to explain presence of utility functions

* Prefer this/provider.log over outputChannel.appendLine

log is already public, outputChannel should be private.
But also prefer log internally for the additional value of console logging, plus code brevity.

* Lock down access to properties as far as reasonably possible

* PR feedback - don't relax type checks

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
2025-04-05 18:00:23 -04:00
Yu SERIZAWA
d6d5670e38
feat: Add support for .roorules configuration files (#2309)
* feat: Add support for .roorules configuration files

- Add .roorules to the list of supported rule files
- Improve mode-specific rule file handling to prioritize .roorules over .clinerules
- Update file loading logic to track which rule file was successfully loaded
- Add test cases for .roorules functionality

This change maintains backward compatibility with existing .clinerules while
introducing support for the new .roorules format as the preferred configuration
method.

* refactor: simplify rule file loading by removing unused rules

- Removed .cursorrules and .windsurfrules from the list of rule files in loadRuleFiles function.

* refactor: update loadRuleFiles to return single rule file content

- Modified loadRuleFiles function to return content from the first available rule file instead of combining multiple rule files.
- Updated tests to reflect the new behavior of loading only the .roorules file content when available, ensuring clarity in rule file handling.

* fix: update prompts for deprecated rule file references

- Updated prompts in the English locale to reflect the deprecation of .clinerules in favor of .roorules.
- Added notes in the prompts indicating that .clinerules will stop working soon, ensuring users are aware of the upcoming changes.

* Translations

* Update links

* Revert README changes

* Add missing spans around links

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
2025-04-05 14:55:07 -04:00
Kyle Hoskins
8fe70e36c3
Improve combineApiRequests performance (#2318)
* Improve combineApiRequests performance

* One more optimization, and more tests

---------

Co-authored-by: cte <cestreich@gmail.com>
2025-04-05 10:51:00 -07:00
Sam Hoang Van
bf648856ba
feat: add workspace tracking to history items (#2054)
Track the current workspace path in history items to enable filtering and organization of history by workspace. This change adds the workspace property to the history schema and ensures it's saved with each history entry.
2025-04-05 08:23:10 -04:00
Hannes Rudolph
3f6e07adf1
refactor(mcp): Implement reference counting for McpHub lifecycle (#2310)
Problem:
Closing auxiliary windows (e.g., from "open in editor") could prematurely dispose the shared singleton McpHub instance, shutting down MCP servers unexpectedly while other panels (like the sidebar) might still be active.

Solution:
Implemented reference counting directly within the McpHub class to manage its own lifecycle based on active clients (ClineProvider instances).
- Added `refCount`, `registerClient()`, and `unregisterClient()` methods to McpHub.
- McpHub now disposes itself only when the last registered client unregisters (`refCount` reaches 0).
- ClineProvider instances now call `mcpHub.registerClient()` upon initialization and `mcpHub.unregisterClient()` upon disposal.
- Removed the direct `mcpHub.dispose()` call from ClineProvider.dispose.

Benefit:
This ensures the shared McpHub instance remains active as long as at least one ClineProvider instance is using it. Cleanup now correctly occurs only when the last provider is closed or during full extension deactivation. This centralizes the resource's lifecycle logic within the resource class itself.

Files Changed:
- src/services/mcp/McpHub.ts
- src/core/webview/ClineProvider.ts
2025-04-04 23:14:05 -04:00
Peter Dave Hello
359a2f5442
Improve zh-TW Traditional Chinese locale (#2305)
Continuously improve the translation for a better quality.
2025-04-04 22:22:48 -04:00
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
Matt Rubens
e2a8ec8d0e
Add the gemini 2.5 pro preview model with upper bound pricing (#2300) 2025-04-04 15:12:18 -04:00
Chris Estreich
8f356711f1
Ironing out some kinks when running evals with high parallelism (#2280) 2025-04-04 09:08:12 -07:00
Matt Rubens
16c1ab9ab5
Revert "Better logic for choosing the view column when opening Roo in a tab" (#2285)
* Revert "Better logic for choosing the view column when opening Roo in a tab (…"

This reverts commit 7eea755703.

* Create hip-pumpkins-mate.md
2025-04-04 02:14:33 -04:00
Matt Rubens
664a424356
v3.11.5 (#2283)
* v3.11.5

* Update announcement
2025-04-04 01:42:26 -04:00
Povilas Kanapickas
50eed96087
fix: Improve handling of escaped markers in apply_diff (#2274)
* fix: Improve handling of escaped markers in apply_diff

unescapeMarkers() is supposed to fix escaped merge conflict markers so
that they match the code. However the function has a bug which requires
SEARCH and REPLACE strings in the markers to be replaced. This is not
part of merge conflict markers, so many valid cases were previously
missed.

* Revert test changes

* Add new test

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
2025-04-04 00:46:51 -04:00
Matt Rubens
7eea755703
Better logic for choosing the view column when opening Roo in a tab (#2282)
* Better logic for choosing the view column when opening Roo in a tab

* PR feedback
2025-04-03 23:59:17 -04:00
Matt Rubens
1a0117b009
Show menu buttons in tab view (#2281)
* Show menu buttons in tab view

* PR feedback
2025-04-03 23:35:22 -04:00
Povilas Kanapickas
065c5ab222
fix: Improve error message when apply_diff structure is invalid (#2260)
Currently all errors in apply_diff diff structure are assumed to be
related to merge conflicts. This is unfortunate because it is way more
likely that LLM simply made an error structuring the diff. The LLM is
then directed to fix escaping in the diff from which it doesn't recover.

It is safe to assume that missing or extra "<<<<<<< SEARCH" or ">>>>>>>
REPLACE" strings are likely bad diff structure, because while "<<<<<<<"
and ">>>>>>>" are common merge conflict markers, no tools add "SEARCH"
and "REPLACE" strings after them. This is likely output of the LLM
itself.

LLM not recovering has been observed in Claude 3.5 Sonnet and Claude 3.7
Sonnet models.

To address the issue, error message now mentions merge conflict markers
and their escaping only if it's clear that errors may come from this
source. In the rest of cases the error message repeats the expected diff
structure back to the LLM.
2025-04-03 16:43:57 -04:00
Matt Rubens
d2f9970654
Roo Vet -> Roo Code (#2269) 2025-04-03 15:57:20 -04:00
jdavis
b38b40656c
mcp supports cwd config and defaults to workspace cwd (#2171)
* mcp supports cwd config and defaults to workspace cwd

* clean up

* Update src/services/mcp/McpHub.ts

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-04-03 15:08:21 -04:00
Smartsheet-JB-Brown
919bb121d0
Jbbrown/bedrock caching (#2071)
* Bedrock prompt caching

* remove whitespace only change to src/api/providers/base-provider.ts

* remove integration test that calls bedrock

* PR prep cleanup

* test file and redundant code cleanup

* updated multi-cache-point

* optimized cache strategy

* cache logic updated. commit before trying to simplify newConversationPlacements

* simplified initial cachePoint logic

* fix the missing caching params for claude 3.7 on bedrock

* undo unintentional changes to README.md files

* fix merge bug that hid use prompt cache checkbox

* prep for PR

* remove unintended changes

* revert .gitignore change

* undo unintended changes

* Issue 1998 - Unable to use ARN. https://github.com/RooVetGit/Roo-Code/issues/1998 - Simplify region extraction from Arns. Change example of ARN use from the foundational model ARN to an inference profile ARN which is what is needed.

* small updates to error message

* more flexible support for ARNs and hardening of ARN handling

* update comment on regex use for platform indipendent cosideration

* small code comment update

* remove duplicative logic to add a region to the arn when cross-region is selected

* Update README files from main branch

* improve error handling when on-demand throughput is not avialable for a foundational model

* fix prompt router bug

* minor tweaks for simplicity

* error messgae formatting

* set new version of bedrock runtime package

* fixes: 2229 - complete prompt doesn't work and appears like a no-op

* remove commented out logger.debug blocks per PR review request

* localize new prompt cache UI inputs

* single source of truth for AWS Region information

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
2025-04-03 13:05:29 -04:00
Matt Rubens
3f5f8bb81f
Remove code for old diff strategies (#2262) 2025-04-03 11:09:02 -04:00
Povilas Kanapickas
552ed0e986
chore: Add more multi-block tests for apply_diff tool (#2261) 2025-04-03 10:55:05 -04:00
Greg Taylor
a3e6c912b0
Add profile management functions to API (#2251)
Co-authored-by: Greg Taylor <gregtaylor@netflix.com>
2025-04-03 01:40:07 -04:00
Thomas Jeung
e9bcee5e2a
feat: Add support for Azure AI Inference Service with DeepSeek-V3 model (#2241)
* feat: Add support for Azure AI Inference Service with DeepSeek-V3 model

* refactor: extract Azure AI inference path to constant to avoid duplication

* fix(tests): update RequestyHandler tests to properly handle Azure inference and streaming

* fix(api): remove duplicate constant and update requesty tests

* refactor: remove unused isAzure property from OpenAiHandler

* refactor(openai): remove unused isAzure and extract Azure check
2025-04-03 00:29:56 -04:00
Matt Rubens
3d53386f1e
Remove the experimental unified diff (#2246) 2025-04-02 23:13:46 -04:00
Matt Rubens
24a46698f3
Fix tree sitter to output 1-based line numbers (#2236) 2025-04-02 17:29:52 -04:00
Chris Estreich
42f7465666
Add a mode switched event, better mode switch e2e test (#2237) 2025-04-02 14:25:11 -07:00
Chris Estreich
a73fce9027
Allow processes to access the Roo Code API via a unix socket (#2232) 2025-04-02 12:42:00 -07:00
Smartsheet-JB-Brown
0409509002
fixes: 2229 - completePrompt doesn't work for bedrock. (#2230)
* fixes: 2229 - completePrompt doesn't work for bedrock.

* fix failing test
2025-04-02 15:35:14 -04:00
Hannes Rudolph
9255dc5df9
fix(diff): Handle line number stripping for deletions in apply_diff (#2193)
The multi-search-replace diff strategy previously did not correctly strip line numbers (`number | `) from the SEARCH block when the REPLACE block was empty. This occurred because the condition for stripping required both blocks to consistently have line numbers.

This prevented successful deletion operations when the SEARCH block content was copied from `read_file` output (which includes line numbers) and the REPLACE block was empty.

This commit updates the line number stripping condition in `applyDiff` to also trigger if the SEARCH block has line numbers and the REPLACE block is empty or contains only whitespace, resolving the bug.

Additionally, a new test case has been added to `multi-search-replace.test.ts` to specifically verify this deletion scenario. All tests now pass with this updated logic.
2025-04-01 15:33:27 -05:00
KJ7LNW
d7ad9470e2
Tree-sitter Enhancements: TSX, TypeScript, JSON, and Markdown Support (#2169)
* feat: add Tree-sitter TSX query support

Added support for parsing TSX files with Tree-sitter:
- Created TSX query patterns for React components and functions
- Fixed field name issues by using direct node matching
- Added comprehensive documentation about TSX component structure
- Created a debug tool to inspect the actual tree structure
- Added test coverage for TSX parsing
- Embedded test fixture directly in the test file

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: combine TypeScript and TSX queries

Reduce duplication by:
- Import TypeScript queries from typescript.ts
- Keep only TSX-specific component and JSX queries
- Update documentation to reflect combined approach

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: update integration for parse definitions

- Adjusted logParseResult to call the actual parse definitions function using WASM from initializeWorkingParser.
- Patched TreeSitter initialization to resolve the WASM path correctly and bypass redundant init() calls.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: should successfully call parseSourceCodeDefinitionsForFile

Mock loadRequiredLanguageParsers to use real parser instance from initializeTreeSitter,
ensuring proper interaction between parseSourceCodeDefinitionsForFile and its dependencies.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: improve test structure for parseSourceCodeDefinitions

- Combine component parsing tests into a single test case
- Update test assertions to match actual parser output
- Fix interface and component definition tests to use VSCodeCheckbox as sample

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: improve React component detection in tree-sitter

- Add tests for complex TSX structures (nested components, HOCs)
- Enhance TSX queries to better detect React components
- Document current limitations in test file

* feat: improve React component detection in TSX files

Make TSX/React component detection more generic and robust by:
- Implementing structural pattern matching instead of specific React wrapper functions
- Adding configurable line threshold for React component inclusion (MIN_COMPONENT_LINES)
- Adding robust HTML element filtering with regex patterns
- Improving React component name handling for nested components
- Ensuring proper context handling for multi-line React components

Also update mock captures in tree-sitter tests to span at least 4 lines
to meet the MIN_COMPONENT_LINES threshold.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: use testParseSourceCodeDefinitions in logParseResult

- Moved testParseSourceCodeDefinitions function to top level
- Updated logParseResult to use testParseSourceCodeDefinitions
- Removed duplicate function from describe block
- Added console.log for debugging output

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: improve React component detection output format

- Remove individual line output for components that don't meet MIN_COMPONENT_LINES threshold
- Update tests to match the new behavior where lines < MIN_COMPONENT_LINES are skipped
- Maintain range output (e.g., 1--4) for component definitions
- Preserve context for larger definitions as ranges only

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add switch/case statement support to tree-sitter TypeScript parser

- Added node patterns in typescript.ts query to capture switch statements, case clauses, and default clauses
- Modified index.ts to avoid duplicate line ranges in the output
- Added test for switch/case statements with complex case blocks
- Fixed line range tracking to prevent duplicate output

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add support for enum declarations in tree-sitter TypeScript parser

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add support for namespace declarations in tree-sitter TypeScript parser

Added query pattern for namespace declarations (internal_module nodes) in the TypeScript parser.
This allows the parser to identify and extract namespace declarations from TypeScript code.

- Added test case to verify namespace parsing functionality
- Added query pattern to capture namespace declarations in typescript.ts

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add decorator pattern support to tree-sitter TypeScript parser

- Added support for parsing complex decorators with arguments
- Added test case for Component decorator pattern
- Enhanced TypeScript queries to capture decorator definitions

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add generic type declaration support to tree-sitter TypeScript parser

- Added support for parsing generic types with constraints
- Added test case for Dictionary<K extends string | number, V> pattern
- Enhanced TypeScript queries to capture generic type definitions

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: add conditional type support to tree-sitter TypeScript parser

- Added test case for conditional type patterns like ReturnType<T>
- Verified that conditional types with infer keyword are already supported
- Enhanced inspectTreeStructure with detailed node inspection for debugging

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: add template literal type support to tree-sitter TypeScript parser

- Added test case for template literal type patterns like EventName<T>
- Verified that template literal types are already partially supported
- Confirmed support for complex template literal patterns in conditional types

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: implement tree-sitter compatible markdown processor

Adds a special case implementation for markdown files that:
- Parses markdown headers and section line ranges
- Returns captures in a format compatible with tree-sitter
- Integrates with the existing parseFile function
- Includes comprehensive tests for the implementation

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* fix: markdown parser not detecting sections with horizontal rules

The markdownParser was incorrectly interpreting horizontal rules (---) as setext headers when they appeared after non-header text. This caused some sections to be missed in the output.

This fix:
- Makes setext header detection more strict by requiring at least 3 = or - characters
- Adds validation for the text line before a potential setext header
- Ensures horizontal rules are not confused with setext headers

Added a test case to verify the fix works correctly with horizontal rules.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: move helper functions to dedicated file

Move test helper functions from parseSourceCodeDefinitions.test.ts to a new helpers.ts file.
Rename test file to parseSourceCodeDefinitions.tsx.test.ts to indicate it's for TSX tests.
This improves code organization by separating test helpers from test cases.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: enable JSON structure display in list_code_definitions

This change allows list_code_definitions to show JSON structures by:
- Moving JSON query patterns into the JavaScript query file
- Using the JavaScript parser for JSON files
- Removing the separate JSON parser implementation
- Adding comprehensive tests for JSON parsing

Example output for a JSON file:
# test.json
0--90 | {
1--9 |   "server": {
4--8 |     "ssl": {
10--45 |   "database": {
11--24 |     "primary": {
14--18 |       "credentials": {
19--23 |       "pool": {
25--44 |     "replicas": [
26--43 |       {
30--42 |         "status": {
33--41 |           "metrics": {
36--40 |             "connections": {
46--73 |   "features": {
47--72 |     "auth": {
48--71 |       "providers": {
49--53 |         "local": {
54--70 |         "oauth": {
56--69 |           "providers": [
57--68 |             {

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* fix: Add compile step to CI workflow to ensure WASM files are available

The TreeSitter tests were failing in CI because the WASM files weren't being copied to the dist directory before running the tests. This adds an explicit compile step to ensure the WASM files are properly built and copied.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* fix: improve tree-sitter test type safety and debug logging

- Replace 'any' types with proper Parser types in helpers.ts
- Add centralized DEBUG flag and debugLog function in helpers.ts
- Update all console.log statements to use debugLog across all test files
- This change appeases @ellipsis-dev by improving type safety and
  providing a clean way to control debug logging

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

---------

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
2025-03-31 23:34:06 -05:00
Steven T. Cramer
b9f4695d12
Fix Tests to run properly on Windows (#1963)
* fix: remove -p flag from test script to prevent git operation errors

The -p flag in npm-run-all was causing tests to run in parallel, which led to 'Cannot log after tests are done' errors with git operations. These errors don't appear when running test:extension alone.

The issue occurs because git-based tests create temporary directories and run async operations that can interfere with each other when executed in parallel. Running tests sequentially resolves this cleanly.

While it might increase total test time slightly, it ensures more reliable and consistent test results.

* refactor(terminal): improve mock streams and fix test issues

- Create shell-specific mock streams (bash, cmd, pwsh) with proper line ending handling
- Fix open handles in tests by properly managing timeouts
- Standardize stderr redirection across all shell implementations using stdio option
- Improve test reliability and output cleanliness

* fix(tests): add skipVerification option to PowerShell tests to debug Linux issues

* fix(tests): use explicit variable name in PowerShell test to fix Linux compatibility

* Refactor terminal tests to use purpose-based approach instead of command mapping

* Remove reference to non-existent test file

* fix: use printf instead of echo -e for more consistent behavior across platforms

* fix: use single quotes for PowerShell commands to preserve variables on Linux

* Update code-qa workflow to run tests on both Windows and Ubuntu

* fix: use platform-specific PowerShell command execution for Linux and Windows

* Fix toggleToolAlwaysAllow to handle path normalization for cross-platform compatibility

* Fix McpHub tests to handle normalized paths on Windows

* Suppress console.error messages in McpHub tests

* fix: make Bedrock ARN regex patterns Windows-compatible

Fixed an issue where AWS Bedrock tests were timing out on Windows but passing on Linux. The root cause was path separator handling in regex patterns used for model ID extraction from ARNs.

1. Updated model ID extraction regex to handle both forward slashes (Linux) and backslashes (Windows)
2. Modified ARN matching regex to be platform-independent
3. Ensured consistent region prefix handling for all supported regions

This change maintains functionality while ensuring cross-platform compatibility.

* fix: make WorkspaceTracker test cross-platform compatible

Fixed an issue where the WorkspaceTracker test 'should initialize with workspace files' was failing on Windows but passing on Linux. The problem was in the mock implementation of toRelativePath that only handled forward slashes.

- Updated the toRelativePath mock to use path.relative which properly handles platform-specific path separators
- Ensured all paths are converted to forward slashes for consistency in test assertions
- The fix maintains cross-platform compatibility while preserving the test's intent

* fix: make WorkspaceTracker tests cross-platform compatible

Fixed cross-platform compatibility issues in the WorkspaceTracker tests that were causing failures on Windows but passing on Linux:

1. Updated the toRelativePath mock implementation to:
   - Use path.relative which properly handles platform-specific path separators
   - Convert paths to forward slashes for consistency in test assertions

2. Enhanced the 'should not update file paths' test to be platform-agnostic by:
   - Using more flexible assertions that don't depend on specific path formats
   - Checking file path length and content rather than exact string matches
   - Properly typed the test assertions to fix TypeScript errors

These changes preserve the test intent while ensuring they run successfully across different operating systems.

* fix: make McpHub tests cross-platform compatible

Fixed cross-platform compatibility issues in the McpHub tests that were causing failures on Windows but passing on Linux:

1. Made the toggleToolAlwaysAllow tests more platform-agnostic by:
   - No longer relying on specific path formats which differ between Windows and Linux
   - Using the last write call instead of searching for a specific path string
   - Adding more robust assertions that verify structure instead of exact path matches
   - Properly handling array existence checks

2. These tests would fail on Windows because paths are formatted with backslashes instead of
   forward slashes, causing path equality checks to fail.

The changes maintain test intent while ensuring cross-platform compatibility.

* handle escaping of slash and quote

* fix: ensure consistent line endings in git fallback strategy

Fixed an issue where tests would fail on GitHub Windows runners but pass on local Windows machines due to line ending differences. The fix ensures consistent line ending handling by:

1. Normalizing CRLF to LF when reading files in the git fallback strategy
2. Disabling Git's automatic line ending conversion
3. Maintaining consistent line ending usage throughout text operations

* feat: run tests sequentially on Windows, parallel otherwise
2025-03-31 23:17:56 -05:00
Wojciech Kordalski
5d993845b7
We should post state to webview at the end of RooCodeAPI.clearCurrentTask() (#1874)
We should post state to webview at the end of RooCodeAPI.clearCurrentTask
2025-03-31 22:53:55 -05:00
Matt Rubens
b0b4240c8b
Revert "feat @-mention window path style & file with space (#1924)" (#2162)
* Revert "feat @-mention window path style & file with space (#1924)"

This reverts commit c62e8f2ee2.

* Add changeset
2025-03-31 15:56:47 -05:00
Matt Rubens
fe3e9325a5
Include inference-profile in Bedrock arnRegex (#2156) 2025-03-31 13:52:57 -04:00
Matt Rubens
136cf99885
Add requesty to connect-src (#2155) 2025-03-31 13:51:21 -04:00
Chris Estreich
a6ed5ce0ea
Update the webview when changing settings via the API (#2143)
* Update the webview when changing settings via the API

* Update src/exports/api.ts

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-03-31 13:40:27 -04:00
Diarmid Mackenzie
73fe581868
Split webviewMessageHandler out of ClineProvider.ts (#2149) 2025-03-31 09:47:28 -04:00
Chris Estreich
3322e08cb7
Relax provider profiles schema and log parse error to PostHog (#2139)
* Relax provider profiles schema and log parse error to PostHog

* Create wise-moose-shop.md

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
2025-03-30 23:07:34 -07:00