feat(ocm-move): plan worktree mirror targets and stream move progress (#345)

* 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
This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-01 22:14:48 -04:00
1 parent 4ed3460759
commit 68d586f183
23 files changed
+2026 -158

No files matched your search

@@ -126,15 +126,16 @@ describe('internal-opencode-workspaces routes', () => {
it('GET /api/internal/opencode-workspaces returns workspace structure', async () => {
mockListRepos.mockReturnValue([
makeRepo({ id: 1, localPath: 'test-repo', cloneStatus: 'ready' }),
makeRepo({ id: 2, localPath: 'worktree-repo', cloneStatus: 'ready', isWorktree: true }),
])
const res = await app.request('/api/internal/opencode-workspaces', {
headers: { authorization: `Bearer ${token}` },
})
expect(res.status).toBe(200)
const body = await res.json() as { workspaces: Array<{ repoId: number; name: string; branch: string | null; cloneStatus: string; directory: string; extra: { repoId: number; localPath: string; fullPath: string } }> }
expect(body.workspaces.length).toBe(1)
const workspace = body.workspaces[0]!
const body = await res.json() as { workspaces: Array<{ repoId: number; name: string; branch: string | null; cloneStatus: string; directory: string; isWorktree: boolean; extra: { repoId: number; localPath: string; fullPath: string } }> }
expect(body.workspaces.length).toBe(2)
const workspace = body.workspaces.find((w) => w.repoId === 1)!
expect(workspace).toHaveProperty('repoId')
expect(workspace).toHaveProperty('name')
expect(workspace).toHaveProperty('branch')
@@ -145,5 +146,8 @@ describe('internal-opencode-workspaces routes', () => {
expect(workspace.extra).toHaveProperty('repoId')
expect(workspace.extra).toHaveProperty('localPath')
expect(workspace.extra).toHaveProperty('fullPath')
const worktreeWorkspace = body.workspaces.find((w) => w.repoId === 2)!
expect(workspace.isWorktree).toBe(false)
expect(worktreeWorkspace.isWorktree).toBe(true)
})
})