/** * `cleo backup verify` core SDK โ€” per-DB freshness + integrity walker. * * Walks every entry in `DB_INVENTORY` (`@cleocode/contracts`) and reports * the freshest snapshot in BOTH the canonical backup directory * (`.cleo/backups/sqlite/` per T10315 / ADR-013 ยง10) and the legacy backup * directory (`.cleo/backups/snapshot/`, retained read-only for one * deprecation window). Each freshest snapshot is opened via * {@link openCleoDbSnapshot} (the canonical chokepoint, allowlisted under * `packages/core/src/store/**`) and verified with `PRAGMA integrity_check`. * * Verdict semantics live in {@link BackupVerifyVerdict}; the CLI verb's exit * code is driven directly by the `summary` returned here. * * @task T10319 * @epic T10284 * @saga T10281 */ import { type BackupVerifyResult } from '@cleocode/contracts'; /** * Options accepted by {@link runBackupVerify}. * * @public */ export interface BackupVerifyOptions { /** * Absolute path to the project root. Used to resolve `` in * `DB_INVENTORY` path templates and the canonical / legacy backup * directories under it. */ projectRoot: string; /** * Override for the global CLEO home (`$XDG_DATA_HOME/cleo/`). Defaults to * `getCleoHome()` from `@cleocode/paths`. Tests inject a tmp dir here. */ cleoHomeOverride?: string; /** * Reference timestamp (epoch ms) used to compute `dataLossEstimateHours`. * Defaults to `Date.now()`. Tests pin this for deterministic envelopes. */ nowMs?: number; /** * Per-DB integrity-check timeout in milliseconds. Default 30 000ms per the * T10319 acceptance criteria. When the check exceeds this budget the * snapshot is reported as `integrityOK: false` with an `error` of * `'integrity-check timed out'`. */ perDbTimeoutMs?: number; } /** * Walk every entry in `DB_INVENTORY`, find each role's freshest snapshot in * the canonical and legacy backup directories, verify integrity, and * return a structured {@link BackupVerifyResult}. * * @remarks * Read-only โ€” performs zero writes. The result's `summary` is the source * of truth for the CLI verb's exit code (`stale > 0 || corrupt > 0` โ†’ 1). * * @example Verify backups for the current project * ```typescript * import { runBackupVerify } from '@cleocode/core/store/backup-verify.js'; * * const result = runBackupVerify({ projectRoot: process.cwd() }); * for (const [role, report] of Object.entries(result.dbs)) { * console.log(role, report.verdict, report.dataLossEstimateHours); * } * ``` * * @public */ export declare function runBackupVerify(options: BackupVerifyOptions): BackupVerifyResult; //# sourceMappingURL=backup-verify.d.ts.map