/** * backup-pack.ts — Bundle creation for .cleobundle.tar.gz portability. * * Implements the pack side of the T311 export/import lifecycle. Packs * project and/or global CLEO databases plus JSON config files into a * .cleobundle.tar.gz archive with a manifest, JSON Schema, per-file * SHA-256 checksums, and optional AES-256-GCM encryption. * * Archive layout (§2 of T311 spec): * manifest.json — FIRST entry (streaming inspect) * schemas/manifest-v1.json — bundled JSON Schema * databases/ — VACUUM INTO snapshots of in-scope DBs * json/ — config.json, project-info.json, project-context.json * global/ — global-salt (scope global|all) * checksums.sha256 — GNU sha256sum format, covers all except manifest.json * * @task T347 * @epic T311 * @why ADR-038 — portable cross-machine backup. Packs project + global DBs * into a .cleobundle.tar.gz with manifest, checksums, and optional encryption. * @what Implements the pack side of the export/import lifecycle. * @module store/backup-pack */ import type { BackupManifest, BackupScope } from '@cleocode/contracts'; /** * Input parameters for {@link packBundle}. * * @task T347 * @epic T311 */ export interface PackBundleInput { /** Export scope — determines which tiers and files are included. */ scope: BackupScope; /** Absolute path to the project root. Required for 'project' and 'all' scopes. */ projectRoot?: string; /** Target bundle path, e.g. /tmp/myproject-20260408.cleobundle.tar.gz */ outputPath: string; /** Enable AES-256-GCM encryption. Requires passphrase. */ encrypt?: boolean; /** Required when encrypt=true. */ passphrase?: string; /** Optional label written into manifest.backup.projectName. */ projectName?: string; } /** * Result of a successful {@link packBundle} call. * * @task T347 * @epic T311 */ export interface PackBundleResult { /** Absolute path to the written bundle file. */ bundlePath: string; /** Byte size of the final bundle file on disk. */ size: number; /** Fully-populated manifest that was written into the bundle. */ manifest: BackupManifest; /** Number of data files staged (excludes manifest.json, checksums.sha256, and schema). */ fileCount: number; } /** * Pack a CLEO backup bundle. * * Creates a `.cleobundle.tar.gz` (or `.enc.cleobundle.tar.gz`) containing * VACUUM INTO snapshots of all in-scope databases, JSON config files, * the global-salt (for global/all scopes), a manifest.json, a bundled JSON * Schema, and a GNU-format checksums.sha256 file. * * The manifest.json is always written as the first tar entry to enable * efficient streaming inspection without reading the full archive (ADR-038 §1). * * @param input - Pack options (scope, paths, encryption). * @returns Result containing bundle path, size, manifest, and file count. * @throws {Error} If encrypt=true but no passphrase is provided. * @throws {T310MigrationRequiredError} If the project is on the pre-T310 topology. * * @task T347 * @epic T311 * * @example * ```typescript * const result = await packBundle({ * scope: 'project', * projectRoot: '/my/project', * outputPath: '/tmp/my-project-20260408.cleobundle.tar.gz', * }); * console.log(result.bundlePath, result.size); * ``` */ export declare function packBundle(input: PackBundleInput): Promise; //# sourceMappingURL=backup-pack.d.ts.map