/** * Relocation tombstone — `/.cleo-moved.json` (T12558). * * `cleo project reroot` renames `.cleo/` out of the old root. Without a marker, * the next command run there (or after `git checkout -- .` restores the tracked * `.cleo/` files) would resolve the old root as a project and silently create * an EMPTY store: every read then answers "no tasks" with `success: true`. The * tombstone lets project resolution refuse with `E_PROJECT_MOVED` and name the * new root instead. * * A tombstone is a plain file, so it can be committed, copied or forged. It is * honoured ONLY when it is provably current ({@link readValidProjectTombstone}); * anything else is ignored with a `W_TOMBSTONE_IGNORED` warning, so a stray or * committed tombstone can never brick a clone. * * Leaf module: imported by project-scope resolution and the store guard. * * @task T12558 */ import type { ProjectMovedTombstone } from '@cleocode/contracts'; import { CleoError } from './errors.js'; /** File name of the tombstone, directly in the old project root. */ export declare const PROJECT_TOMBSTONE_FILE = ".cleo-moved.json"; /** * Enable or disable the `E_PROJECT_MOVED` refusal in project-root resolution. * * @param enabled - `false` lets resolution fall through as if no tombstone * existed (diagnostic commands only). * * @example * ```ts * setProjectMovedRefusal(false); // `cleo doctor …` * ``` */ export declare function setProjectMovedRefusal(enabled: boolean): void; /** * Whether project-root resolution currently refuses at a tombstoned root. * * @returns `true` unless {@link setProjectMovedRefusal} turned it off. */ export declare function isProjectMovedRefusalEnabled(): boolean; /** * Read the tombstone at `root` as written, without validating it. * * @param root - Directory that may once have held a project. * @returns The tombstone, or `null` when absent or unparseable. * * @example * ```ts * const raw = readProjectTombstone('/work/mono'); * ``` */ export declare function readProjectTombstone(root: string): ProjectMovedTombstone | null; /** * `true` when `inner` is strictly inside `outer`, compared through symlinks. * * @param outer - Containing directory. * @param inner - Candidate descendant. * @returns Whether `inner` is a proper descendant of `outer`. */ export declare function isStrictlyInsideDir(outer: string, inner: string): boolean; /** * Read the tombstone at `root` and return it only when it is provably current. * A present but invalid tombstone (committed to git, copied with a clone, * stale after the project moved again, or forged) is ignored and reported as * a `W_TOMBSTONE_IGNORED` warning. * * @param root - Directory that may once have held a project. * @returns The tombstone when valid, else `null`. * * @example * ```ts * const moved = readValidProjectTombstone(root); * if (moved) throw projectMovedError(root, moved); * ``` */ export declare function readValidProjectTombstone(root: string): ProjectMovedTombstone | null; /** * Write the tombstone at `root` atomically (tmp + rename). * * @param root - The old project root. * @param tombstone - Where the project went. * @returns Absolute path of the tombstone. * * @example * ```ts * writeProjectTombstone(oldRoot, { projectId, movedTo: child, at: new Date().toISOString() }); * ``` */ export declare function writeProjectTombstone(root: string, tombstone: ProjectMovedTombstone): string; /** What proved the relocation: the tombstone, or the registry alone. */ export type ProjectMovedEvidence = 'tombstone' | 'registry'; /** * The `E_PROJECT_MOVED` refusal for a command that resolved to `root`. * * @param root - The old root the command resolved to. * @param moved - Where the project went. * @param from - Directory the command started in, when it is below `root` * (a would-be new project there gets its own remedy). * @param via - What proved the move; the remedy differs (only a tombstone can * be deleted). * @returns A {@link CleoError} with exit `PROJECT_MOVED`, a `cd` fix and * `details.movedTo`. * * @example * ```ts * throw projectMovedError(root, tombstone); * ``` */ export declare function projectMovedError(root: string, moved: Pick, from?: string, via?: ProjectMovedEvidence): CleoError; //# sourceMappingURL=project-tombstone.d.ts.map