feat(workspace): add rootResolution setting for multi-root workspaces#538
feat(workspace): add rootResolution setting for multi-root workspaces#538simurg79 wants to merge 1 commit into
Conversation
Introduces a new zoo-code.workspace.rootResolution VS Code setting with two strategies: - activeEditor (default): legacy behavior - prefer the workspace folder containing the active editor, fall back to workspaceFolders[0]. - firstFolder: deterministic - always use workspaceFolders[0], independent of the focused file. Updates getWorkspacePath() and getWorkspacePathForContext() in src/utils/path.ts to honor the setting, registers it in src/package.json with localized strings in src/package.nls.json, expands src/utils/__tests__/path.spec.ts with focused unit tests for both strategies, and adds a design doc at docs/design/workspace-root-resolution.md. Ported from simurg79/Roo-Code commit d89c1ff (settings namespace adapted roo-cline -> zoo-code).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces a ChangesWorkspace Root Resolution Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Ports the workspace root resolution feature from
simurg79/Roo-Code(commitd89c1ff) into Zoo-Code.Introduces a new
zoo-code.workspace.rootResolutionVS Code setting that controls how Zoo resolves the "project root" in a multi-root workspace (used to locate.roomodes,.roo/mcp.json,.roo/rules/, and other project-scoped configuration):activeEditor(default)workspaceFolders[0]. Preserves legacy behavior.firstFolderworkspaceFolders[0]. Deterministic — independent of which file is focused.The default preserves today's behavior exactly, so this is a non-breaking, opt-in change.
Motivation
The historic active-editor heuristic is convenient but non-deterministic: switching the focused file between roots silently changes which project config is picked up, and it can disagree with the marketplace installers (which always target
workspaceFolders[0]).firstFoldergives a stable root for CI/automation and multi-root setups where only one folder is the real project.Changes
src/utils/path.ts: addWorkspaceRootResolutiontype + exception-safegetRootResolutionStrategy()helper;getWorkspacePath()andgetWorkspacePathForContext()now honor the setting.src/package.json: registerzoo-code.workspace.rootResolution.src/package.nls.json: localized setting strings.src/utils/__tests__/path.spec.ts: expanded coverage for both strategies, exception safety, andgetWorkspacePathForContext.docs/design/workspace-root-resolution.md: design doc.Port notes
roo-cline.*to Zoo-Code'szoo-code.*.vscodemock viaresolve.alias(mutation-based) to match Zoo-Code'ssrc/vitest.config.ts.Testing
cd src && npx vitest run utils/__tests__/path.spec.ts→ 30 passed. Both modified JSON files validated as parseable. Pre-commit lint hooks passed.Summary by CodeRabbit
New Features
zoo-code.workspace.rootResolutionsetting to control how workspace root is detected:activeEditor(default, legacy behavior) orfirstFolder(deterministic mode for multi-root workspaces).Documentation