ailock
Version:
AI-Proof File Guard - Protect sensitive files from accidental AI modifications
52 lines • 1.58 kB
TypeScript
import { SimpleGit } from 'simple-git';
export interface GitHookInfo {
hookPath: string;
exists: boolean;
isAilockManaged: boolean;
content?: string;
}
export interface RepoStatus {
isGitRepo: boolean;
hasAilockHook: boolean;
hookInfo?: GitHookInfo;
protectedFiles: string[];
lockedFiles: string[];
}
/**
* Get SimpleGit instance for the current directory
*/
export declare function getGit(cwd?: string): SimpleGit;
/**
* Check if current directory is a Git repository
*/
export declare function isGitRepository(cwd?: string): Promise<boolean>;
/**
* Get the Git repository root directory
*/
export declare function getRepoRoot(cwd?: string): Promise<string | null>;
/**
* Check if a file has staged changes that would be included in commit
*/
export declare function hasStagedChanges(files: string[], cwd?: string): Promise<string[]>;
/**
* Get information about the pre-commit hook
*/
export declare function getHookInfo(repoRoot: string): GitHookInfo;
/**
* Get comprehensive repository status
*/
export declare function getRepoStatus(cwd?: string): Promise<RepoStatus>;
/**
* Generate pre-commit hook script content
* Uses null-terminated file processing to prevent shell injection
*/
export declare function generatePreCommitHook(): string;
/**
* Install or update the pre-commit hook
*/
export declare function installPreCommitHook(repoRoot: string, force?: boolean): Promise<void>;
/**
* Remove ailock pre-commit hook
*/
export declare function removePreCommitHook(repoRoot: string): void;
//# sourceMappingURL=git.d.ts.map