/** * Git Utility Functions for Git-Worktree MCP Integration * * Provides low-level git operations and validation utilities * used by the git-worktree MCP tool handlers. */ export interface GitRepositoryInfo { isGitRepo: boolean; rootPath: string | null; currentBranch: string | null; hasUncommittedChanges: boolean; error?: string; } export interface WorktreeInfo { path: string; commit: string; branch: string | null; isDetached: boolean; } export interface WorktreeMetadata { worktree_name: string; agent_type: string; task_id: string; branch: string; base_branch: string; created: string; repo_root: string; } export interface RegistryEntry { name: string; path: string; branch: string; agent: string; task: string; base: string; created: string; status: 'active' | 'merged' | 'cleaned'; cleaned?: string; } export interface BranchInfo { name: string; isMerged: boolean; commitsAhead: number; exists: boolean; } export interface DiskSpaceInfo { availableKB: number; requiredKB: number; hasEnoughSpace: boolean; } export interface GitOperationResult { success: boolean; output: string; error?: string; } /** * Execute a git command and return the output */ export declare function execGit(command: string, cwd?: string): GitOperationResult; /** * Get comprehensive information about the current git repository */ export declare function getRepositoryInfo(cwd?: string): GitRepositoryInfo; /** * Get the worktree base directory path */ export declare function getWorktreeBasePath(repoRoot: string): string; /** * Get the worktree registry file path */ export declare function getRegistryPath(repoRoot: string): string; /** * Generate worktree name from agent type and task ID */ export declare function generateWorktreeName(agentType: string, taskId: string): string; /** * Generate branch name for agent worktree */ export declare function generateBranchName(agentType: string, taskId: string): string; /** * Check if a branch exists */ export declare function branchExists(branchName: string, repoRoot: string): boolean; /** * Check if a branch is merged into target branch */ export declare function isBranchMerged(branchName: string, targetBranch: string, repoRoot: string): boolean; /** * Get comprehensive branch information */ export declare function getBranchInfo(branchName: string, targetBranch: string, repoRoot: string): BranchInfo; /** * Check if a branch is in use by any worktree */ export declare function isBranchInWorktree(branchName: string, repoRoot: string): boolean; /** * Delete a branch (safely or forced) */ export declare function deleteBranch(branchName: string, repoRoot: string, force?: boolean): GitOperationResult; /** * Get list of merged agent branches */ export declare function getMergedAgentBranches(targetBranch: string, repoRoot: string): string[]; /** * List all git worktrees */ export declare function listWorktrees(repoRoot: string): WorktreeInfo[]; /** * Check if a worktree exists at the given path */ export declare function worktreeExists(worktreePath: string, repoRoot: string): boolean; /** * Check if worktree directory exists on disk */ export declare function worktreeDirectoryExists(worktreePath: string): boolean; /** * Create a new worktree */ export declare function createWorktree(worktreePath: string, branchName: string, baseBranch: string, repoRoot: string): GitOperationResult; /** * Remove a worktree */ export declare function removeWorktree(worktreePath: string, repoRoot: string, force?: boolean): GitOperationResult; /** * Prune stale worktree entries */ export declare function pruneWorktrees(repoRoot: string, dryRun?: boolean): GitOperationResult; /** * Get uncommitted changes in a worktree */ export declare function getUncommittedChanges(worktreePath: string): string[]; /** * Initialize the worktree registry if it doesn't exist */ export declare function initializeRegistry(repoRoot: string): void; /** * Read all entries from the worktree registry */ export declare function readRegistry(repoRoot: string): RegistryEntry[]; /** * Add an entry to the worktree registry */ export declare function addRegistryEntry(repoRoot: string, entry: RegistryEntry): void; /** * Update a registry entry's status */ export declare function updateRegistryStatus(repoRoot: string, worktreeName: string, status: RegistryEntry['status']): void; /** * Get registry statistics */ export declare function getRegistryStats(repoRoot: string): { total: number; active: number; merged: number; cleaned: number; byAgent: Record; }; /** * Create agent metadata file in worktree */ export declare function createAgentMetadata(worktreePath: string, metadata: WorktreeMetadata): void; /** * Read agent metadata from worktree */ export declare function readAgentMetadata(worktreePath: string): WorktreeMetadata | null; /** * Check available disk space */ export declare function checkDiskSpace(targetPath: string, requiredKB?: number): DiskSpaceInfo; /** * Get directory size in human-readable format */ export declare function getDirectorySize(dirPath: string): string; /** * Validate that we're in a git repository */ export declare function validateGitRepository(cwd?: string): { valid: boolean; repoRoot: string | null; error?: string; }; /** * Validate agent type and task ID format */ export declare function validateWorktreeParams(agentType: string, taskId: string): { valid: boolean; error?: string; }; /** * Validate merge strategy */ export declare function validateMergeStrategy(strategy: string): { valid: boolean; error?: string; }; //# sourceMappingURL=git-helpers.d.ts.map