/** * Lock file I/O and integrity verification (schema v3). * * The lock file (skaile.lock.yaml) captures the complete resolved state: every * asset keyed by its canonical ref `:@/#`, the * upstream source + commit it resolved from, a per-file + composite content * hash for drift detection, and whether an `overrides[]` entry pinned it. A * top-level `sources:` block records every contributing source URL at its * resolved commit. * * Old v1 lockfiles (`lockfile_version: 1`, `repositories:`) are rejected with a * clear regenerate-from-scratch error. */ import type { LockFile, LockPluginEntry } from "./models.js"; import type { ProvenanceCandidate } from "./walker.js"; /** * Serialize a `LockFile` to YAML and write it to disk. * * @param lockPath - Absolute path to write the lock file (e.g. `skaile.lock.yaml`) * @param data - Lock file data to serialize * @docLink packages/core/api-reference#write-lock */ export declare function writeLock(lockPath: string, data: LockFile): void; /** * Read and parse a lock file from disk. * * @param lockPath - Absolute path to the lock file * @returns Parsed `LockFile`, or `null` if the file is missing or unparseable * @throws When the file is a legacy v1 lock — the shape changed and it must be regenerated. * @docLink packages/core/api-reference#read-lock */ export declare function readLock(lockPath: string): LockFile | null; /** * Compute the SHA-256 hash of a file's content (hex digest, no prefix). * * @param filePath - Absolute path to the file * @returns Hex-encoded SHA-256 hash string * @docLink packages/core/api-reference#compute-hash */ export declare function computeHash(filePath: string): string; /** * Build a v3 `LockFile` from the resolver's output. * * Assets are keyed by canonical ref `:@/#`; the * top-level `sources:` block lists every contributing source URL pinned to its * resolved commit. * * @param resolved - Resolved provenance candidates (the resolver's `resolved` array). * @param overridesApplied - Canonical refs that an `overrides[]` entry pinned. * @returns Complete v2 `LockFile` ready for serialization. * @docLink packages/core/api-reference#build-lock-file */ export declare function buildLockFile(resolved: ProvenanceCandidate[], overridesApplied: Set): LockFile; /** * Read the `plugins` slice from a project's `skaile.lock.yaml`. * * Total — never throws on a missing/unparseable/legacy lock file (returns * `undefined`). The plugin-store reconciler folds this into its reconcile-hash * so a lock edit invalidates the hash even without a manifest change. * * @param projectDir - Project root containing `skaile.lock.yaml` * @returns The `plugins` record, or `undefined` when absent */ export declare function readPluginsLockSlice(projectDir: string): Record | undefined; /** * Merge a `plugins` slice into a project's `skaile.lock.yaml`, preserving all * other fields. Creates a minimal v3 lock file when none exists (or the * existing one is an outdated schema that can't be read). * * @param projectDir - Project root containing `skaile.lock.yaml` * @param slice - The `plugins` record to persist */ export declare function writePluginsLockSlice(projectDir: string, slice: Record): void; /** * Result of verifying a lock file against the current repository state. * @docLink packages/core/api-reference#verify-result */ export interface VerifyResult { /** `true` when no drift or missing assets were found. */ ok: boolean; /** Canonical refs whose content hash no longer matches. */ drifted: string[]; /** Canonical refs whose files cannot be found on disk. */ missing: string[]; } /** * Verify a v2 lock file against the current on-disk source clones. * * For each locked asset, resolve its source clone directory via `resolveCloneDir` * (URL → on-disk path), re-hash the recorded files, and compare the recomputed * composite against the locked `sha256`. Reports assets whose hash changed * (`drifted`) and assets whose files are missing (`missing`). * * @param lock - Previously generated v2 `LockFile`. * @param resolveCloneDir - Maps a source URL to its on-disk clone root (or null). * @returns `VerifyResult` indicating drift and missing assets. * @docLink packages/core/api-reference#verify-lock */ export declare function verifyLock(lock: LockFile, resolveCloneDir: (sourceUrl: string) => string | null): VerifyResult; //# sourceMappingURL=lock.d.ts.map