Skip to content

Conversation

@Shironex
Copy link
Collaborator

@Shironex Shironex commented Jan 13, 2026

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

  • mass-edit-dialog.tsx: Added WorkModeSelector component with three modes:
    • Current Branch: Work on current branch (no worktree isolation)
    • Auto Worktree: Auto-generate branch name and create worktree
    • Custom Branch: Specify branch name and create worktree
  • board-view.tsx: Updated handleBulkUpdate to:
    • Accept workMode parameter
    • Create worktrees for 'auto' and 'custom' modes
    • Auto-select created worktrees in board header
    • Generate unique branch names for 'auto' mode
    • Handle errors gracefully

Use Case

When setting up a new project with many features, users can now:

  1. Select multiple features in backlog
  2. Open mass edit dialog
  3. Choose a work mode (auto or custom branch)
  4. Bulk-assign all features to a branch
  5. Worktree is automatically created and selected

Testing

  • 'Auto Worktree' mode creates unique branch and worktree
  • 'Custom Branch' mode uses specified branch name
  • 'Current Branch' mode works without creating worktree
  • Worktree auto-selection works correctly
  • Board header updates to show new worktree

Closes #459

Summary by CodeRabbit

  • New Features
    • Added branch mode selection for bulk and mass edits with three options: current branch, auto-generate feature branch, or specify custom branch
    • Integrated worktree creation with bulk update operations
    • Enhanced mass editing dialog with branch configuration capabilities

✏️ Tip: You can customize this high-level summary in your review settings.

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>
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Board View Core
apps/ui/src/components/views/board-view.tsx
Extended handleBulkUpdate with workMode parameter ('current'/'auto'/'custom') to determine branch handling behavior. Added worktree creation logic when in 'auto' or 'custom' modes. Updated dependency array with worktree-related state. Passes new branch-context props (branchSuggestions, branchCardCounts, currentBranch) to MassEditDialog and additional props (selectedNonMainWorktreeBranch, forceCurrentBranchMode) to AddFeatureDialog.
Mass Edit Dialog
apps/ui/src/components/views/board-view/dialogs/mass-edit-dialog.tsx
Added branch name field support with new public props (branchSuggestions, branchCardCounts, currentBranch). Introduced workMode internal state and WorkModeSelector UI integration. Updated onApply callback signature to include workMode parameter. Extended mixed-values tracking to include branchName. Applies branchName updates conditionally based on workMode.

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
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly Related PRs

  • feat: enhance UI components and branch management #161: Modifies board-view dialogs and branch/worktree handling in MassEditDialog and AddFeatureDialog with overlapping branch-aware props and state management patterns.
  • worktree-select #182: Adds worktree auto-select callback invoked during worktree creation, directly relating to the new worktree creation flow introduced in this PR's bulk update handler.
  • feat: worktrees init script #409: Extends BoardView and its dialog components with worktree and branch handling, sharing similar branch context propagation patterns.

Poem

🐰 Whiskers twitching with delight,
Branch names now flow through bulk edits bright,
Worktrees sprout and modes align,
Mass updates dance in perfect line!

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding branch/worktree support to the mass edit dialog, which is the primary objective of this pull request.
Linked Issues check ✅ Passed The pull request fully implements the requirements from issue #459: adds branch name selector to Mass Edit dialog, enables bulk assignment of features to branches, and provides worktree creation with mode options (Current/Auto/Custom) matching other feature dialogs.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objectives. The modifications to board-view.tsx and mass-edit-dialog.tsx focus exclusively on adding branch/worktree support to mass editing, with no unrelated changes detected.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Enhanced Mass Edit Dialog: The Mass Edit dialog now supports branch and worktree management, aligning its functionality with the Add Feature and Edit Feature dialogs.
  • Work Mode Selection: A new WorkModeSelector component is integrated, offering three modes for feature assignment: "Current Branch" (no worktree), "Auto Worktree" (auto-generated branch name and worktree), and "Custom Branch" (user-defined branch name and worktree).
  • Worktree Creation & Management: The handleBulkUpdate function in board-view.tsx has been extended to dynamically create Git worktrees for 'auto' and 'custom' modes, automatically generate unique branch names when required, and ensure the newly created worktree is selected and reflected in the UI.
  • UI Integration: The MassEditDialog component now accepts additional props (branchSuggestions, branchCardCounts, currentBranch) to provide a richer user experience for branch selection and display.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Shironex
Copy link
Collaborator Author

@coderabbitai review it

@Shironex Shironex self-assigned this Jan 13, 2026
@Shironex Shironex added Enhancement Improvements to existing functionality or UI. Do Not Merge Use this label if something should not be merged. labels Jan 13, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

@Shironex: I'll review the changes in this PR that add branch/worktree support to the mass edit dialog.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a 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 using getPrimaryWorktreeBranch for consistency in auto-branch generation.

Line 510 uses currentWorktreeBranch || 'main' as the base branch, but elsewhere in this file (e.g., lines 1056-1058), getPrimaryWorktreeBranch is 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 getPrimaryWorktreeBranch to 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 onWorktreeAutoSelect callback (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 onWorktreeAutoSelect and handleBulkUpdate.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff5915d and 3bd8626.

📒 Files selected for processing (2)
  • apps/ui/src/components/views/board-view.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/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 workMode from the first selected feature's branchName, defaulting to 'custom' if a branch exists or 'current' otherwise.

Minor: The as string cast on line 145 is redundant since getInitialValue already returns the type of defaultValue (which is string here), but it doesn't cause any issues.


152-174: LGTM! Reset logic correctly handles dialog re-opening.

The useEffect properly resets all field states including the new branchName and workMode when the dialog opens with new features. The workMode is 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 name

The 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 FieldWrapper with appropriate mixed-value detection and apply-state toggling. All required props are passed through to WorkModeSelector.


16-17: All imports are correctly exported from the shared module.

WorkModeSelector and WorkMode are properly exported from apps/ui/src/components/views/board-view/shared/work-mode-selector.tsx via 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:

  1. Spreads the original updates and overrides branchName with finalBranchName
  2. Uses finalUpdates for both the API call and local state updates
  3. 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. The currentWorktreeBranch || undefined conversion correctly handles the null case.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines 535 to 549
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]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Comment on lines +137 to +143
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';
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
updates.branchName = workMode === 'custom' ? branchName : '';
updates.branchName = workMode === 'custom' ? branchName : undefined;

Shironex and others added 2 commits January 13, 2026 18:37
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>
@Shironex Shironex merged commit 2303dcd into v0.11.0rc Jan 13, 2026
6 checks passed
@Shironex Shironex deleted the feat/add-branch-name-to-mass-edit branch January 13, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge Use this label if something should not be merged. Enhancement Improvements to existing functionality or UI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants