import type { GitCommitAction, GitCommitActionResult } from '../../shared/git/commands/git-commit-action' import type { GitForkSyncExpectedUpstream, GitForkSyncResult } from '../../shared/git/remotes/git-fork-sync' import type { TuiAgent } from '../../shared/agent-launch/catalog/tui-agent' import type { GitPushTarget } from '../../shared/worktree/types' import type { GitStageWorktreeScope } from '../../shared/git/paths/git-stage-worktree-scope' import type { ConflictResolution } from '../../shared/source-control/listing/source-control-entry-actions' import type { HostedReviewProvider } from '../../shared/source-control/hosted-review/hosted-review-contracts' import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control/ai/source-control-ai-operation-resolution' import type { SourceControlAiSettings } from '../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { TextGenerationFailureFields } from '../../shared/text-generation-failure-copy' 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 }> createBranch: (args: { worktreePath: string name: string startPoint: string connectionId?: string }) => Promise cherryPick: (args: { worktreePath: string commitId: string connectionId?: string }) => Promise revert: (args: { worktreePath: string commitId: string connectionId?: string }) => Promise sequencerAbort: (args: { worktreePath: string operation: GitCommitAction connectionId?: string }) => Promise sequencerContinue: (args: { worktreePath: string operation: GitCommitAction connectionId?: string }) => Promise completeMerge: (args: { worktreePath: 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; canceled?: boolean } & TextGenerationFailureFields) > 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 canceled?: boolean branchChangedByPreparation?: boolean } & TextGenerationFailureFields) > cancelGeneratePullRequestFields: (args: { worktreePath: string connectionId?: string }) => Promise stage: (args: { worktreePath: string; filePath: string; connectionId?: string }) => Promise resolveConflict: (args: { worktreePath: string filePath: string resolution: ConflictResolution connectionId?: string }) => Promise bulkStage: (args: { worktreePath: string filePaths: string[] connectionId?: string scope?: GitStageWorktreeScope }) => 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 }