UNPKG

@vibe-validate/git

Version:

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

101 lines 2.65 kB
/** * Post-PR Merge Cleanup Tool * * Comprehensive post-PR cleanup workflow that: * 1. Switches to main branch * 2. Syncs main branch with remote origin * 3. Deletes local branches that have been merged * 4. Provides clean workspace for next PR * * Safe operations: * - Only deletes branches that are confirmed merged * - Never deletes the current main branch or unmerged branches * - Provides clear feedback on all actions taken */ export interface CleanupResult { success: boolean; error?: string; branchesDeleted: string[]; currentBranch: string; mainSynced: boolean; } export interface CleanupOptions { mainBranch?: string; remoteName?: string; dryRun?: boolean; } /** * Post-PR Merge Cleanup * * Cleans up merged branches and syncs main branch after PR merge */ export declare class PostPRMergeCleanup { private readonly mainBranch; private readonly remoteName; private readonly dryRun; constructor(options?: CleanupOptions); /** * Run comprehensive post-PR merge cleanup workflow */ runCleanup(): Promise<CleanupResult>; /** * Get the current git branch name */ private getCurrentBranch; /** * Switch to main branch */ private switchToMain; /** * Sync main branch with remote origin */ private syncMainBranch; /** * Fetch remote branch information */ private fetchRemoteInfo; /** * Find and delete branches that have been merged */ private deleteMergedBranches; /** * Get list of local branches to check (excluding main branch) */ private getLocalBranchesToCheck; /** * Process list of branches and delete merged ones */ private processMergedBranches; /** * Handle deletion of a single branch (dry run or actual deletion) */ private handleBranchDeletion; /** * Try to delete a branch (with fallback to force delete) */ private tryDeleteBranch; /** * Attempt regular branch deletion (git branch -d) */ private attemptRegularDelete; /** * Attempt force branch deletion (git branch -D) */ private attemptForceDelete; /** * Check if a branch has been merged into main */ private isBranchMerged; /** * Clean up remote tracking references */ private pruneRemoteReferences; } /** * Convenience function for quick cleanup * * @param options - Cleanup options * @returns Cleanup result */ export declare function cleanupMergedBranches(options?: CleanupOptions): Promise<CleanupResult>; //# sourceMappingURL=post-merge-cleanup.d.ts.map