feat: merge worktree to main in dropdown menu#492
Conversation
The merge handler previously hardcoded branch names as `feature/${featureId}`
and worktree paths as `.worktrees/${featureId}`, which failed for auto-generated
branches (e.g., `feature/v0.11.0rc-1768413895104-31pa`) and custom worktrees.
Changes:
- Server handler now accepts branchName and worktreePath directly from the UI
- Added branch existence validation before attempting merge
- Updated merge dialog with 2-step confirmation (type "merge" to confirm)
- Removed feature branch naming restriction - any branch can now be merged
- Updated API types and client to pass correct parameters
Closes #408
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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 |
Summary of ChangesHello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the worktree merge functionality by making it more adaptable and secure. It addresses previous constraints related to branch and worktree path derivation, allowing for a wider range of use cases. The introduction of a multi-step confirmation dialog and pre-merge branch validation enhances the user experience by preventing unintended actions and increasing confidence in the merge process. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the merge worktree handler to accept branchName and worktreePath directly, improving flexibility and addressing previous limitations with auto-generated and custom branch names. It also introduces a 2-step confirmation dialog for merge operations and adds branch existence validation. The changes correctly update the API signatures and UI components to reflect the new parameters. However, there are critical security vulnerabilities related to command injection in the server-side merge logic, and a minor maintainability issue with duplicated interface definitions in the UI.
| interface WorktreeInfo { | ||
| path: string; | ||
| branch: string; | ||
| isMain: boolean; | ||
| hasChanges?: boolean; | ||
| changedFilesCount?: number; |
There was a problem hiding this comment.
The WorktreeInfo interface is duplicated here. It is already defined in apps/ui/src/components/views/board-view/worktree-panel/types.ts. To improve maintainability and avoid redundancy, please import and reuse the existing interface definition.
import type { WorktreeInfo } from '../../board-view/worktree-panel/types';
Summary
branchNameandworktreePathdirectly instead of deriving them fromfeatureIdTest plan
feature/main-1234567890-xyz)Closes #408