import { copyDirectory, copySingleFile, dirExists, ensureDir, fileExists } from '../../../fs/io.js';
export type ExecFileResult = {
    stdout: string;
    stderr: string;
};
export type ExecFileLike = (file: string, args: string[], options?: {
    cwd?: string;
    env?: NodeJS.ProcessEnv;
}) => Promise<ExecFileResult>;
export interface EnsureS3ArchiveAccessOptions {
    mode: 'completion' | 'sync';
    s3Uri?: string | null;
    syncOnComplete: boolean;
    /**
     * AWS profile to apply for this archive op (typically resolved from
     * `archive.awsProfile` config or a `--profile` flag). When non-empty, this
     * value clobbers any `AWS_PROFILE` already present in the parent env: an
     * explicit OAT-archive-scoped profile is treated as deliberate intent and
     * wins over ambient shell state. An empty/unset value leaves the parent env
     * untouched.
     */
    awsProfile?: string | null;
    /**
     * AWS region to apply for this archive op. Same clobber-on-explicit-value
     * semantics as `awsProfile`.
     */
    awsRegion?: string | null;
}
interface EnsureS3ArchiveAccessDependencies {
    execFile?: ExecFileLike;
    env?: NodeJS.ProcessEnv;
}
export interface EnsureS3ArchiveAccessResult {
    ok: boolean;
    warnings: string[];
}
export interface ArchiveProjectOnCompletionOptions {
    repoRoot: string;
    projectPath: string;
    projectName: string;
    projectsRoot: string;
    s3Uri?: string | null;
    s3SyncOnComplete: boolean;
    summaryExportPath?: string | null;
    /**
     * Config-only AWS profile (`archive.awsProfile`). The completion path has no
     * flag override. When non-empty, this value clobbers any parent-env
     * `AWS_PROFILE` — repo-scoped archive config is treated as deliberate intent
     * and wins over ambient shell state.
     */
    awsProfile?: string | null;
    /**
     * Config-only AWS region (`archive.awsRegion`). Same clobber-on-explicit-value
     * semantics as `awsProfile`.
     */
    awsRegion?: string | null;
}
export interface ResolvePrimaryRepoRootDependencies {
    gitExecFile?: ExecFileLike;
    dirExists?: typeof dirExists;
    env?: NodeJS.ProcessEnv;
}
export interface ResolveArchiveProjectTargetOptions {
    repoRoot: string;
    projectsRoot: string;
    projectName: string;
}
export interface ResolveArchiveProjectTargetDependencies extends ResolvePrimaryRepoRootDependencies {
    timestamp?: () => string;
}
export interface ArchiveProjectTarget {
    archiveProjectPath: string;
    archiveRepoRoot: string;
    archivePath: string;
    archivePathIsGitignored: boolean;
    primaryRepoRoot: string | null;
    primaryRepoRootAvailable: boolean;
    localOnlyWarning: string | null;
}
interface ArchiveProjectOnCompletionDependencies extends EnsureS3ArchiveAccessDependencies, ResolvePrimaryRepoRootDependencies {
    ensureS3ArchiveAccess?: typeof ensureS3ArchiveAccess;
    execFile?: ExecFileLike;
    ensureDir?: typeof ensureDir;
    copyDirectory?: typeof copyDirectory;
    removePath?: (target: string, options: {
        recursive: true;
        force: true;
    }) => Promise<void>;
    copySingleFile?: typeof copySingleFile;
    fileExists?: typeof fileExists;
    timestamp?: () => string;
}
export interface ArchiveProjectOnCompletionResult {
    archivePath: string;
    s3Path: string | null;
    summaryExportFile: string | null;
    warnings: string[];
}
export declare const ARCHIVE_SNAPSHOT_METADATA_FILENAME = ".oat-archive-source.json";
/**
 * Directories excluded from S3 archive sync. These contain process artifacts
 * (reviews, PR descriptions) rather than project deliverables.
 */
export declare const S3_ARCHIVE_SYNC_EXCLUDES: string[];
export interface ArchiveSnapshotMetadata {
    projectName: string;
    snapshotName: string;
}
/**
 * Build the env passed to every `aws` spawn in this module.
 *
 * Clobber-on-explicit-value merge: a non-empty value in `opts` overwrites the
 * parent env entry. The merge treats an explicitly supplied profile/region as
 * deliberate OAT-archive-scoped intent that wins over ambient shell state —
 * setting `archive.awsProfile` (or passing `--profile`) means "use this for
 * archive ops, regardless of what AWS_PROFILE is in the shell." Empty or
 * whitespace-only values in `opts` are treated as unset and leave the parent
 * env entry alone, so the AWS CLI's own resolution chain (incl. shell
 * AWS_PROFILE) takes over when neither config nor flag has spoken.
 *
 * Exported as a package-internal helper so the archive sync command (which
 * also spawns `aws`) can produce the same env shape without duplicating this
 * logic. This symbol is **not** part of the public package surface — keep
 * usage limited to files inside `commands/project/archive/`.
 */
export declare function buildAwsEnv(parentEnv: NodeJS.ProcessEnv, opts: {
    awsProfile?: string | null;
    awsRegion?: string | null;
}): NodeJS.ProcessEnv;
export declare function buildRepoArchiveS3Uri(s3Uri: string, repoRoot: string): string;
export declare function buildProjectArchiveS3Uri(s3Uri: string, repoRoot: string, projectKey: string): string;
export declare function buildArchiveSnapshotName(projectName: string, timestamp: string): string;
export declare function parseArchiveSnapshotName(snapshotName: string): {
    projectName: string;
    snapshotName: string;
    dateStamp: string | null;
};
export declare function resolveLocalArchiveProjectPath(projectsRoot: string, projectName: string): string;
export declare function resolvePrimaryRepoRoot(repoRoot: string, dependencies?: ResolvePrimaryRepoRootDependencies): Promise<string>;
export declare function resolveArchiveProjectTarget(options: ResolveArchiveProjectTargetOptions, dependencies?: ResolveArchiveProjectTargetDependencies): Promise<ArchiveProjectTarget>;
export declare function assertDurableArchiveProjectTarget(target: ArchiveProjectTarget): void;
export declare function archiveProjectOnCompletion(options: ArchiveProjectOnCompletionOptions, dependencies?: ArchiveProjectOnCompletionDependencies): Promise<ArchiveProjectOnCompletionResult>;
export declare function ensureS3ArchiveAccess(options: EnsureS3ArchiveAccessOptions, dependencies?: EnsureS3ArchiveAccessDependencies): Promise<EnsureS3ArchiveAccessResult>;
export {};
//# sourceMappingURL=archive-utils.d.ts.map