import { createContext } from 'react'; export type GitOperation = 'fetch' | 'pull' | 'push'; export interface GitSyncState { dir: string; operation: GitOperation; isActive: boolean; error?: Error; } export interface FetchResult { defaultBranch: string | null; fetchHead: string | null; fetchHeadDescription: string | null; } export interface GitSyncContextValue { // State access syncStates: Map; getState: (dir: string) => GitSyncState | undefined; getError: (dir: string) => Error | undefined; // Git operations fetch: (dir: string, remote?: string) => Promise; pull: (dir: string, ref: string, remote?: string) => Promise; push: (dir: string, ref: string, remote?: string, force?: boolean) => Promise; sync: (dir: string, ref: string, remote?: string) => Promise; forcePull: (dir: string, ref: string, remote?: string) => Promise; forcePush: (dir: string, ref: string, remote?: string) => Promise; // Internal state management (for backward compatibility during migration) startOperation: (dir: string, operation: GitOperation) => void; endOperation: (dir: string, error?: Error) => void; setError: (dir: string, error: Error | null) => void; } export const GitSyncContext = createContext(null);