import type { GitForkSyncExpectedUpstream, GitForkSyncResult } from '../../shared/git-fork-sync' import type { TuiAgent } from '../../shared/tui-agent' import type { GitPushTarget } from '../../shared/worktree/types' import type { HostedReviewProvider } from '../../shared/hosted-review' import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control-ai' import type { SourceControlAiSettings } from '../../shared/source-control-ai-types' export type GitOperationApi = { appendGitignore: (args: { worktreePath: string; folderName: string }) => Promise abortMerge: (args: { worktreePath: string; connectionId?: string }) => Promise abortRebase: (args: { worktreePath: string; connectionId?: string }) => Promise fetch: (args: { worktreePath: string connectionId?: string pushTarget?: GitPushTarget }) => Promise syncFork: (args: { worktreePath: string connectionId?: string expectedUpstream: GitForkSyncExpectedUpstream }) => Promise push: (args: { worktreePath: string publish?: boolean forceWithLease?: boolean connectionId?: string pushTarget?: GitPushTarget }) => Promise pull: (args: { worktreePath: string connectionId?: string pushTarget?: GitPushTarget }) => Promise fastForward: (args: { worktreePath: string connectionId?: string pushTarget?: GitPushTarget }) => Promise rebaseFromBase: (args: { worktreePath: string baseRef: string connectionId?: string }) => Promise commit: (args: { worktreePath: string message: string connectionId?: string }) => Promise<{ success: boolean; error?: string }> generateCommitMessage: (args: { worktreePath: string /** Raw (unstripped) worktree meta key; validated against worktreePath in main. */ worktreeId?: string repoId?: string connectionId?: string sourceControlAiResolvedParams?: ResolvedSourceControlAiGenerationParams sourceControlAi?: SourceControlAiSettings agentCmdOverrides?: Partial> }) => Promise< | { success: true; message: string; agentLabel?: string } | { success: false; error: string; canceled?: boolean } > cancelGenerateCommitMessage: (args: { worktreePath: string connectionId?: string }) => Promise generatePullRequestFields: (args: { worktreePath: string /** Raw (unstripped) worktree meta key; validated against worktreePath in main. */ worktreeId?: string repoId?: string base: string title: string body: string draft: boolean provider?: HostedReviewProvider useTemplate?: boolean connectionId?: string sourceControlAiResolvedParams?: ResolvedSourceControlAiGenerationParams sourceControlAi?: SourceControlAiSettings agentCmdOverrides?: Partial> }) => Promise< | { success: true fields: { base: string; title: string; body: string; draft: boolean } agentLabel?: string branchChangedByPreparation?: boolean } | { success: false error: string canceled?: boolean branchChangedByPreparation?: boolean } > cancelGeneratePullRequestFields: (args: { worktreePath: string connectionId?: string }) => Promise stage: (args: { worktreePath: string; filePath: string; connectionId?: string }) => Promise bulkStage: (args: { worktreePath: string filePaths: string[] connectionId?: string }) => Promise unstage: (args: { worktreePath: string filePath: string connectionId?: string }) => Promise bulkUnstage: (args: { worktreePath: string filePaths: string[] connectionId?: string }) => Promise discard: (args: { worktreePath: string filePath: string connectionId?: string }) => Promise bulkDiscard: (args: { worktreePath: string filePaths: string[] connectionId?: string }) => Promise }