@entro314labs/ai-changelog-generator
Version:
AI-powered changelog generator with MCP server support - works with most providers, online and local models
204 lines (203 loc) • 6.98 kB
TypeScript
import { GitError } from '../../shared/utils/error-classes.js';
/**
* GitManager - Handles all Git command execution and repository operations
*
* This class provides a centralized interface for Git operations with proper
* error handling, command validation, and consistent output formatting.
*/
export declare class GitManager {
[key: string]: any;
constructor(options?: Record<string, any>);
/**
* Check if current directory is a Git repository
* @returns {boolean} True if in a Git repository
*/
get isGitRepo(): any;
/**
* Get the Git directory path
* @returns {string|null} Path to .git directory or null if not a Git repo
*/
get gitDir(): any;
/**
* Execute a Git command with full error handling
* @param {string} command - The Git command to execute
* @returns {string} Command output
* @throws {GitError} If command fails
*/
execGit(command: any): string;
/**
* Execute a Git command safely, returning empty string on failure
* @param {string} command - The Git command to execute
* @returns {string} Command output or empty string on failure
*/
execGitSafe(command: any): string;
/**
* Execute a Git show command with specific error handling for missing files
* @param {string} command - The Git show command to execute
* @returns {string|null} Command output or null if file doesn't exist
*/
execGitShow(command: any): string | null;
/**
* Validate a commit hash exists in the repository
* @param {string} hash - The commit hash to validate
* @returns {boolean} True if commit exists
*/
validateCommitHash(hash: any): boolean;
/**
* Get the current branch name
* @returns {string} Current branch name or 'HEAD' if detached
*/
getCurrentBranch(): string;
/**
* Get the remote URL for the repository
* @param {string} remoteName - Name of the remote (default: 'origin')
* @returns {string|null} Remote URL or null if not found
*/
getRemoteUrl(remoteName?: string): string | null;
/**
* Get repository root directory
* @returns {string|null} Repository root path or null if not in a Git repo
*/
getRepositoryRoot(): string | null;
/**
* Check if working directory is clean (no uncommitted changes)
* @returns {boolean} True if working directory is clean
*/
isWorkingDirectoryClean(): boolean;
/**
* Get list of all tags in repository
* @returns {Array<string>} Array of tag names
*/
getAllTags(): string[];
/**
* Get the latest tag
* @returns {string|null} Latest tag name or null if no tags
*/
getLatestTag(): string | null;
/**
* Get commits between two references
* @param {string} from - Starting reference (commit, tag, branch)
* @param {string} to - Ending reference (default: 'HEAD')
* @param {Object} options - Optional filters
* @param {string} options.author - Filter by author name or email
* @returns {Array<Object>} Array of commit objects
*/
getCommitsBetween(from: any, to?: string, options?: Record<string, any>): {
hash: string;
message: string;
}[];
/**
* Get commits filtered by author
* @param {string} author - Author name or email to filter by
* @param {number} limit - Maximum number of commits to return
* @returns {Array<Object>} Array of commit objects by this author
*/
getCommitsByAuthor(author: any, limit?: number): {
hash: string;
message: string;
}[];
/**
* Get commits between two tags
* @param {string} fromTag - Starting tag
* @param {string} toTag - Ending tag (default: 'HEAD')
* @param {Object} options - Optional filters
* @returns {Array<Object>} Array of commit objects between tags
*/
getCommitsBetweenTags(fromTag: any, toTag?: string, options?: Record<string, any>): {
hash: string;
message: string;
}[];
/**
* Get list of all authors in repository
* @returns {Array<string>} Array of unique author names
*/
getAllAuthors(): string[];
/**
* Get list of stashed changes
* @returns {Array<Object>} Array of stash entries with index, message, and date
*/
getStashList(): {
index: string;
message: string;
date: string;
}[];
/**
* Get detailed information about a specific stash entry
* @param {string} stashRef - Stash reference (e.g., 'stash@{0}')
* @returns {Object|null} Stash details including files changed
*/
getStashDetails(stashRef?: string): {
ref: string;
message: string;
files: ({
path: string;
changes: number;
} | null)[];
diff: string;
stats: {
filesChanged: number;
insertions: number;
deletions: number;
};
} | null;
/**
* Check if there are any stashed changes
* @returns {boolean} True if stash has entries
*/
hasStashedChanges(): boolean;
/**
* Check if a file exists in a specific commit
* @param {string} commitHash - The commit to check
* @param {string} filePath - The file path to check
* @returns {boolean} True if file exists in the commit
*/
fileExistsInCommit(commitHash: any, filePath: any): boolean;
/**
* Get file content from a specific commit
* @param {string} commitHash - The commit to get the file from
* @param {string} filePath - The file path to retrieve
* @returns {string|null} File content or null if file doesn't exist
*/
getFileFromCommit(commitHash: any, filePath: any): string | null;
/**
* Reset internal caches (call when repository state might have changed)
*/
resetCache(): void;
/**
* Get detailed repository information
* @returns {Object} Repository information object
*/
getRepositoryInfo(): {
isGitRepo: boolean;
gitDir?: undefined;
repositoryRoot?: undefined;
currentBranch?: undefined;
remoteUrl?: undefined;
isClean?: undefined;
latestTag?: undefined;
totalTags?: undefined;
} | {
isGitRepo: boolean;
gitDir: any;
repositoryRoot: string | null;
currentBranch: string;
remoteUrl: string | null;
isClean: boolean;
latestTag: string | null;
totalTags: number;
};
/**
* Check if current directory is a Git repository
* @private
* @returns {boolean}
*/
_checkIsGitRepo(): boolean;
/**
* Create a GitError from a command execution error
* @private
* @param {string} command - The Git command that failed
* @param {Error} error - The original error
* @returns {GitError}
*/
_createGitError(command: any, error: any): GitError;
}