import type { CommitSummary } from "./types";
/** `authorEmail` is optional because briefs cached before it was added lack it. */
export type CommitBrief = Pick<CommitSummary, "sha" | "shortSha" | "subject" | "authorName" | "committedAt"> & {
authorEmail?: string;
};
export function toBrief(commit: CommitSummary): CommitBrief {
return {
sha: commit.sha,
shortSha: commit.shortSha,
subject: commit.subject,
authorName: commit.authorName,
authorEmail: commit.authorEmail,
committedAt: commit.committedAt,
};
}
/** A run of consecutive final-version lines (0-based `start`) attributed to one commit. */
export type BlameRange = { start: number; count: number; sha: string };
export type BlameResult = {
lines: string[];
ranges: BlameRange[];
commits: Record<string, CommitBrief>;
};
export type CodeSearchHit = {
owner: string;
repo: string;
ref: string;
path: string;
snippet: string;
/** Matching lines with highlight spans; empty for path-only queries. */
lines: CodeSearchLine[];
/** Lines in the file that matched, which can exceed `lines`. */
matchCount: number;
};
export type CodeSearchLine = {