//! Runner workspace synchronization.
//!
//! Materializes a controller-side source checkout into a deterministic remote
//! runner workspace, either by streaming a filtered snapshot tarball or by
//! shipping a git bundle / cloning the remote. Split into concern-focused
//! submodules; this module re-exports the surface consumed elsewhere in the
//! runner subsystem so the historical `workspace::*` paths keep resolving.

mod git;
mod materialized;
mod materializer;
mod pull;
mod snapshot;
mod sync;
mod types;
mod util;

pub use pull::{plan_workspace_pull, pull_workspace};
pub use sync::sync_workspace;
#[cfg(test)]
pub(crate) use sync::workspace_resource_lifecycle;
pub use sync::{list_workspaces, prune_workspaces, reap_run_workspace, workspace_snapshots};
pub use types::{
    ByteFileCounts, RunnerWorkspaceCurrentSummary, RunnerWorkspaceListEntry,
    RunnerWorkspaceListOutput, RunnerWorkspaceMaterializationContract,
    RunnerWorkspaceMaterializationPlan, RunnerWorkspaceOutputPaths, RunnerWorkspacePruneEntry,
    RunnerWorkspacePruneOptions, RunnerWorkspacePruneOutput, RunnerWorkspacePruneSkippedEntry,
    RunnerWorkspacePullOptions, RunnerWorkspacePullOutput, RunnerWorkspacePullPlan,
    RunnerWorkspaceSnapshotAppliedFilters, RunnerWorkspaceSnapshotEntry,
    RunnerWorkspaceSnapshotFilters, RunnerWorkspaceSnapshotsOutput, RunnerWorkspaceSyncMode,
    RunnerWorkspaceSyncOptions, RunnerWorkspaceSyncOutput,
};

pub(crate) use materialized::{MaterializedWorkspace, WorkspaceCleanupPolicy};
pub(crate) use materializer::{
    dependency_cache_manifest_command, dependency_cache_restore_command,
    dependency_cache_save_command,
};
pub(crate) use snapshot::{
    copy_snapshot_to_directory, effective_snapshot_excludes, local_snapshot_stats,
    materialize_snapshot, materialize_snapshot_git, snapshot_identity,
};
pub(crate) use types::{canonical_workspace_path, DEFAULT_EXCLUDES};
pub(crate) use util::{
    git_output, parent_remote_path, run_shell_capture, run_shell_command, sanitize_path_segment,
    shell_command_for_runner,
};

#[cfg(test)]
mod tests;
