# registry compile

Compile registry artifacts

Canonical URL: https://docs.paradoc.dev/cli/commands/registry/compile/

Compile a registry: validate each source file, compute checksums, and write `registry.json` and a folder for each release.

## Usage

```bash
paradoc registry compile [options]
```

## Options

| Option                | Description                                                                                      |
| --------------------- | ------------------------------------------------------------------------------------------------ |
| `-c, --config <path>` | Path to registry.config.json (default: `./registry.config.json`)                                 |
| `-o, --output <path>` | Output directory for `registry.json` and the release folders (default: the folder of the config) |
| `--dry-run`           | Show what would be compiled without writing files                                                |

## Description

Reads `registry.config.json` and validates each source file it lists. Each source file is one release. Compile writes each release as JSON to `<name>/<edition>/<version>/<name>.json`, or to `<name>/<version>/<name>.json` for an artifact with no editions, and copies the files the artifact references beside it. It refreshes the SHA256 checksum of each referenced file in the artifact.

It then writes `registry.json`, the manifest. The manifest lists every edition and version of every artifact, with the path and SHA-256 of each release file. Host the output directory as it is. Do not edit `registry.json` by hand; change the config or the source files and compile again.

### Default edition and version

Compile states the default release of each artifact in the manifest:

* `latestVersion` is the highest version that is not a pre-release.
* `currentEdition` is the only edition when there is one. With more, it is the edition that started last and not after today. An edition starts on its `effectiveFrom`, or on its `date` when it has no `effectiveFrom`.

To state another default, set `defaults.<name>` in `registry.config.json`. When the files cannot decide, compile fails and names the entry to set. See [Default edition and version](/concepts/registries#default-edition-and-version).

### Errors

Compile is all or nothing. It reports every problem, one line each, and writes no file when there is one. It also refuses to overwrite a source file.

## Examples

Compile with defaults:

```bash
paradoc registry compile
```

Compile to a separate output directory:

```bash
paradoc registry compile -o ./dist
```

Preview without writing:

```bash
paradoc registry compile --dry-run
```

## Output

```
Compiling registry: acme-forms
Output: /path/to/my-registry/dist

✔ residential-lease v1.0.0: compiled
✔ w4 2024 v1.0.0: compiled
✔ w4 2024 v1.1.0: compiled
✔ w4 2025 v1.0.0: compiled
✔ w9 v1.0.0: compiled
  residential-lease default: v1.0.0
  w4 default: 2025 v1.0.0
  w9 default: v1.0.0

Compiled 5 release(s) of 3 artifact(s) successfully
```

The output directory then holds:

```
dist/
├── registry.json
├── residential-lease/1.0.0/residential-lease.json
├── residential-lease/1.0.0/residential-lease-legal.md
├── w4/2024/1.0.0/w4.json
├── w4/2024/1.1.0/w4.json
├── w4/2025/1.0.0/w4.json
├── w9/1.0.0/w9.json
└── w9/1.0.0/w9.pdf
```

When a default cannot be chosen:

```
Compiling registry: acme-forms
Output: /path/to/my-registry/dist

✖ pet-policy: every version is a pre-release (2.0.0-beta.1), and a pre-release is the default only when the publisher says so. Set defaults["pet-policy"].latestVersion in registry.config.json

Nothing was written (1 error(s))
```

## See also

* [registry catalog](/cli/commands/registry/catalog) - Manage catalog items
* [registry make](/cli/commands/registry/make) - Create a registry
