You've already forked agentic-coding-workflow
bugfix
This commit is contained in:
@@ -11,10 +11,24 @@ import type {
|
||||
CommitBody,
|
||||
CommitResp,
|
||||
CommitLog,
|
||||
DiffResp,
|
||||
DiffParams,
|
||||
} from './types'
|
||||
|
||||
const enc = (v: string) => encodeURIComponent(v)
|
||||
|
||||
function diffQuery(params?: DiffParams): string {
|
||||
if (!params) return ''
|
||||
const q = new URLSearchParams()
|
||||
if (params.ref) q.set('ref', params.ref)
|
||||
if (params.against) q.set('against', params.against)
|
||||
if (params.staged) q.set('staged', 'true')
|
||||
if (params.paths) q.set('paths', params.paths)
|
||||
if (params.context != null) q.set('context', String(params.context))
|
||||
const s = q.toString()
|
||||
return s ? `?${s}` : ''
|
||||
}
|
||||
|
||||
export const workspacesApi = {
|
||||
// ===== Workspace =====
|
||||
list: (projectSlug: string) =>
|
||||
@@ -27,8 +41,7 @@ export const workspacesApi = {
|
||||
get: (wsID: string) => request<Workspace>(`/api/v1/workspaces/${enc(wsID)}`),
|
||||
update: (wsID: string, body: UpdateWorkspaceBody) =>
|
||||
request<Workspace>(`/api/v1/workspaces/${enc(wsID)}`, { method: 'PATCH', body }),
|
||||
delete: (wsID: string) =>
|
||||
request<void>(`/api/v1/workspaces/${enc(wsID)}`, { method: 'DELETE' }),
|
||||
delete: (wsID: string) => request<void>(`/api/v1/workspaces/${enc(wsID)}`, { method: 'DELETE' }),
|
||||
sync: (wsID: string) =>
|
||||
request<Workspace>(`/api/v1/workspaces/${enc(wsID)}/sync`, { method: 'POST' }),
|
||||
|
||||
@@ -42,8 +55,7 @@ export const workspacesApi = {
|
||||
request<CredentialMeta>(`/api/v1/workspaces/${enc(wsID)}/credential`),
|
||||
|
||||
// ===== Worktree =====
|
||||
listWorktrees: (wsID: string) =>
|
||||
request<Worktree[]>(`/api/v1/workspaces/${enc(wsID)}/worktrees`),
|
||||
listWorktrees: (wsID: string) => request<Worktree[]>(`/api/v1/workspaces/${enc(wsID)}/worktrees`),
|
||||
createWorktree: (wsID: string, body: CreateWorktreeBody) =>
|
||||
request<Worktree>(`/api/v1/workspaces/${enc(wsID)}/worktrees`, { method: 'POST', body }),
|
||||
deleteWorktree: (wtID: string) =>
|
||||
@@ -54,8 +66,9 @@ export const workspacesApi = {
|
||||
request<Worktree>(`/api/v1/worktrees/${enc(wtID)}/release`, { method: 'POST' }),
|
||||
|
||||
listBranches: (wsID: string): Promise<string[]> =>
|
||||
request<{ branches: string[] }>(`/api/v1/workspaces/${enc(wsID)}/branches`)
|
||||
.then(r => r.branches),
|
||||
request<{ branches: string[] }>(`/api/v1/workspaces/${enc(wsID)}/branches`).then(
|
||||
(r) => r.branches,
|
||||
),
|
||||
|
||||
// ===== Git ops =====
|
||||
statusOnMain: (wsID: string) =>
|
||||
@@ -74,4 +87,10 @@ export const workspacesApi = {
|
||||
request<void>(`/api/v1/worktrees/${enc(wtID)}/push`, { method: 'POST' }),
|
||||
logOnWorktree: (wtID: string, n = 50) =>
|
||||
request<CommitLog[]>(`/api/v1/worktrees/${enc(wtID)}/log?n=${n}`),
|
||||
|
||||
// ===== Diff =====
|
||||
diff: (wsID: string, params?: DiffParams) =>
|
||||
request<DiffResp>(`/api/v1/workspaces/${enc(wsID)}/diff${diffQuery(params)}`),
|
||||
diffOnWorktree: (wtID: string, params?: DiffParams) =>
|
||||
request<DiffResp>(`/api/v1/worktrees/${enc(wtID)}/diff${diffQuery(params)}`),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user