fake-it-til-you-git
Version:
A modern CLI tool to generate fake Git commit history for your GitHub/GitLab profile
224 lines • 6.24 kB
TypeScript
import { type CommitResult } from 'simple-git';
/**
* Interface for repository information
*/
export interface RepositoryInfo {
path: string;
branch: string;
remote?: string;
remoteUrl?: string;
totalCommits: number;
lastCommit?: {
hash: string;
date: Date;
message: string;
author: string;
};
}
/**
* Interface for commit information
*/
export interface CommitInfo {
hash: string;
date: Date;
message: string;
author: string;
email: string;
}
/**
* Interface for repository status
*/
export interface RepoStatus {
isClean: boolean;
staged: string[];
modified: string[];
untracked: string[];
deleted: string[];
ahead: number;
behind: number;
}
/**
* Interface for backup information
*/
export interface BackupInfo {
id: string;
timestamp: Date;
branch: string;
lastCommitHash: string;
totalCommits: number;
backupPath: string;
repositoryPath: string;
}
/**
* Interface for integrity check result
*/
export interface IntegrityCheckResult {
isValid: boolean;
errors: string[];
warnings: string[];
commitCount: number;
branchInfo: {
current: string;
exists: boolean;
};
}
/**
* Interface for push result
*/
export interface PushResult {
success: boolean;
error?: string;
details?: string;
}
/**
* Git operations handler with cross-platform compatibility
*/
export declare class GitOperations {
private git;
private repoPath;
constructor(repoPath?: string);
/**
* Check if current directory is a Git repository
* @returns Promise<boolean> - True if Git repository exists
*/
isGitRepository(): Promise<boolean>;
/**
* Get repository information
* @returns Promise<RepositoryInfo> - Repository details
*/
getRepositoryInfo(): Promise<RepositoryInfo>;
/**
* Get current branch name
* @returns Promise<string> - Current branch name
*/
getCurrentBranch(): Promise<string>;
/**
* Get list of remotes
* @returns Promise<Array<{name: string, url: string}>> - Remote repositories
*/
getRemotes(): Promise<Array<{
name: string;
url: string;
}>>;
/**
* Get commit history
* @param limit - Maximum number of commits to retrieve
* @returns Promise<CommitInfo[]> - Array of commit information
*/
getCommitHistory(limit?: number): Promise<CommitInfo[]>;
/**
* Get total commit count
* @returns Promise<number> - Total number of commits
*/
getTotalCommitCount(): Promise<number>;
/**
* Get repository status
* @returns Promise<RepoStatus> - Repository working directory status
*/
getRepositoryStatus(): Promise<RepoStatus>;
/**
* Check if working directory is clean
* @returns Promise<boolean> - True if working directory is clean
*/
isWorkingDirectoryClean(): Promise<boolean>;
/**
* Initialize a new Git repository
* @returns Promise<void>
*/
initRepository(): Promise<void>;
/**
* Add all files to staging area
* @returns Promise<void>
*/
addAll(): Promise<void>;
/**
* Create a commit with specific date and author
* @param message - Commit message
* @param date - Commit date
* @param author - Author information
* @returns Promise<CommitResult>
*/
createCommit(message: string, date: Date, author: {
name: string;
email: string;
}): Promise<CommitResult>;
/**
* Get the repository path
* @returns string - Repository path
*/
getRepositoryPath(): string;
/**
* Check if a branch exists
* @param branchName - Name of the branch to check
* @returns Promise<boolean> - True if branch exists
*/
branchExists(branchName: string): Promise<boolean>;
/**
* Create a new branch
* @param branchName - Name of the new branch
* @returns Promise<void>
*/
createBranch(branchName: string): Promise<void>;
/**
* Switch to a branch
* @param branchName - Name of the branch to switch to
* @returns Promise<void>
*/
switchBranch(branchName: string): Promise<void>;
/**
* Create a backup of the current repository state
* @returns Promise<BackupInfo> - Backup information
*/
createBackup(): Promise<BackupInfo>;
/**
* Restore repository from a backup
* @param backupInfo - Backup information to restore from
* @returns Promise<void>
*/
restoreFromBackup(backupInfo: BackupInfo): Promise<void>;
/**
* Verify repository integrity after operations
* @returns Promise<IntegrityCheckResult> - Integrity check results
*/
verifyIntegrity(): Promise<IntegrityCheckResult>;
/**
* Clean up backup files
* @param backupInfo - Backup to clean up, or undefined to clean all backups
* @returns Promise<void>
*/
cleanupBackup(backupInfo?: BackupInfo): Promise<void>;
/**
* List all available backups
* @returns Promise<BackupInfo[]> - Array of available backups
*/
listBackups(): Promise<BackupInfo[]>;
/**
* Push commits to remote repository
* @returns Promise<PushResult> - Push operation result
*/
push(): Promise<PushResult>;
/**
* Clean up old backup files (older than 24 hours)
* @returns Promise<void>
*/
cleanupOldBackups(): Promise<void>;
}
/**
* Factory function to create GitOperations instance
* @param repoPath - Optional repository path
* @returns GitOperations instance
*/
export declare function createGitOperations(repoPath?: string): GitOperations;
/**
* Utility function to check if a directory is a Git repository
* @param path - Directory path to check
* @returns Promise<boolean> - True if Git repository
*/
export declare function isGitRepository(path?: string): Promise<boolean>;
/**
* Utility function to get repository information
* @param path - Repository path
* @returns Promise<RepositoryInfo> - Repository information
*/
export declare function getRepositoryInfo(path?: string): Promise<RepositoryInfo>;
//# sourceMappingURL=git.d.ts.map