UNPKG

@vibe-validate/git

Version:

Git utilities for vibe-validate - tree hash calculation, branch sync, and post-merge cleanup

62 lines 1.82 kB
/** * Smart Branch Sync Checker * * Safely checks if the current branch is behind a remote branch without auto-merging. * Provides clear status reporting and next-step instructions. * * Key safety features: * - Never auto-merges (preserves conflict visibility) * - Clear exit codes for CI/agent integration * - Explicit instructions when manual intervention needed * - Cross-platform compatibility */ export interface SyncCheckResult { isUpToDate: boolean; behindBy: number; currentBranch: string; hasRemote: boolean; error?: string; } export type GitExecutor = (_args: string[]) => Promise<{ stdout: string; stderr: string; }>; export interface SyncCheckOptions { remoteBranch?: string; gitExecutor?: GitExecutor; } /** * Branch Sync Checker * * Checks if current branch is behind a remote branch */ export declare class BranchSyncChecker { private readonly remoteBranch; private readonly gitExecutor; constructor(options?: SyncCheckOptions); /** * Check if the current branch is synchronized with remote branch * * @returns Promise resolving to sync status information */ checkSync(): Promise<SyncCheckResult>; private getCurrentBranch; private hasRemoteBranch; private fetchRemote; private getCommitsBehind; /** * Get appropriate exit code based on sync result * * @param result - The sync check result * @returns Exit code (0=success, 1=needs merge, 2=error) */ getExitCode(result: SyncCheckResult): number; } /** * Convenience function for quick sync checking * * @param options - Sync check options * @returns Sync check result */ export declare function checkBranchSync(options?: SyncCheckOptions): Promise<SyncCheckResult>; //# sourceMappingURL=branch-sync.d.ts.map