feat: default worktree directory to parent of agent's cwd#557
feat: default worktree directory to parent of agent's cwd#557jSydorowicz21 wants to merge 3 commits intoRunMaestro:mainfrom
Conversation
The worktree config modal now pre-fills the base path with the parent directory of the agent's cwd instead of leaving it empty, so creating a new worktree no longer requires manual directory selection.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change updates Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
Greptile SummaryThis PR improves the worktree configuration UX by defaulting the base directory input to the parent of the agent's current working directory, removing the need for users to manually type the most common value. It also extracts a The approach is solid, but the change introduces a logic regression in the
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Modal Opens]) --> B{worktreeConfig basePath set?}
B -- Yes --> C[basePath = saved basePath]
B -- No --> D[basePath = getParentDir of session.cwd]
D --> E{cwd directly under root?}
E -- Yes --> F["getParentDir returns '' - edge case"]
E -- No --> G[basePath = parent dir e.g. /home/user]
C --> H[Evaluate canDisable]
G --> H
F --> H
H --> I{worktreeConfig.basePath OR basePath non-empty?}
I -- "No config + empty basePath" --> J["canDisable = false - Disable button disabled OK"]
I -- "No config + non-empty default" --> K["canDisable = true - BUG: Disable enabled with nothing to disable"]
I -- "Saved config exists" --> L["canDisable = true - Disable button enabled OK"]
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/renderer/components/WorktreeConfigModal.tsx`:
- Around line 18-21: getParentDir currently returns an empty string for paths
like "/repo" and "C:\repo" which causes downstream code that uses this value as
basePath (e.g., where basePath is set/used) to lose or misplace the default;
update getParentDir to preserve filesystem roots and trailing-slash semantics:
if the input path already ends with a slash or backslash, return it unchanged;
otherwise compute the parent but if the computed parent is empty and the
original path starts with '/' return '/' (POSIX root), and if it matches a
Windows drive root like /^[A-Za-z]:[\\/]*$/ return the drive root with a
trailing backslash (e.g., "C:\\" or "C:\") so basePath remains a valid root;
implement these checks inside the getParentDir function referenced above.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fbb7aca9-d5d3-4816-bcc2-126ecacb2846
📒 Files selected for processing (1)
src/renderer/components/WorktreeConfigModal.tsx
- Guard getParentDir against root-level paths returning empty string - Fix canDisable to only enable Disable button when config is persisted - Add session.cwd to useEffect dependency array
|
Addressed feedback, should be good to go |
Summary
Summary by CodeRabbit