feat(files): add "New Agent Here" to the folder right-click menu - #1301
feat(files): add "New Agent Here" to the folder right-click menu#1301pedramamini wants to merge 1 commit into
Conversation
Right-clicking a folder in the Files panel now offers "New Agent Here", which opens the New Agent modal pre-filled with that folder as the working directory (and its basename as a default agent name). Both fields stay editable, so the normal provider/name/group choices are unchanged - this just removes the manual re-typing of the path. Plumbed via a new `presetWorkingDir` on the newInstance modal data, matching how the Left Bar's group menu already opens the same modal with `presetGroupId` instead of threading a callback down from App. Hidden over SSH: the folder path is remote, but a fresh agent starts out local, so seeding it would point the new agent at a local path that does not exist. Closes #1300
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
📝 WalkthroughWalkthroughAdds a “New Agent Here” folder context-menu action that opens the new-instance modal with the selected folder as its working directory, derives the agent name from the folder basename, and preserves duplication behavior. ChangesNew Agent Here
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant FileTreeContextMenu
participant useFileContextMenu
participant NewInstanceModal
User->>FileTreeContextMenu: select New Agent Here on folder
FileTreeContextMenu->>useFileContextMenu: invoke folder action
useFileContextMenu->>NewInstanceModal: open with presetWorkingDir
NewInstanceModal->>NewInstanceModal: seed working directory and agent name
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 SummaryAdds a folder-only “New Agent Here” action that opens the standard New Agent modal with the selected local folder as its editable working directory and basename-derived agent name.
Confidence Score: 5/5The PR appears safe to merge, with no concrete changed-code failure identified. The selected folder path is resolved consistently across POSIX and Windows roots, modal data is replaced and cleared per invocation, and duplication explicitly retains the source session’s working directory. Important Files Changed
Sequence DiagramsequenceDiagram
actor User
participant Menu as Folder Context Menu
participant Store as Modal Store
participant Modal as New Agent Modal
User->>Menu: Select New Agent Here
Menu->>Store: Open with presetWorkingDir
Store->>Modal: Supply working-directory preset
Modal->>Modal: Derive editable agent name from basename
Modal-->>User: Show pre-filled form
Reviews (1): Last reviewed commit: "feat(files): add "New Agent Here" to the..." | Re-trigger Greptile |
Closes #1300
What
Right-clicking a folder in the Files panel (Right Bar) now offers New Agent Here. It opens the standard New Agent modal pre-filled with that folder as the working directory, and the folder's basename as a default agent name.
Both fields stay editable, and provider / group / SSH / nudge choices are unchanged - this only removes the manual re-typing of the path that the issue calls out.
How
Plumbed via a new
presetWorkingDirfield on thenewInstancemodal data, mirroring how the Left Bar's group context menu already opens the same modal withpresetGroupIdrather than threading a callback down fromApp.tsx.modalStore.ts-presetWorkingDironNewInstanceModalData, exposed asnewInstancePresetWorkingDirApp.tsx->AppModals.tsx->AppSessionModals.tsx->NewInstanceModal- threaded alongside the existingpresetGroupIdNewInstanceModal.tsx- seeds working dir + name on open; skipped when duplicating so the source session's cwd still winsuseFileContextMenu.ts-handleNewAgentHere, usingjoinPath()so the separator follows the workspace root (Windows-safe)FileTreeContextMenu.tsx- the menu item, folder rows onlyNotes
Testing
useFileContextMenu(folder path seeding incl. a Windows separator case, no-op on file rows),FileTreeContextMenu(shown for folders, hidden for files/root/SSH),NewInstanceModal(seeds dir + name, stays editable, ignored when duplicating).npm run lintclean, ESLint clean, full suite green: 34,656 passed / 108 skipped.Summary by CodeRabbit
New Features
Bug Fixes