Merge main into feature/TTS and resolve conflicts

This commit is contained in:
Chris Scott committed 2025-12-15 14:50:04 -05:00
commit 67cb729ca7
19 files changed
+963 -524

No files matched your search

+31 -1
View File
@@ -115,6 +115,15 @@ export async function switchRepoConfig(id: number, configName: string): Promise<
return response.json()
}
export class GitAuthError extends Error {
code: string
constructor(message: string, code: string) {
super(message)
this.name = 'GitAuthError'
this.code = code
}
}
export async function switchBranch(id: number, branch: string): Promise<Repo> {
const response = await fetch(`${API_BASE_URL}/api/repos/${id}/branch/switch`, {
method: 'POST',
@@ -124,13 +133,16 @@ export async function switchBranch(id: number, branch: string): Promise<Repo> {
if (!response.ok) {
const error = await response.json()
if (error.code === 'AUTH_FAILED') {
throw new GitAuthError(error.error || 'Git authentication failed', error.code)
}
throw new Error(error.error || 'Failed to switch branch')
}
return response.json()
}
export async function listBranches(id: number): Promise<{ local: string[], remote: string[], current: string | null }> {
export async function listBranches(id: number): Promise<{ local: string[], all: string[], current: string | null }> {
const response = await fetch(`${API_BASE_URL}/api/repos/${id}/branches`)
if (!response.ok) {
@@ -140,6 +152,24 @@ export async function listBranches(id: number): Promise<{ local: string[], remot
return response.json()
}
export async function createBranch(id: number, branch: string): Promise<Repo> {
const response = await fetch(`${API_BASE_URL}/api/repos/${id}/branch/create`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ branch }),
})
if (!response.ok) {
const error = await response.json()
if (error.code === 'AUTH_FAILED') {
throw new GitAuthError(error.error || 'Git authentication failed', error.code)
}
throw new Error(error.error || 'Failed to create branch')
}
return response.json()
}
export async function downloadRepo(id: number, repoName: string): Promise<void> {
const response = await fetch(`${API_BASE_URL}/api/repos/${id}/download`)