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:
Chris Scott committed 2026-10-06 11:02:29 -04:00
1 parent 6ec3f3bd91
commit 26ff08d891
46 files changed
+1171 -375

No files matched your search

+14 -1
View File
@@ -1,3 +1,5 @@
import type { Repo } from '../types'
export const ASSISTANT_REPO_ID = 0
export const ASSISTANT_REPO_NAME = 'Assistant'
export const ASSISTANT_REPO_PATH = 'assistant'
@@ -94,13 +96,24 @@ export type RepoWorktreeSource = 'opencode' | 'schedule' | 'git'
/**
* The schedule a worktree belongs to. `runId` is null for the schedule's shared worktree,
* and `inUse` is true while a running run works in it.
* `inUse` is true while a running run works in it, and `name` is the schedule's display name.
*/
export interface RepoWorktreeSchedule {
repoId: number
jobId: number
runId: number | null
inUse: boolean
name: string
}
/**
* A repository visible from another repository in the same project: the repo itself, a plain
* git or OpenCode worktree, or a schedule worktree.
*/
export type RepoSibling = Repo & {
currentBranch?: string
worktreeSource?: RepoWorktreeSource
schedule?: RepoWorktreeSchedule
}
export function isWorktreeSibling(sibling: { worktreeSource?: RepoWorktreeSource }): boolean {