Skip to content

Conversation

@built-by-as
Copy link
Owner

@built-by-as built-by-as commented Oct 25, 2025

Summary

  • Adds "Apply to project" option in the three-dot menu for worktree sessions
  • Creates a confirmation modal showing branch details before applying changes
  • Generates patch files that capture all commits and unstaged changes from the worktree branch
  • Applies the patch to the original project directory
  • Automatically cleans up temporary patch files after success or failure

Changes

UI Updates (renderer.ts, index.html)

  • Added "Apply to project" menu item (only visible for worktree sessions)
  • Created confirmation modal with branch name and parent branch display
  • Shows warning that commits and unstaged changes will be included
  • Handles button state (disabled/loading) during operation

Backend (main.ts)

  • Added apply-session-to-project IPC handler
  • Uses git diff <parent-branch> to capture all changes since branch diverged
  • Writes patch to /tmp/fleetcode-patch-<timestamp>.patch
  • Applies patch using git apply
  • Deletes patch file on success or error
  • Returns detailed error messages if patch fails to apply

Additional Improvements

  • Shows last directory name in parentheses before full path in project directory input

Test plan

  • Build completes successfully
  • Create a worktree session
  • Make some changes (commits + unstaged files)
  • Click "Apply to project" from the three-dot menu
  • Verify confirmation dialog shows correct branch info
  • Confirm and verify changes are applied to original project directory
  • Verify patch file is cleaned up from /tmp

@built-by-as built-by-as merged commit c7f5956 into main Oct 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants