/** * Registry hygiene primitives shared by encounter registration, the registry * row mapper, and `cleo nexus projects clean`. * * Two facts live here so every caller agrees on them: * * 1. **Which paths are ephemeral.** A project under the OS temp directory (or * `/tmp`, `/var/tmp`) is a fixture, a scratchpad, or a one-off experiment. * Auto-registering it into a persistent global registry is how the owner's * registry reached 1,137 rows of which ~1,096 were test/temp directories. * 2. **Where a registered project's live store is.** Post-E6 (ADR-068) every * project domain lives in `/.cleo/cleo.db`; the registry's * `tasks_db_path` / `brain_db_path` columns kept naming the pre-migration * `tasks.db` / `brain.db` files, which are empty relics in a migrated * project. * * @task T12324 */ /** * Platform facts for temp-path classification. Defaults to the running host; * tests inject another platform's temp dir to cover Windows and macOS layouts. */ export interface EphemeralPathEnv { /** Platform whose path rules apply. @defaultValue `process.platform` */ platform?: NodeJS.Platform; /** OS temp directory. @defaultValue `os.tmpdir()` */ tmpdir?: string; } /** * Return the directories whose descendants are treated as ephemeral: the OS * temp directory plus, off Windows, `/tmp` and `/var/tmp`. Filesystem roots are * never returned, so a misconfigured `TMPDIR=/` cannot classify everything. * * @param env - Platform/temp-dir overrides. @defaultValue the running host * @returns Absolute lexical and physical forms of each temp root. */ export declare function getEphemeralRoots(env?: EphemeralPathEnv): string[]; /** * Report whether `p` is (or lies under) an ephemeral temp root. * * Containment is decided with `path.relative`, never substring matching, so * `C:\Users\me\AppData\Local\Temp\x` is caught on Windows (case-insensitive) * and `/tmpfoo` is not mistaken for `/tmp` (T12606). * * @param p - Path to classify; need not exist. * @param env - Platform/temp-dir overrides. @defaultValue the running host * @returns `true` when any form of `p` is inside a root from {@link getEphemeralRoots}. * @example * ```ts * isEphemeralPath(join(tmpdir(), 'fixture')); // true * ``` */ export declare function isEphemeralPath(p: string, env?: EphemeralPathEnv): boolean; /** * Decide whether encountering `projectRoot` may auto-register it into the * registry homed at `cleoHome`. * * An ephemeral project is refused only when the registry is persistent: a * sandboxed test run (temp `CLEO_HOME`) still registers its temp fixtures, but * a scratch directory never lands in the owner's real registry. Explicit * `cleo nexus register` is unaffected. * * @param projectRoot - Encountered project root. * @param cleoHome - Global home that owns the target registry. * @returns `true` when encounter registration should proceed. */ export declare function shouldAutoRegisterProject(projectRoot: string, cleoHome: string): boolean; /** * Return the live consolidated store path for a registered project root. * * @param projectRoot - Absolute project root recorded in the registry. * @returns `/.cleo/cleo.db`. */ export declare function registryStorePath(projectRoot: string): string; /** * Map a stored `tasks_db_path` / `brain_db_path` value to the live store. * * Rows written before T12324 name `.cleo/tasks.db` or `.cleo/brain.db`; those * are rewritten to the sibling `.cleo/cleo.db`. Any other value (including * `null`) is returned unchanged so a deliberate override is never hidden. * * @param stored - Value read from the registry row. * @returns The live store path, or `stored` when it is not a legacy path. */ export declare function normalizeRegistryStorePath(stored: string | null): string | null; //# sourceMappingURL=registry-hygiene.d.ts.map