Skip to content

rereel hydrate

Restores the media/ directory of a bundle from rereel.lock.json. Files that are already present with the correct SHA-256 are left alone. build runs the same logic automatically, so you only need hydrate when you want the media without rendering.

Terminal window
rereel hydrate <reel_dir> [--template-dir <dir>] [--offline] [--storage-config <path>]
  1. Reads <reel_dir>/rereel.json (exit 2 if missing) and the lockfile named by lockFile (default rereel.lock.json). A missing lockfile is treated as empty.
  2. For each lock item, with dest = <reel_dir>/<key>:
    • source: "template": counted as templateStatic. If --template-dir is given, <template-dir>/<templateRel> exists, and dest does not exist, the file is copied. Template items are not SHA-verified.
    • dest exists and its SHA-256 equals sha256: counted as cached.
    • --offline: fails immediately (exit 1) with relPath and uri in the error details.
    • No uri: fails (exit 1).
    • Otherwise: calls resolve() on the item’s provider (or the default provider if the item has none) to write dest, then re-hashes the file. A missing file or a SHA-256 mismatch fails with exit 1. Counted as fetched.

See SHA-256 verification for details.

Flag Type Default Description
<reel_dir> path (positional) — (required) Bundle directory.
--template-dir path — Template root used to copy source: "template" items. Without it, template items are only counted.
--offline flag off Never contact storage. Any storage item that is missing or has a different hash is an error.
--storage-config path lookup rules Storage configuration file.
{
"status": "hydrated",
"reelDir": "/abs/path/reels/ep01",
"total": 12,
"fetched": 3,
"cached": 8,
"templateStatic": 1
}
Key Description
total Number of lock items (all sources).
fetched Items downloaded/copied from a provider and verified.
cached Storage items already present with a matching SHA-256.
templateStatic Items with source: "template", whether or not they were copied.
Code When
0 All storage items present and verified.
1 Offline miss, item without uri, provider did not write the file, SHA-256 mismatch, or local-cache object not found. Error details may include relPath, uri, expected, actual.
2 Missing <reel_dir> argument, missing/invalid rereel.json or lockfile JSON, unknown provider, invalid s3:// URI, missing S3 credentials, command provider without resolveCommand.
3 A resolveCommand executable could not be spawned.
4 Remote fetch failed (HTTP/S3 non-2xx, resolveCommand non-zero exit or no usable file).

Restore media after a fresh git clone:

Terminal window
rereel hydrate ./reels/ep01

CI check that every asset is already on disk (no network):

Terminal window
rereel hydrate ./reels/ep01 --offline || echo "media not hydrated"

Example SHA mismatch error:

{"status":"error","code":1,"error":"SHA-256 mismatch for media/bg_1a2b3c4d.png: expected 1a2b…, got 77ef…","relPath":"media/bg_1a2b3c4d.png","uri":"s3://my-video-assets/rereel/1a/1a2b….png","expected":"1a2b…","actual":"77ef…"}