-
Notifications
You must be signed in to change notification settings - Fork 488
feat: add branch/worktree support to mass edit dialog #468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implement worktree creation and branch assignment in the mass edit dialog to match the functionality of the add-feature and edit-feature dialogs. Changes: - Add WorkModeSelector to mass-edit-dialog.tsx with three modes: - 'Current Branch': Work on current branch (no worktree) - 'Auto Worktree': Auto-generate branch name and create worktree - 'Custom Branch': Use specified branch name and create worktree - Update handleBulkUpdate in board-view.tsx to: - Accept workMode parameter - Create worktrees for 'auto' and 'custom' modes - Auto-select created worktrees in the board header - Handle branch name generation for 'auto' mode - Add necessary props to MassEditDialog (branchSuggestions, branchCardCounts, currentBranch) Users can now bulk-assign features to a branch and automatically create/select worktrees, enabling efficient project setup with many features. Fixes #459 Co-Authored-By: Claude Sonnet 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 📝 WalkthroughWalkthroughThis PR adds branch name support to the Mass Edit dialog and extends the bulk update handler to support three work modes ('current', 'auto', 'custom'), enabling mass editing of features across different branches with automatic worktree creation when needed. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant BoardView
participant MassEditDialog
participant WorktreeAPI
participant FeatureAPI
User->>BoardView: Select multiple features
User->>BoardView: Click Edit (bulk mode)
BoardView->>MassEditDialog: Open with branch suggestions
User->>MassEditDialog: Select branch & work mode
User->>MassEditDialog: Click Apply
MassEditDialog->>BoardView: onApply(updates, workMode)
alt workMode is 'auto' or 'custom'
BoardView->>WorktreeAPI: Create & select worktree
WorktreeAPI-->>BoardView: Worktree created/selected
BoardView->>BoardView: Refresh worktrees UI
end
alt Worktree creation succeeds OR workMode is 'current'
BoardView->>FeatureAPI: Bulk update features with finalBranchName
FeatureAPI-->>BoardView: Features updated
BoardView-->>User: Changes applied
else Worktree creation fails
BoardView-->>User: Error toast, bulk update aborted
end
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 upgrades the Mass Edit dialog by introducing robust branch and Git worktree support. Users can now select multiple features and, in a single operation, assign them to a new automatically generated branch with an associated worktree, assign them to a custom-named branch with a worktree, or simply update them on the current branch. This enhancement streamlines the process of organizing and developing features in isolated environments, improving developer workflow and project management. 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
|
|
@coderabbitai review it |
|
@Shironex: I'll review the changes in this PR that add branch/worktree support to the mass edit dialog. ✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/ui/src/components/views/board-view.tsx (2)
494-517: Consider usinggetPrimaryWorktreeBranchfor consistency in auto-branch generation.Line 510 uses
currentWorktreeBranch || 'main'as the base branch, but elsewhere in this file (e.g., lines 1056-1058),getPrimaryWorktreeBranchis used to get the actual primary branch name. If the repository's primary branch is not'main'(e.g.,'master'), this could result in inconsistent branch naming.Suggested improvement
} else if (workMode === 'auto') { // Auto-generate a branch name based on current branch and timestamp - const baseBranch = currentWorktreeBranch || 'main'; + const baseBranch = currentWorktreeBranch || getPrimaryWorktreeBranch(currentProject.path) || 'main'; const timestamp = Date.now(); const randomSuffix = Math.random().toString(36).substring(2, 6); finalBranchName = `feature/${baseBranch}-${timestamp}-${randomSuffix}`;This would also require adding
getPrimaryWorktreeBranchto the dependency array on line 611.
519-577: Duplicated worktree auto-selection logic could be extracted to a helper.The worktree creation and auto-selection logic (lines 534-556) is nearly identical to the
onWorktreeAutoSelectcallback (lines 470-489). Consider extracting this into a shared helper function to reduce duplication and ensure consistent behavior.Potential refactor
// Helper function to add and select a worktree const addAndSelectWorktree = useCallback( (worktreeResult: { path: string; branch: string }) => { if (!currentProject) return; const currentWorktrees = getWorktrees(currentProject.path); const existingWorktree = currentWorktrees.find( (w) => w.branch === worktreeResult.branch ); if (!existingWorktree) { const newWorktreeInfo = { path: worktreeResult.path, branch: worktreeResult.branch, isMain: false, isCurrent: false, hasWorktree: true, }; setWorktrees(currentProject.path, [...currentWorktrees, newWorktreeInfo]); } setCurrentWorktree(currentProject.path, worktreeResult.path, worktreeResult.branch); }, [currentProject, getWorktrees, setWorktrees, setCurrentWorktree] );This helper could then be used in both
onWorktreeAutoSelectandhandleBulkUpdate.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/ui/src/components/views/board-view.tsxapps/ui/src/components/views/board-view/dialogs/mass-edit-dialog.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Always import from shared packages (@automaker/*), never from old relative paths
Files:
apps/ui/src/components/views/board-view/dialogs/mass-edit-dialog.tsxapps/ui/src/components/views/board-view.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use
resolveModelString()from @automaker/model-resolver to convert model aliases (haiku, sonnet, opus) to full model names
Files:
apps/ui/src/components/views/board-view/dialogs/mass-edit-dialog.tsxapps/ui/src/components/views/board-view.tsx
🧠 Learnings (1)
📚 Learning: 2025-12-30T01:02:07.114Z
Learnt from: illia1f
Repo: AutoMaker-Org/automaker PR: 324
File: apps/ui/src/components/views/board-view/components/kanban-card/kanban-card.tsx:122-131
Timestamp: 2025-12-30T01:02:07.114Z
Learning: Tailwind CSS v4 uses postfix syntax for the important modifier: append ! at the end of the utility class (e.g., backdrop-blur-[0px]! or hover:bg-red-500!). The older v3 style used a prefix (!) at the start (e.g., !backdrop-blur-[0px]); prefer the postfix form for consistency across TSX files.
Applied to files:
apps/ui/src/components/views/board-view/dialogs/mass-edit-dialog.tsxapps/ui/src/components/views/board-view.tsx
🔇 Additional comments (8)
apps/ui/src/components/views/board-view/dialogs/mass-edit-dialog.tsx (5)
136-146: LGTM! Good initialization of work mode and branch name state.The lazy initialization correctly derives the initial
workModefrom the first selected feature'sbranchName, defaulting to'custom'if a branch exists or'current'otherwise.Minor: The
as stringcast on line 145 is redundant sincegetInitialValuealready returns the type ofdefaultValue(which isstringhere), but it doesn't cause any issues.
152-174: LGTM! Reset logic correctly handles dialog re-opening.The
useEffectproperly resets all field states including the newbranchNameandworkModewhen the dialog opens with new features. TheworkModeis correctly derived from whether the initial branch name exists.
185-190: LGTM! Branch name handling based on work mode is well-documented.The logic correctly applies:
'current'/'auto'modes → empty string (board-view will handle auto-generation for 'auto')'custom'mode → the user-specified branch nameThe comments clearly explain the intent for each mode.
336-352: LGTM! WorkModeSelector integration looks correct.The new Branch / Work Mode field is properly wrapped in
FieldWrapperwith appropriate mixed-value detection and apply-state toggling. All required props are passed through toWorkModeSelector.
16-17: All imports are correctly exported from the shared module.
WorkModeSelectorandWorkModeare properly exported fromapps/ui/src/components/views/board-view/shared/work-mode-selector.tsxvia the shared module's index.ts. The imports on lines 16-17 are valid and all referenced exports exist.apps/ui/src/components/views/board-view.tsx (3)
579-593: LGTM! The finalUpdates construction and API call look correct.The code properly:
- Spreads the original updates and overrides
branchNamewithfinalBranchName- Uses
finalUpdatesfor both the API call and local state updates- Shows appropriate success/error toasts
606-616: LGTM! Dependency array is comprehensive.All dependencies used within the callback are properly included, ensuring the callback is recreated when any of these values change.
1419-1427: LGTM! MassEditDialog props are correctly passed.The new branch-related props (
branchSuggestions,branchCardCounts,currentBranch) are properly passed to enable branch-aware mass editing. ThecurrentWorktreeBranch || undefinedconversion correctly handles the null case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request successfully integrates branch and worktree management into the Mass Edit dialog, aligning its functionality with the Add Feature and Edit Feature dialogs. The implementation correctly handles different work modes ('current', 'auto', 'custom') for branch assignment and worktree creation. Error handling for worktree operations is present, and the UI updates are triggered appropriately. There are a few minor areas for consistency and clarity in state management and dependency arrays that could be improved.
| const currentWorktrees = getWorktrees(currentProject.path); | ||
| const existingWorktree = currentWorktrees.find( | ||
| (w) => w.branch === result.worktree.branch | ||
| ); | ||
|
|
||
| // Only add if it doesn't already exist (to avoid duplicates) | ||
| if (!existingWorktree) { | ||
| const newWorktreeInfo = { | ||
| path: result.worktree.path, | ||
| branch: result.worktree.branch, | ||
| isMain: false, | ||
| isCurrent: false, | ||
| hasWorktree: true, | ||
| }; | ||
| setWorktrees(currentProject.path, [...currentWorktrees, newWorktreeInfo]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for creating newWorktreeInfo and adding it to the store (setWorktrees) is duplicated here and in the onWorktreeAutoSelect callback within useBoardActions. Consider extracting this into a shared utility function or centralizing worktree state updates to avoid redundancy and improve maintainability.
| const [workMode, setWorkMode] = useState<WorkMode>(() => { | ||
| // Derive initial work mode from first selected feature's branchName | ||
| if (selectedFeatures.length > 0 && selectedFeatures[0].branchName) { | ||
| return 'custom'; | ||
| } | ||
| return 'current'; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial workMode derivation only considers the branchName of the first selected feature. If selectedFeatures contains features with mixed branch assignments (e.g., some with a branch, some without, or different branches), mixedValues.branchName will correctly be true, but the workMode will only reflect the first feature. This could lead to a slightly confusing initial UI state. Consider a more comprehensive initialization that accounts for truly mixed branch states, perhaps defaulting to 'current' if mixedValues.branchName is true.
| // For 'current' mode, use empty string (work on current branch) | ||
| // For 'auto' mode, use empty string (will be auto-generated) | ||
| // For 'custom' mode, use the specified branch name | ||
| updates.branchName = workMode === 'custom' ? branchName : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, updates.branchName is set to an empty string ('') for 'current' and 'auto' modes. However, in board-view.tsx (line 507), finalBranchName is explicitly set to undefined for 'current' mode. For consistency, it would be better to use undefined here as well if the intent is to signify "no specific branch assigned" or "auto-generated branch". This avoids potential subtle differences in how '' and undefined are handled downstream.
| updates.branchName = workMode === 'custom' ? branchName : ''; | |
| updates.branchName = workMode === 'custom' ? branchName : undefined; |
Improvements based on CodeRabbit review comments: 1. Use getPrimaryWorktreeBranch for consistent branch detection - Replace hardcoded 'main' fallback with getPrimaryWorktreeBranch() - Ensures auto-generated branch names respect the repo's actual primary branch - Handles repos using 'master' or other primary branch names 2. Extract worktree auto-selection logic to helper function - Create addAndSelectWorktree helper to eliminate code duplication - Use helper in both onWorktreeAutoSelect and handleBulkUpdate - Reduces maintenance burden and ensures consistent behavior These changes improve code consistency and maintainability without affecting functionality. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix Prettier formatting in two files: - apps/server/src/lib/sdk-options.ts: Split long arrays to one item per line - docs/docker-isolation.md: Align markdown table columns Resolves CI format check failures. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary
Adds branch name and worktree creation support to the Mass Edit dialog, matching the functionality of the Add Feature and Edit Feature dialogs.
Changes
WorkModeSelectorcomponent with three modes:handleBulkUpdateto:workModeparameterUse Case
When setting up a new project with many features, users can now:
Testing
Closes #459
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.