> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diversion.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# archive

> Publish, list, and fetch binary archives tied to a commit

> [card] Preview feature
>
> Binary archives are currently a preview feature and may be enabled only on
> selected environments. Behaviour and command flags may change before general
> availability.

Archives let you attach a zip of binary artifacts (compiled engine builds, generated assets, packaged dependencies) to a specific commit and have anyone else fetch them on demand.

This is Diversion's equivalent of [Unreal Game Sync's Precompiled Binaries (PCBs)](https://dev.epicgames.com/documentation/en-us/unreal-engine/unreal-game-sync-ugs-for-unreal-engine) - but not Unreal-specific. Any zip can be published against any commit, and any collaborator can fetch it into the paths you configure. Archives are stored outside the repo history, so they do not bloat clones for users who do not need them.

For Unreal-specific guidance (publishing an editor build from a build machine and fetching it on a teammate's box), see [Binary distribution for Unreal Engine](../unreal/binary-distribution).

```bash theme={null}
dv archive [sub-command]
```

## publish

Uploads a zip archive and registers its metadata against the commit you are currently checked out at.

```bash theme={null}
dv archive publish <name> <zip_path> <unpack> [<unpack>...]
```

`<name>` is the archive identifier (for example `engine-binaries`). The same name should be reused across commits - think of it as a category, not a unique ID. Names are limited to 255 characters and cannot be whitespace-only.

`<zip_path>` is the local path to the zip file to upload. The path must be **absolute** - relative paths are rejected by the agent.

`<unpack>` declares where the archive should land when later fetched. Two forms are supported:

* `<dst>` - unpack the entire zip into `<dst>`.
* `<dst>=<src>` - unpack only the `<src>` sub-path from inside the zip into `<dst>`.

Multiple `<unpack>` arguments may be passed in a single call. Each `<dst>` must be unique. Paths follow these rules:

* `<dst>` is **relative to the workspace root** - no leading slash, no drive letters, no parent traversal (`..`).
* `<src>` uses **forward slashes** even on Windows (zip entries are POSIX-style). An empty `<src>` (or omitting the `=<src>` suffix) means "the root of the zip".
* Trailing slashes on either side are normalised; matching is by lexical prefix.

Example - publishing a UE editor build that splits `Engine/Binaries` and `Engine/Plugins` into the project's `Binaries/` and `Plugins/` directories:

```bash theme={null}
dv archive publish engine-binaries /builds/editor.zip Binaries/=Engine/Binaries/ Plugins/=Engine/Plugins/
```

On success the command prints `Published '<name>' from <commit> (sha=<blob-sha>)`.

### Constraints and behaviour

* The workspace must be **clean** (no uncommitted changes) when you publish. The archive is bound to the currently checked-out commit.
* Publishing the same `(<name>, commit)` pair twice is **not allowed**. The second publish returns a conflict error. To publish a new build for the same commit, use a different `<name>`.
* The zip is hashed and uploaded through Diversion's blob storage; uploads are deduplicated against blobs already present.
* Publishing requires **write access** to the repository.

## fetch

Downloads an archive that was published against a specific commit and unpacks it into the paths registered at publish time.

```bash theme={null}
dv archive fetch <name> --commit <commit>
```

`<name>` is the archive name used at publish time.

`--commit` is required and identifies the commit the archive was published against. Fetching by commit (rather than "latest") guarantees the binaries match the source state of that commit - there is no drift between code and binaries.

```bash theme={null}
dv archive fetch engine-binaries --commit dv.commit.1042
```

The command **blocks until the fetch completes** and renders progress in place - phase (`Downloading`, `Extracting`), bytes transferred / total, and a spinner. On success it prints `Fetched '<name>' from <commit>`.

### Constraints and behaviour

* Every `<dst>` registered for the archive must either **not exist** or be **empty** in the workspace before the fetch starts. If anything is present, the fetch is rejected and no files are written.
* The fetch streams into a staging directory under `.diversion/binary-archives/` and only moves files into place once the unpack succeeds. A failed fetch will not leave a half-populated `<dst>`.
* Pressing **Ctrl-C cancels the CLI**, but the underlying download continues on the agent until it terminates on its own. Re-running `dv archive fetch` while the previous job is still in flight will be rejected with a conflict.
* Fetching requires **read access** to the repository.

## list

Lists the archives that have been published in the current repository.

```bash theme={null}
dv archive list
```

Output is a table with one row per archive:

```
NAME             COMMIT           BLOB SHA     UNPACK
engine-binaries  dv.commit.1042   4f9d2ac1...  Binaries/=Engine/Binaries/,Plugins/=Engine/Plugins/
```

The `UNPACK` column is informational - the comma-separated form is not directly reusable as `publish` arguments (each unpack target is a separate argument on the command line).

## How this maps to UGS Precompiled Binaries

If you are coming from Unreal Game Sync, the mental model translates directly:

| UGS concept | `dv archive` equivalent |
| - | - |
| PCB set (a named category of binaries) | `<name>` argument to `publish` / `fetch` |
| Attaching a PCB to a changelist | `dv archive publish` against the currently checked-out commit |
| Syncing a CL and pulling the matching PCB | `dv archive fetch <name> --commit <commit>` |
| Hardcoded `Engine/Binaries` layout | `<unpack>` mappings - you decide where each archive lands |

Because `<unpack>` is configurable, archives also work outside Unreal: compiled native plugins, generated content packs, packaged dependencies, or any other large binary artifact you want pinned to a commit.

## Typical flow

1. A build machine (or a programmer) builds the binaries at commit `<X>`.

2. Zip the outputs and publish them while checked out at commit `<X>`:

   ```bash theme={null}
   dv archive publish engine-binaries /builds/editor.zip Binaries/=Engine/Binaries/ Plugins/=Engine/Plugins/
   ```

3. Anyone else runs:

   ```bash theme={null}
   dv archive fetch engine-binaries --commit <X>
   ```

   and gets a working environment without rebuilding.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.