/** * File-lock wrapper for write-path commands (v0.9.3 P1-1 / Phase Q4). * * Concurrency invariant: at most one slaminar process may hold a write lock * on a given project root at a time. Two parallel `init`s on the same cwd * would otherwise race on `.slaminar/.bk/manifest.json` (see F6 in * docs/qa/fault-matrix.md and R4 in rollback tests) and lose backup records. * * Implementation: `proper-lockfile` creates `.slaminar/.lock` with OS-level * mkdir atomicity. Stale locks (pid dead) are reclaimed automatically. We * also auto-release on process exit. */ export interface ProjectLockOptions { /** How long to wait for an existing holder before failing. Default: 0 (fail fast). */ retries?: number; /** Milliseconds between retry attempts. Only used when retries > 0. */ minTimeout?: number; } export interface ProjectLockHandle { release: () => Promise; } /** * Acquire an exclusive lock on the project root for write operations. * * Throws a `ProjectBusyError` if another slaminar process is already * holding the lock (stale locks are reclaimed automatically). */ export declare function acquireProjectLock(root: string, options?: ProjectLockOptions): Promise; /** * Wrap a write operation with automatic lock acquire/release. Prefer this * over manual acquire/release to guarantee the lock is freed on throw. */ export declare function withProjectLock(root: string, fn: () => Promise, options?: ProjectLockOptions): Promise; /** * Synchronous variant for sync entry points (uninstall). proper-lockfile * exposes `lockSync` / `unlockSync` for this case. */ export declare function withProjectLockSync(root: string, fn: () => T): T; export declare class ProjectBusyError extends Error { readonly root: string; constructor(root: string, reason: string); }