feat(ocm-cli): add session warp with progress reporting (#314)

* feat(ocm-cli): add session warp with progress reporting

Add warp functionality for moving sessions between local and remote
Managers. Includes TUI dialogs, remote replay, progress reporting
during event transfer, and comprehensive test coverage.

* feat(ocm-cli): add granular push progress with phase reporting and upload tracking

* chore(ocm-cli): bump version to 0.2.5

* docs(ocm-cli): document push progress phases in README
This commit is contained in:
Chris Scott authored and GitHub committed 2026-07-16 17:36:54 -04:00
1 parent 4519bcd2e9
commit adf6bd2921
16 files changed
+759 -30

No files matched your search

+8
View File
@@ -103,6 +103,7 @@ function coerceTimestamp(data: Record<string, unknown>): void {
export type TransferDeps = {
fetchLocalHistory: () => Promise<HistoryEventRow[]>
replayEvents: (remoteDirectory: string, events: ReplayEvent[]) => Promise<{ sessionID: string }>
onProgress?: (replayed: number, total: number) => void
}
export type TransferInput = { sessionID: string; localRoot: string; remoteDirectory: string }
@@ -134,12 +135,15 @@ export async function transferSession(input: TransferInput, deps: TransferDeps):
})
const batches = planReplayBatches(rewritten)
const total = rewritten.length
let replayed = 0
deps.onProgress?.(replayed, total)
for (const batch of batches) {
try {
await deps.replayEvents(input.remoteDirectory, batch)
replayed += batch.length
deps.onProgress?.(replayed, total)
} catch (err) {
return { kind: 'replay-failed', message: err instanceof Error ? err.message : String(err) }
}
@@ -148,6 +152,10 @@ export async function transferSession(input: TransferInput, deps: TransferDeps):
return { kind: 'moved', sessionID: input.sessionID, replayedEvents: replayed }
}
export function moveReminderText(directory: string): string {
return `<system-reminder>The user has changed the current working directory to "${directory}". This is still the same project but at a possibly new location; take this into account when working with any files from now on.</system-reminder>`
}
function deepClone<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj))
}