mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
* feat(ocm-move): plan worktree mirror targets and stream move progress - Plan/ensure mirror targets per branch via new internal endpoints, creating a worktree repo when the target branch is not checked out in the source repo - Skip branches checked out in other worktrees during bundle import and reset/clean before checkout on both server and CLI - Rewrite workspace paths in message.updated events when replaying moved sessions - Stream live move progress (bundle, upload, import, patch, replay) in the TUI - Prefer branch-matched repos when moving sessions and share push-divergence descriptions * chore(ocm-cli): bump version to 0.2.7 * fix(ocm): harden worktree mirror synchronization * fix(ocm): protect active branch during branchless pull
33 lines
937 B
TypeScript
33 lines
937 B
TypeScript
import type { RemoteRepoSummary } from './mirror.js'
|
|
|
|
export interface ManagerRepo {
|
|
repoId: number
|
|
name: string
|
|
branch: string | null
|
|
cloneStatus: string
|
|
directory: string
|
|
projectId?: string | null
|
|
isWorktree?: boolean
|
|
extra: { repoId: number; localPath: string; fullPath: string }
|
|
}
|
|
|
|
export async function fetchRepos(managerUrl: string, token: string): Promise<ManagerRepo[]> {
|
|
const res = await fetch(`${managerUrl}/api/internal/opencode-workspaces`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
})
|
|
if (!res.ok) {
|
|
throw new Error(`manager responded ${res.status} ${res.statusText}`)
|
|
}
|
|
const data = (await res.json()) as { workspaces: ManagerRepo[] }
|
|
return data.workspaces
|
|
}
|
|
|
|
export function toRemoteRepoSummaries(repos: ManagerRepo[]): RemoteRepoSummary[] {
|
|
return repos.map((r) => ({
|
|
repoId: r.repoId,
|
|
name: r.name,
|
|
projectId: r.projectId ?? null,
|
|
branch: r.branch,
|
|
}))
|
|
}
|