/** * CRUD for the git signal tables (ADR-11). * * `git_commits` holds one row per commit. `git_file_commits` is the * file-pivoted index — derived on import from each commit's embedded * `files` array, re-exported by joining back on the commit. * * The public API follows the "full replace" discipline from ADR-11: * every extraction run clears the tables and re-inserts. No * incremental-merge path, no "append commits newer than SHA X" — * simpler and side-steps rewritten-history edge cases. */ import type { GitCommit } from "../extraction/git-extractor.js"; import type { DatabaseInstance } from "./db.js"; export interface StoredGitCommit { sha: string; date: string; message: string; authorEmail: string; files: string[]; } /** * Atomically replace the git tables with the given commits. The files * array on each commit populates `git_file_commits` — the file-pivoted * index is derived, not stored on the atlas side. */ export declare function replaceGitCommits(db: DatabaseInstance, commits: readonly GitCommit[]): void; /** * List every stored commit, newest-first, with its files reconstructed * by joining `git_file_commits`. Used by atlas export. */ export declare function listAllGitCommits(db: DatabaseInstance): StoredGitCommit[]; /** * Return the most recent `limit` commits that touched `filePath`, * newest-first. Used to populate the `git.recentCommits` bundle field. */ export declare function listCommitsForFile(db: DatabaseInstance, filePath: string, limit: number): StoredGitCommit[]; /** * Count how many commits in the stored window touched `filePath`. * Used to compute hot/cold against `config.git.recentCommits`. */ export declare function countCommitsForFile(db: DatabaseInstance, filePath: string): number; export interface CoChangeResult { filePath: string; coCommitCount: number; } /** * Return files that share commits with `filePath`, ranked by shared * commit count descending. Self-join on `git_file_commits`: * commits that touched both files count as co-change events. * * Excludes `filePath` itself. Ties broken by file path alphabetical * for determinism. */ export declare function findCoChangeFiles(db: DatabaseInstance, filePath: string, limit: number): CoChangeResult[]; /** Used by pipeline tests / full resets. */ export declare function clearGitCommits(db: DatabaseInstance): void; //# sourceMappingURL=git.d.ts.map