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

# repost schema fmt

> Format .repost files in place, or check formatting in CI with --check.

`repost schema fmt` rewrites `.repost` files into the canonical format: two-space indentation, aligned field types, and aligned attributes. Formatting is idempotent, and every example in these docs is `fmt` output.

## Usage

```bash theme={"languages":{"custom":["/languages/repost.json"]}}
repost schema fmt [path] [options]
```

The optional `path` is a `.repost` file or a directory of them; with none, the discovered schema is formatted.

## Options

| Option    | Description                                                 |
| --------- | ----------------------------------------------------------- |
| `--check` | Don't write. Exit `1` if any file is not already formatted. |

## Behavior and exit codes

In normal mode, files are rewritten and the command exits `0` whether or not anything changed; only a file with syntax errors makes it exit `1`, after printing ``could not format `<file>`: it has syntax errors``. In `--check` mode, any file that would change prints `would reformat: <path>` and the command exits `1` with `<n> file(s) are not formatted`, leaving every file untouched.

## Examples

```bash theme={"languages":{"custom":["/languages/repost.json"]}}
repost schema fmt
```

```text theme={"languages":{"custom":["/languages/repost.json"]}}
Formatted 1 file(s):
  repost/schema.repost
```

In CI:

```bash theme={"languages":{"custom":["/languages/repost.json"]}}
repost schema fmt --check
```

```text theme={"languages":{"custom":["/languages/repost.json"]}}
All 1 file(s) already formatted.
```

## Continue

<Columns cols={3} className="gap-y-4">
  <Card title="validate" icon="check" href="/docs/cli/schema/validate" cta="Validate" arrow="true">
    The companion correctness check.
  </Card>

  <Card title="Defining events" icon="braces" href="/docs/send/schema" cta="Schema" arrow="true">
    The language this formatter canonicalizes.
  </Card>

  <Card title="generate" icon="cog" href="/docs/cli/schema/generate" cta="Generate" arrow="true">
    Turn the formatted schema into clients.
  </Card>
</Columns>
