export type WorktreeStatus = "active" | "reconciling" | "conflicted" | "cleanup_failed" | "done" | "failed" | "removing"; export type WorktreeReconciliationSummary = { committed: "none" | "present" | "merged_by_agent" | "failed"; uncommitted: "none" | "present" | "applied_by_agent" | "failed"; removed: boolean; cleanup: "not_needed" | "removed_by_agent" | "nudged" | "failed"; conflictFiles: string[]; threadId?: string; }; export type Worktree = { name: string; path: string; branch: string; baseBranch: string; createdAt: string; source: string; agent: string; status: WorktreeStatus; storyId?: string; planPath?: string; prompt?: string; sourceCwd?: string; baseHead?: string; reconciledAt?: string; reconciliation?: WorktreeReconciliationSummary; }; export type WorktreeRegistry = { worktrees: Worktree[]; }; export type WorktreeFileSystem = { readFile(path: string, encoding: BufferEncoding): Promise; writeFile(path: string, data: string, options?: { encoding?: BufferEncoding; flag?: string; }): Promise; mkdir(path: string, options?: { recursive?: boolean; }): Promise; rename(oldPath: string, newPath: string): Promise; unlink(path: string): Promise; lstat(path: string): Promise<{ isSymbolicLink(): boolean; }>; }; export type ExecResult = { stdout: string; stderr: string; }; export type ExecFn = (command: string, options?: { cwd?: string; }) => Promise; export type WorktreeDeps = { fs: WorktreeFileSystem; exec: ExecFn; };