[PR #319] [CLOSED] Fix Cursor multi-root workspace detection - aka multiple repos in same workspace #406

Closed
opened 2026-03-02 04:13:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/git-ai-project/git-ai/pull/319
Author: @edan-binshtok-dv
Created: 1/5/2026
Status: Closed

Base: mainHead: fix/cursor-multi-root-workspace


📝 Commits (1)

  • cd1dbcc Fix Cursor multi-root workspace detection

📊 Changes

2 files changed (+134 additions, -52 deletions)

View changed files

📝 src/commands/checkpoint_agent/agent_presets.rs (+35 -14)
📝 tests/cursor.rs (+99 -38)

📄 Description

Previously, git-ai always used the first workspace root when processing Cursor's multi-root workspace feature, causing attribution failures for files in non-primary workspaces.

This commit implements intelligent workspace selection that:

  • Matches file paths to the correct workspace root
  • Handles trailing slashes in workspace paths
  • Validates path separators (Unix / and Windows )
  • Prevents ambiguous prefix matching (e.g., workspace1 vs workspace10)
  • Falls back gracefully to first workspace if no match found

Added comprehensive test coverage with 7 edge case scenarios:

  • File in non-first workspace
  • File path doesn't match any workspace (fallback)
  • No file path provided
  • Workspace roots with trailing slashes
  • Ambiguous prefix scenarios
  • Path separator edge cases
  • Immediate file after workspace root

All tests passing (10/10 cursor tests). No regressions.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/git-ai-project/git-ai/pull/319 **Author:** [@edan-binshtok-dv](https://github.com/edan-binshtok-dv) **Created:** 1/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/cursor-multi-root-workspace` --- ### 📝 Commits (1) - [`cd1dbcc`](https://github.com/git-ai-project/git-ai/commit/cd1dbcc00c4f1fc4449e5975ea7c3d5924dad70b) Fix Cursor multi-root workspace detection ### 📊 Changes **2 files changed** (+134 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `src/commands/checkpoint_agent/agent_presets.rs` (+35 -14) 📝 `tests/cursor.rs` (+99 -38) </details> ### 📄 Description Previously, git-ai always used the first workspace root when processing Cursor's multi-root workspace feature, causing attribution failures for files in non-primary workspaces. This commit implements intelligent workspace selection that: - Matches file paths to the correct workspace root - Handles trailing slashes in workspace paths - Validates path separators (Unix / and Windows \) - Prevents ambiguous prefix matching (e.g., workspace1 vs workspace10) - Falls back gracefully to first workspace if no match found Added comprehensive test coverage with 7 edge case scenarios: - File in non-first workspace - File path doesn't match any workspace (fallback) - No file path provided - Workspace roots with trailing slashes - Ambiguous prefix scenarios - Path separator edge cases - Immediate file after workspace root All tests passing (10/10 cursor tests). No regressions. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 04:13:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#406
No description provided.