/** * Which commit each environment repository pins to. * * The repo templates key `resolveHead` by clone URL; the factory records heads * by repository slug. These helpers translate between the two and decide * whether a set of current heads differs from the recorded one. */ import type { VersionControl } from '../capabilities/version-control.js'; export type EnvironmentHeads = Record; /** `owner/repo` from a clone URL in any common spelling, lower-cased, `.git` stripped; undefined when unparseable. */ export declare function cloneUrlSlug(cloneUrl: string): string | undefined; /** The environment slug a clone URL names, in the environment's own spelling; undefined when none matches. */ export declare function matchEnvironmentSlug(cloneUrl: string, slugs: Iterable): string | undefined; /** * A `resolveHead` that answers from recorded heads only: the template pins to * what the last build used, so its identity moves when a build does. A URL * outside the recorded set resolves undefined and the template falls back to * its own lookup for that repository. */ export declare function recordedHeadResolver(heads: EnvironmentHeads): (cloneUrl: string) => Promise; /** True when any repository's current head differs from the recorded one, or either side names a repository the other lacks. */ export declare function headsChanged(recorded: EnvironmentHeads | null, current: EnvironmentHeads): boolean; export interface HeadRepository { id: string; slug: string; /** The ref the environment pins: the link's branch, else the repository default. */ branch: string; } /** Current head of every repository's pinned ref, keyed by slug. Throws when any lookup fails. */ export declare function resolveCurrentHeads(github: { versionControl: Pick; }, input: { orgId: string; repositories: HeadRepository[]; }): Promise; //# sourceMappingURL=heads.d.ts.map