feat: add rename branch functionality with UI integration

This commit is contained in:
Bohdan Triapitsyn
2026-01-08 01:13:51 +02:00
parent d6f74087c4
commit 8902662f74
13 changed files with 284 additions and 3 deletions
+17
View File
@@ -404,6 +404,23 @@ export async function createBranch(
return response.json();
}
export async function renameBranch(
directory: string,
oldName: string,
newName: string
): Promise<{ success: boolean; branch: string }> {
const response = await fetch(buildUrl(`${API_BASE}/branches/rename`, directory), {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ oldName, newName }),
});
if (!response.ok) {
const error = await response.json().catch(() => ({ error: response.statusText }));
throw new Error(error.error || 'Failed to rename branch');
}
return response.json();
}
export async function getGitLog(
directory: string,
options: GitLogOptions = {}