/** * Git branch detection and name sanitization. */ /** * Check if the current directory (or given path) is inside a git repository. */ export declare function isGitRepo(cwd?: string): Promise; /** * Get the root directory of the git repository. * Throws NotGitRepoError if not in a git repo. */ export declare function getRepoRoot(cwd?: string): Promise; /** * Get the current branch name. * Throws NotGitRepoError if not in a git repo. * Throws DetachedHeadError if in detached HEAD state. */ export declare function getCurrentBranch(cwd?: string): Promise; /** * Get the previous branch (the one checked out before the current one). * Returns null if there's no previous branch info. */ export declare function getPreviousBranch(cwd?: string): Promise; /** * List all local branches. */ export declare function listBranches(cwd?: string): Promise; /** * Sanitize a branch name for use as a filename. * * - Prevents path traversal (../, ~, leading /) * - Replaces non-alphanumeric chars (except . _ -) with _ * - Collapses consecutive underscores * - Prevents leading dots (hidden files) * - Enforces max length of 200 characters */ export declare function sanitizeBranchName(branchName: string): string; /** * Validate that a branch name is safe to use. * Returns an error message if invalid, null if valid. */ export declare function validateBranchInput(input: string): string | null;