# fix

Auto-fix common artifact issues

Canonical URL: https://docs.paradoc.dev/cli/commands/fix/

Fixes artifact metadata, such as computing and updating file checksums in layers and content references.

## Usage

```bash
paradoc fix <artifact> [options]
```

## Arguments

| Argument   | Description                      |
| ---------- | -------------------------------- |
| `artifact` | Artifact file (JSON/YAML) to fix |

## Options

| Option      | Description                                           |
| ----------- | ----------------------------------------------------- |
| `-y, --yes` | Accept all changes without prompting                  |
| `--dry-run` | Show what would be changed without modifying the file |

## Description

The `fix` command analyzes an artifact's file-backed layers and content references (`instructions`, `agentInstructions`) and:

1. Detects missing or invalid checksums
2. Computes the correct SHA-256 checksums from the referenced files
3. Interactively prompts you to approve each change
4. Updates the artifact file with the approved changes

This is useful after attaching new files to an artifact, when file contents have changed, or after manually adding `instructions` or `agentInstructions` content references.

## Examples

Fix an artifact interactively:

```bash
paradoc fix my-form.yaml
```

Accept all changes automatically:

```bash
paradoc fix my-form.yaml --yes
```

Preview changes without modifying:

```bash
paradoc fix my-form.yaml --dry-run
```

## Output

```
Changes detected:
  layers.pdf.checksum: (none) → sha256:abc123...
  instructions.checksum: (none) → sha256:def456...

? Select changes to apply:
  ◉ layers.pdf.checksum: (none) → sha256:abc123...
  ◉ instructions.checksum: (none) → sha256:def456...

Will change:
  layers.pdf.checksum: (none) → sha256:abc123...
  instructions.checksum: (none) → sha256:def456...

✓ Fixed artifact written to: my-form.yaml
```

## What it fixes

| Issue                        | Description                                                                              |
| ---------------------------- | ---------------------------------------------------------------------------------------- |
| Missing layer checksum       | Computes and adds SHA-256 checksum for file layers                                       |
| Invalid layer checksum       | Recomputes checksum when file contents have changed                                      |
| Missing content ref checksum | Computes and adds SHA-256 checksum for file-backed `instructions` or `agentInstructions` |
| Invalid content ref checksum | Recomputes checksum when content reference files have changed                            |

## See also

* [validate](/cli/commands/validate) - Check artifact validity
* [attach](/cli/commands/attach) - Attach files to artifacts

An artifact argument may be a file path or an installed `@namespace/name` reference from `.paradoc/lock.json`. An uninstalled reference fails with an error.

Checksum repair covers file layers, each file layer's font, instruction files, and files inside inline bundle members. A missing referenced file is reported and skipped.
