/** * Git state binding for Trust Ledger entries. * * Binary-compatible with the Python git_binding.py implementation. * * The source_tree_hash field is the output of `git rev-parse HEAD`, * with a "-dirty" suffix if the working tree has uncommitted changes * (staged or unstaged, or untracked files that affect reproducibility). * * Security note (architecture §C-02): * All functions return null / false rather than throwing on git errors. * Callers treat null as "unverifiable" and annotate accordingly. * Actual tampering is detected by the chain hash, not git binding. */ export declare class GitBindingError extends Error { constructor(message: string); } export interface GitMetadata { commit: string | null; branch: string | null; dirty: boolean; sourceTreeHash: string | null; } /** * Compute a deterministic hash of the current git tree state. * * Returns the full commit SHA-1 from `git rev-parse HEAD`, appending * the "-dirty" suffix if there are any uncommitted changes or untracked * files (matching Python's _is_dirty which checks both `git diff --stat HEAD` * and `git status --porcelain`). * * @param repoPath - Absolute path to the git repository root. * @returns "", "-dirty", or null if not a git repo / git unavailable. */ export declare function computeSourceTreeHash(repoPath: string): string | null; /** * Verify that the current git state matches the entry's recorded hash. * * Per architecture §C-02, returns false on any unverifiable condition. * * An entry is considered verified if ALL of the following hold: * 1. The entry contains a non-null, non-empty source_tree_hash. * 2. The stored hash does not end in "-dirty". * 3. The current `git rev-parse HEAD` matches the stored hash. * * @param entry - A ledger entry dict. * @param repoPath - Path to the git repository root. * @returns true if verified, false in all other cases. */ export declare function verifyGitBinding(entry: Record, repoPath: string): boolean; /** * Return a dict of current git state metadata for ledger payloads. * * Matches Python's get_git_metadata() exactly — same field names, * same dirty detection logic, same null-on-error behavior. * * @param repoPath - Path to the git repository root. * @returns Git metadata dict, or null fields on any failure. */ export declare function getGitMetadata(repoPath: string): GitMetadata; //# sourceMappingURL=git-binding.d.ts.map