# snizu theme check

Source: https://snizu.dev/docs/cli/theme/check

## Usage [#usage]

```sh title="Usage"
snizu theme check [dir] [--json] [--server [--theme <handle>]]
```

## Flags [#flags]

<Fields>
<Field name="[dir]" type="path">
The theme's folder, with its `theme.json`. The current one by default.
</Field>

<Field name="--json" type="flag">
One line of JSON: `ok`, and the errors, warnings and findings.
</Field>

<Field name="--server" type="flag">
Send the package to be checked as a push would, and keep nothing. It needs a sign-in.
</Field>

<Field name="--theme" type="handle">
With `--server`, which of your themes to check it as. The folder's linked theme by default.
</Field>
</Fields>

## On this machine [#on-this-machine]

The checks the server runs are compiled to WebAssembly inside the CLI, so the default check needs no sign-in and no network. It reads the theme as a package holds it, without dotfiles, `node_modules`, `snizu.theme.json` or the notes (`AGENTS.md`, `README.md`, `DESIGN.md`, `CHANGELOG.md`, `LICENSE`), and prints:

- **Errors** (✗): what stops the theme being accepted, each with its file.
- **Findings** (✗ or !): the audit of sample pages, each with its rule and the pages it found it on. Speed and page budgets are among them.
- **Warnings** (!): what would be accepted but should change.
- **Script notes**: the lines of your scripts reviewers will read, such as each address a script talks to.

## Examples [#examples]

```shellsession title="Terminal"
$ snizu theme check
✗ image-alt (index): <img src="https://cdn.example.com/hero.png">
✗ image-dimensions (index): <img src="https://cdn.example.com/hero.png">
✗ The theme wouldn't be accepted: 2 problem(s).
$ echo $?
1
```

A schema mistake names its file and line:

```shellsession title="Terminal"
$ snizu theme check
✗ sections/hero.json: is not valid: unknown variant `colour`, expected one of `text`, `textarea`, … at line 109 column 3
✗ The theme wouldn't be accepted: 1 problem(s).
```

So does a template that fails on a sample page, with the section's ID from the page's template, then the file and line. Each broken section is its own finding:

```shellsession title="Terminal"
$ snizu theme check
✗ render-failed (index): section hero: unknown filter: filter money_egp is unknown (sections/hero.html:18)
✗ The theme wouldn't be accepted: 1 problem(s).
```

In CI, check every change without a token:

```yaml title=".github/workflows/theme.yml"
name: Theme
on: [push, pull_request]
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npx -y snizu@2.0.0 theme check
```

<Callout tone="success" title="The same verdict as an upload">
`theme check` and the server run the same checks. When it says the theme would be accepted, a push of the same files is.
</Callout>