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

+38
View File
@@ -118,6 +118,44 @@ describe('rewriteEventsForRemote', () => {
expect(result[0]!.data.location).toEqual({ directory: '/workspace/repos/repo/src' })
})
it('rewrites assistant message path cwd and root', () => {
const events: ReplayEvent[] = [
{
id: 'e1', aggregateID: 'ses_a', seq: 3,
type: 'message.updated.1',
data: { info: { id: 'msg_1', role: 'assistant', path: { cwd: '/Users/x/repo/src', root: '/Users/x/repo' } } },
},
]
const result = rewriteEventsForRemote(events, ctx)
expect(result[0]!.data.info).toEqual({
id: 'msg_1',
role: 'assistant',
path: { cwd: '/workspace/repos/repo/src', root: '/workspace/repos/repo' },
})
})
it('leaves message paths outside the local root untouched', () => {
const events: ReplayEvent[] = [
{
id: 'e1', aggregateID: 'ses_a', seq: 3,
type: 'message.updated.1',
data: { info: { id: 'msg_1', role: 'assistant', path: { cwd: '/Users/x/repo-other', root: '/Users/x/repo-other' } } },
},
{
id: 'e2', aggregateID: 'ses_a', seq: 4,
type: 'message.updated.1',
data: { info: { id: 'msg_2', role: 'user' } },
},
]
const result = rewriteEventsForRemote(events, ctx)
expect(result[0]!.data.info).toEqual({ id: 'msg_1', role: 'assistant', path: { cwd: '/Users/x/repo-other', root: '/Users/x/repo-other' } })
expect(result[1]!.data.info).toEqual({ id: 'msg_2', role: 'user' })
})
it('strips workspaceID from info', () => {
const events: ReplayEvent[] = [
{