mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
* loop: ocm-session-move completed after 7 iterations * feat(ocm-cli): add session move with local history export and TUI plugin * docs(ocm-cli): update plugin config to tui-only entry and clarify session history source * fix(ocm-cli): replace raw postinstall output with TUI toast notification
32 lines
914 B
TypeScript
32 lines
914 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
|
|
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,
|
|
}))
|
|
}
|