/** * The Facts seam: everything the engine's rules may ask about a repository. * * This is the root of the dependency graph — the engine (which asks the * questions) and every backend that answers them (`@handsealed/facts-git` * today; a sidecar or forge-API adapter later) depend on this and never on * each other. It carries no runtime code and no dependencies: just the * contract and its git-shaped value types. * * Error contract: implementations throw only on infrastructure failure * (unreachable repo, unknown object, git error). Callers treat any throw as * fail-closed — never as evidence of anything. Semantic absences are values: * a missing file is `null`, no merge base is `null`, an empty diff is `[]`. */ /** A full git object id (40-char SHA-1 or 64-char SHA-256, lowercase hex). */ export type Oid = string; /** How a path changed between two trees. */ export type ChangeKind = "added" | "modified" | "deleted" | "renamed" | "copied" | "typechange"; export interface PathChange { /** The path after the change (the new path for renames/copies). */ readonly path: string; readonly kind: ChangeKind; /** The old path, for renamed/copied entries. */ readonly fromPath?: string; } /** One file's slice of a unified diff. */ export interface FilePatch { readonly path: string; readonly fromPath?: string; readonly kind: ChangeKind; /** Unified diff text for this file; empty for binary files. */ readonly text: string; readonly binary: boolean; } /** A per-file stable diff id. */ export interface PatchFileId { readonly path: string; readonly id: string; } /** * Stable identity of a diff's content, independent of line numbers and * context drift. Both sides of any comparison must come from the same * implementation — ids are never mixed across implementations. */ export interface PatchIdentity { /** One id over the whole diff. */ readonly combined: string; /** One id per changed file, keyed by post-change path. */ readonly files: readonly PatchFileId[]; } /** A contiguous commit range, `base` exclusive, `head` inclusive. */ export interface CommitRange { readonly base: Oid; readonly head: Oid; } export type RangeDiffMarker = "equal" | "modified" | "only-in-old" | "only-in-new"; /** One pairing in a range-diff between two versions of a series. */ export interface RangeDiffEntry { readonly marker: RangeDiffMarker; readonly oldSubject?: string; readonly newSubject?: string; } /** Whether merging `from` into `into` would be conflict-free. */ export interface MergeTreePreflight { readonly clean: boolean; readonly conflictedPaths: readonly string[]; } export interface Facts { /** Paths changed between two commits' trees, rename-aware. */ pathsChanged(base: Oid, head: Oid): Promise; /** Full contents of `path` at `revision`, or `null` if absent there. */ fileAtRef(revision: string, path: string): Promise; /** Per-file unified diffs between two commits. */ patchOf(base: Oid, head: Oid): Promise; /** True when `ancestor` is an ancestor of (or equal to) `descendant`. */ isAncestor(ancestor: Oid, descendant: Oid): Promise; /** Best common ancestor, or `null` when histories are unrelated. */ mergeBase(a: Oid, b: Oid): Promise; /** Stable patch identity for the diff `base..head`. */ patchIdOf(base: Oid, head: Oid): Promise; /** Pairing of two series (e.g. pre- and post-rebase) by patch similarity. */ rangeDiff(previous: CommitRange, current: CommitRange): Promise; /** In-memory merge test: would merging `from` into `into` be clean? */ mergeTreePreflight(into: Oid, from: Oid): Promise; } //# sourceMappingURL=index.d.ts.map