mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(schedules): require worktrees and choose commit or discard on removal
Drop the repo workspace mode so every scheduled run executes in a worktree. Clearing run history or deleting a run now asks whether to commit pending changes and keep the run branches, or force-remove the worktrees and delete the branches. Sibling repo listings carry the schedule name, and the repo detail workspace view subscribes to schedule worktree sessions only while expanded. Also unify schedule worktree path/branch helpers, refuse a run branch already checked out elsewhere, and clean up terminals when a worktree is removed.
This commit is contained in:
1 parent
6ec3f3bd91
commit
26ff08d891
46 files changed
+1171
-375
No files matched your search
@@ -301,6 +301,21 @@ describe('ocm-manager plugin', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('allows listing schedule worktrees but rejects deleting them', async () => {
|
||||
const tool = await loadTool(configHome)
|
||||
|
||||
const fetchMock = jsonResponse({})
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
await runTool(tool, { action: 'request', params: { method: 'GET', path: '/repos/1/schedules/2/worktrees' } })
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1)
|
||||
|
||||
const deleteMock = jsonResponse({})
|
||||
vi.stubGlobal('fetch', deleteMock)
|
||||
await expect(runTool(tool, { action: 'request', params: { method: 'DELETE', path: '/repos/1/schedules/2/worktrees' } }))
|
||||
.rejects.toThrow(/is not an allowed OpenCode Manager route/)
|
||||
expect(deleteMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('normalizes path traversal and rejects the resolved route without calling the API', async () => {
|
||||
const fetchMock = jsonResponse({})
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
|
||||
Reference in new issue
Block a user