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

@@ -1440,13 +1440,19 @@ function createMockSetupAPI(): SetupAPI {
// Mock Worktree API implementation
function createMockWorktreeAPI(): WorktreeAPI {
return {
mergeFeature: async (projectPath: string, featureId: string, options?: object) => {
mergeFeature: async (
projectPath: string,
branchName: string,
worktreePath: string,
options?: object
) => {
console.log('[Mock] Merging feature:', {
projectPath,
featureId,
branchName,
worktreePath,
options,
});
return { success: true, mergedBranch: `feature/${featureId}` };
return { success: true, mergedBranch: branchName };
},
getInfo: async (projectPath: string, featureId: string) => {