Skip to main content

Crate lds_pack

Crate lds_pack 

Source
Expand description

Pack a whole project into one portable archive, and put it back.

An lds pack is not a source tarball and not a git bundle. It carries the project as it actually exists on the machine:

  • the .git directory itself, copied wholesale — so stashes, the reflog, local-only branches, and objects no ref points at all come along. A bundle is assembled from an enumerated set of refs, and everything outside that set is quietly left behind; copying the directory means there is no set to enumerate and nothing to forget.
  • the untracked local state that ordinarily never leaves the machine: a workspace/ tree, journal databases, sandbox snapshots, .mcp.json, .claude/.

Three things are treated specially:

treatment
secrets (.env, *.pem, …)not packed, reported instead — moving credentials is the operator’s own business
caches (target/, node_modules/, …)not packed, recorded — regenerable by definition
symlinkspacked as links, never followed; reported so a restore elsewhere can name what dangles

.claude/ is its own layer: packed verbatim, with its links counted and their shared roots summarized rather than enumerated one by one.

§Example

use lds_pack::{CreateOptions, RestoreOptions, create, restore};

let report = create(&CreateOptions::new("/path/to/proj", "proj.pack", "0.13.3"))?;
println!("packed {} files", report.manifest.stats.file_count);

let restored = restore(&RestoreOptions::new("proj.pack", "/tmp/proj"))?;
if restored.needs_attention() {
    println!("{} symlinks dangle here", restored.dangling_symlinks.len());
}

Re-exports§

pub use create::CreateOptions;
pub use create::CreateReport;
pub use create::DEFAULT_COMPRESSION_LEVEL;
pub use create::create;
pub use error::PackError;
pub use inspect::inspect;
pub use inspect::list_payload_paths;
pub use inspect::verify;
pub use manifest::ClaudeInfo;
pub use manifest::MANIFEST_NAME;
pub use manifest::Manifest;
pub use manifest::PACK_FORMAT_VERSION;
pub use manifest::SkipRecord;
pub use manifest::Stats;
pub use manifest::SymlinkRecord;
pub use manifest::WorktreeRecord;
pub use restore::RestoreOptions;
pub use restore::RestoreReport;
pub use restore::restore;
pub use rules::DEFAULT_CACHE_DIRS;
pub use rules::DEFAULT_KEEP;
pub use rules::DEFAULT_SECRET_GLOBS;
pub use rules::PackRules;
pub use rules::RuleOverrides;
pub use scan::Scan;
pub use scan::scan;
pub use scan::scan_with;

Modules§

create
Archive creation: classify the project, then write pack.toml followed by the payload into a zstd-compressed tar stream.
error
Error type for pack creation, inspection, and restore.
inspect
Read a pack’s manifest without unpacking it.
manifest
pack.toml — the manifest carried at the head of every .pack archive.
restore
Restore a pack into a directory, then repair what a plain extract leaves broken and report what the pack could not carry.
rules
Classification rules: which file names are secrets, which directories are caches, and which of those the operator wants carried anyway.
scan
Classification pass: decide, for every path under the project root, whether it travels in the pack, is dropped, or is merely reported.