fix: merge worktree handler now uses correct branch name and path

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>
This commit is contained in:
Shirone
2026-01-14 20:49:17 +01:00
parent ca3286a374
commit ee0d0c6c59
10 changed files with 335 additions and 22 deletions

View File

@@ -1706,8 +1706,12 @@ export class HttpApiClient implements ElectronAPI {
// Worktree API
worktree: WorktreeAPI = {
mergeFeature: (projectPath: string, featureId: string, options?: object) =>
this.post('/api/worktree/merge', { projectPath, featureId, options }),
mergeFeature: (
projectPath: string,
branchName: string,
worktreePath: string,
options?: object
) => this.post('/api/worktree/merge', { projectPath, branchName, worktreePath, options }),
getInfo: (projectPath: string, featureId: string) =>
this.post('/api/worktree/info', { projectPath, featureId }),
getStatus: (projectPath: string, featureId: string) =>