# cavs — packaging CLI

The `cavs` binary turns files and game builds into deduplicated, verifiable
`.cavs` files, inspects and verifies them, reconstructs them byte-for-byte, and
manages the global content-addressable store.

## How it works

`cavs pack --raw` splits inputs into FastCDC chunks (~64 KiB), deduplicates
them, compresses each with zstd, and writes a `.cavs` container with a chunk
table, a Merkle root over the content, per-file SHA-256, and an optional
Ed25519 signature. Reconstruction (`unpack`) verifies every chunk and produces
the original files exactly. The video mode (without `--raw`) segments inputs
with ffmpeg first, then packages the segments.

## Commands

```sh
# Package (game assets / arbitrary files)
cavs pack --raw build_v42.pck -o v42.cavs
cavs pack --raw --sign-key publisher.key data/* -o release.cavs   # signed
cavs pack --raw --mode screen capture.bin -o capture.cavs         # aggressive CDC

# Package video (needs ffmpeg on PATH)
cavs pack movie.mp4 -o movie.cavs --segment-time 4

# Inspect / verify / reconstruct
cavs info v42.cavs                       # structure, dedupe, compression
cavs verify v42.cavs --pubkey key.pub    # chunk hashes + Merkle + signature
cavs unpack v42.cavs -o restored/        # exact reconstruction
cavs play movie.cavs                     # reconstruct to temp and play (ffplay)

# Signing keys (Ed25519)
cavs keygen -o publisher.key             # → publisher.key (+ .pub)

# Global store (dedup at rest across versions/titles)
cavs store ./store add game_v1 game_v1.cavs
cavs store ./store add game_v2 game_v2.cavs   # shared chunks stored once
cavs store ./store stat                        # storage savings
cavs store ./store rm  game_v1                 # unpublish
cavs store ./store gc  --grace 0               # reclaim unreferenced chunks
```

Run `cavs --help` or `cavs <command> --help` for all options.

## Requirements

Nothing extra for `--raw` (game asset) mode. `ffmpeg`/`ffplay` on `PATH` only
for the video mode.
