//#region src/cli/commands/deploy/app-id-lock.d.ts /** Lock file path, relative to the repository root. Created by `tailor setup`. */ export declare const TAILOR_LOCK_FILENAME = ".github/tailor.lock"; /** * Current lock schema version. Version 2 added `appIds`; a lock carrying it * must not be rewritten by a tool that would drop the section. */ export declare const TAILOR_LOCK_VERSION = 2; /** App ids recorded in the lock, keyed by repository-relative config path. */ export type AppIds = Readonly>; /** The `appIds` section of a repository's lock file. */ export type AppIdLock = { /** Repository root: the directory that holds `.github/tailor.lock`. */ root: string; appIds: AppIds; }; /** * Validate the `appIds` section of a lock file. * * Every key must be a repository-relative config path and every value a UUID. * Two configs must not share one id: that is the copied-config accident the * lock exists to prevent, so it is rejected instead of deployed. * @param value - The raw `appIds` value, or undefined when the lock has none * @returns The validated section (empty when absent) */ export declare function parseAppIds(value: unknown): AppIds; /** * Locate the lock file that governs a config: the nearest `.github/tailor.lock` * in the config's directory or one of its ancestors, without leaving the * repository the config belongs to. That is the root setup records against * when it runs from that directory. * @param configPath - Absolute path to the config file * @returns The lock, or null when no ancestor directory inside the repository has one */ export declare function findAppIdLock(configPath: string): AppIdLock | null; /** * How a command may treat a config whose id is not yet recorded. * * - `write`: local runs that may record, adopt, or generate ids * - `read`: local read-only runs; a missing id is a warning * - `require`: CI; a missing id is an error, since a fresh id per run would * make every run a separate application */ export type AppIdPlanMode = "write" | "read" | "require"; /** One config to resolve: its path and the id its module evaluates to. */ export type AppIdEntryInput = { configPath: string; configId: string | undefined; }; /** The resolved id of one config and where it came from. */ export type AppIdEntry = { configPath: string; key: string; id: string | undefined; source: "lock" | "config" | "generated" | "none"; /** The config still carries the id; remove it once the lock is written. */ removeConfigId: boolean; }; /** The `appIds` section after resolving a batch of configs. */ export type AppIdPlan = { appIds: Record; /** Whether `appIds` differs from the lock it was planned against. */ changed: boolean; /** One entry per input, in input order. */ entries: AppIdEntry[]; }; export type PlanAppIdsParams = { lock: AppIdLock; entries: readonly AppIdEntryInput[]; mode: AppIdPlanMode; }; /** * Decide the app id of every config in a batch against one lock file. * * Precedence per config: the lock entry, then the id the config evaluates to, * then a generated id. A config whose id disagrees with its lock entry is an * error, since neither value can be chosen mechanically. Reads nothing but the * lock passed in and the existence of the files its entries name; the caller * persists the returned `appIds`. * @param params - The lock, the configs to resolve, and the mode * @returns The resolved entries and the `appIds` section to persist */ export declare function planAppIds(params: PlanAppIdsParams): Promise; /** Result of {@link removeAdoptedConfigIds}. */ export type RemoveAdoptedConfigIdsResult = { /** Whether at least one config file was edited. */ configEdited: boolean; }; /** * Remove the `id` from every config whose id the plan moved into the lock. * Call it after the lock has been written, so the id is never held nowhere. * A config shape that cannot be edited is reported with a manual-edit hint. * @param plan - A plan produced in `write` mode * @returns Whether any config was edited */ export declare function removeAdoptedConfigIds(plan: AppIdPlan): Promise; //#endregion