Roo-Code/src/services
roomote[bot] 2b647ed9a1
fix: handle current directory path "." correctly in codebase_search tool (#6517)
* fix: handle current directory path "." correctly in codebase_search tool

- Fix path filtering logic in QdrantVectorStore.search() to properly handle current directory representations
- When directoryPrefix is ".", "./", "", or similar, set filter to undefined to search entire workspace
- Add comprehensive tests covering various current directory path formats including cross-platform support
- Resolves issue where codebase_search with path="." returned no results

Fixes #6514

* fix: normalize directory prefix handling in Qdrant vector store

* fix: normalize paths starting with './' and fix OS-dependency issue

- Use forward slash for splitting after toPosix() conversion
- Remove leading './' from paths like './src' to normalize them to 'src'
- Update test expectations to match correct behavior

* refactor: use path.posix.normalize instead of custom toPosix method

- Replaced directoryPrefix.toPosix() with path.posix.normalize()
- Added proper handling of backslashes before normalization
- Updated test mock to include posix.normalize method
- All tests passing (381 tests in code-index service)

* refactor: address review comments - improve path normalization

- Keep check for './' after normalization as path.posix.normalize('./') returns './'
- Use actual Node.js path.posix implementation in tests instead of custom mock
- Apply path.posix.normalize to cleanedPrefix for consistency

All 381 code-index tests pass

* fix: apply path.posix.normalize when cleaning prefix to avoid redundant normalization

Addresses review comment from @mrubens to normalize the path at line 385 instead of normalizing twice

* fix: correct current directory detection logic

The issue was that the condition checked for an empty string after normalization,
but path.posix.normalize('') actually returns '.', not ''. This caused the
current directory check to fail when an empty string was passed.

Removed the redundant empty string check since normalize('') returns '.' which
is already handled by the first condition.

---------

Co-authored-by: Roo Code <roomote@roocode.com>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
Co-authored-by: hannesrudolph <hrudolph@gmail.com>
2025-08-06 06:28:28 -07:00
..
browser fix: improve handling of net::ERR_ABORTED errors in URL fetching (#6635) 2025-08-05 14:21:58 -07:00
checkpoints Remove 'Initial Checkpoint' terminology, use 'Checkpoint' consistently (#6643) 2025-08-04 00:23:08 -04:00
code-index fix: handle current directory path "." correctly in codebase_search tool (#6517) 2025-08-06 06:28:28 -07:00
command Command argument hints and change release engineer to a command (#6333) 2025-07-29 00:42:28 -04:00
glob # fix: list_files recursive mode now works for dot directories (#5176) 2025-07-26 17:30:56 -05:00
marketplace Miscellaneous cleanup (#6453) 2025-07-30 16:10:53 -07:00
mcp fix: prevent disabled MCP servers from starting processes and show correct status (#6084) 2025-08-05 16:55:30 -07:00
mdm Sharing improvements (#5082) 2025-06-24 16:36:32 -04:00
ripgrep Farewell jest (#4607) 2025-06-16 21:39:45 -07:00
roo-config feat: add support for loading rules from global and project-local .roo directories (#5016) 2025-06-24 11:40:45 -04:00
search Await checkpoint saves (except the initial) (#2665) 2025-04-15 16:57:12 -07:00
tree-sitter fix: Fix VB.NET indexing by implementing fallback chunking system (#6552) 2025-08-01 14:55:45 -04:00