trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
63 lines • 1.69 kB
TypeScript
/**
* Git Reader
*
* Reads a Git repository's commit graph and file-level diffs
* by shelling out to `git`. No libgit2 dependency.
*/
export interface GitCommit {
hash: string;
authorName: string;
authorEmail: string;
timestamp: string;
message: string;
parentHashes: string[];
}
export interface GitFileChange {
status: 'A' | 'M' | 'D' | 'R';
path: string;
oldPath?: string;
}
export interface GitCommitWithChanges extends GitCommit {
changes: GitFileChange[];
}
export declare class GitReader {
private repoPath;
constructor(repoPath: string);
/**
* Verifies this is a valid Git repository.
*/
isGitRepo(): boolean;
/**
* Returns all commits in topological order (oldest first).
*/
readCommits(): GitCommit[];
/**
* Returns file changes for a specific commit.
* For the root commit (no parents), diffs against empty tree.
*/
readChanges(commitHash: string, parentHash?: string): GitFileChange[];
/**
* Returns the full content of a file at a specific commit.
*/
readFileContent(commitHash: string, filePath: string): Buffer | null;
/**
* Reads all commits with their file changes in topological order.
* This is the main entry point for the import pipeline.
*/
readFullHistory(): GitCommitWithChanges[];
/**
* Returns the total number of commits.
*/
commitCount(): number;
/**
* Returns the current branch name.
*/
currentBranch(): string;
/**
* Returns all branch names.
*/
branches(): string[];
private git;
private gitBuffer;
}
//# sourceMappingURL=git-reader.d.ts.map