import type { Result } from "@tff/core"; import type { DomainError } from "../../infrastructure/errors/generic-domain-error.js"; import type { CommitRef } from "../../shared/value-objects/commit-ref.js"; export interface GitOps { createBranch(name: string, from: string): Promise>; createWorktree( path: string, branch: string, startPoint?: string, ): Promise>; deleteWorktree(path: string): Promise>; listWorktrees(): Promise>; commit( message: string, files: string[], worktreePath?: string, ): Promise>; revert(commitSha: string, worktreePath?: string): Promise>; merge(source: string, target: string): Promise>; getCurrentBranch(worktreePath?: string): Promise>; getHeadSha(worktreePath?: string): Promise>; // S03: State branch support /** Create a TRUE orphan branch in a worktree (no shared history with any branch). */ createOrphanWorktree(path: string, branchName: string): Promise>; checkoutWorktree(path: string, existingBranch: string): Promise>; branchExists(name: string): Promise>; deleteBranch(name: string): Promise>; pruneWorktrees(): Promise>; lsTree(ref: string): Promise>; extractFile(ref: string, filePath: string): Promise>; /** Detect the default branch name: origin/HEAD -> git config -> 'main' fallback. */ detectDefaultBranch(): Promise>; /** Push a branch to remote (best-effort — non-blocking if no remote). */ pushBranch(branch: string, remote?: string): Promise>; /** Fetch a specific branch from remote into local refs (best-effort). */ fetchBranch(branch: string, remote?: string): Promise>; }