# swarmops check lint

> Release: 0.13.0 · Last changed: 2026-11-30 · Source: https://github.com/KeiaiLab/SwarmOps/blob/stable/docs/reference/commands/check-lint.md

Report what a tree's check file names that cannot work, without running anything.

Reads .swarmops/checks.toml at REV (default main) as check list reads it, or the files below DIR with --dir, and looks at what each check names: a need that is no check of the file, or is not of every stage the check is of (check run would refuse it); an input pattern that matches no path of the tree (a pattern that names a directory matches nothing); a dir that is no directory of the tree. No fault is exit 0. A fault is E\_CHECK\_FILE with details.reason lint, the first fault's line and key, and every fault, ordered by check, kind and value, in details.lint (at most 1,000, the rest counted); the message counts them and names the first three. A file that does not read, or whose checks need one another in a circle, is refused as check list refuses it. --dir reads the host's files, follows no link and says vouched. Reads only: no identity, no lock, nothing is run.

```yaml
title: "swarmops check lint"
description: "Report what a tree's check file names that cannot work, without running anything."
group: "checks"
since: "0.14.0"
mutates: false
identity_required: false
mcp_tool: "check_lint"
envelope_op: "check_lint"
exit_codes: [0, 1]
errors: [E_CHECK_FILE]
syntax: "swarmops check lint [OPTIONS] [REV]"
```

## Syntax

```text
swarmops check lint [OPTIONS] [REV]
```

## Required arguments

None.

## Optional arguments

The command also takes the [global options](../cli.md#global-options).

### `REV`

Syntax: `<REV>`.

The changeset whose tree's checks to lint.

### `--dir`

Syntax: `--dir <DIR>`.

Read the check file and the tree below DIR on this host, not from the store.

## Examples

### CLI

```sh
swarmops --repo [tmp]/store check lint
```

```json
{
  "ok": true,
  "op": "check_lint",
  "api": 1,
  "result": {
    "vouched": false,
    "tree": "[tree_c1]",
    "file": ".swarmops/checks.toml",
    "version": 1,
    "checks": 4,
    "faults": []
  },
  "meta": {
    "repo": "[tmp]/store",
    "elapsed_ms": "[elapsed_ms]",
    "resolved": {
      "[c1]": "[c1]",
      "main": "[c1]"
    },
    "auth": "trust"
  }
}
```

Exit code 0. Recorded by the CLI tests. A name in square brackets, such as `[tmp]` or `[c1]`, stands for what differs from run to run: the test's temporary directory, an id, a time.

### MCP

No recorded example yet.

## Details

`check lint` says what a tree's check file names that cannot work. It reads the file as
[`check list`](../commands/check-list.md) reads it, then looks at what each check names, and runs
nothing: it takes no identity and no lock, and writes nothing. It is the check a gate can make of
its own check file with no parsing: no fault is exit 0, any fault is exit 1.

### Two forms

- **From the store**, `check lint [REV]`: the tree of `REV` (default `main`), resolved once and
  recorded in `meta.resolved`; the answer names that `tree` and says `vouched: false`.
- **From a directory**, `check lint --dir DIR`: the check file and the files below `DIR` on this
  host. It opens no store, so `--repo`, `SWARMOPS_REPO` and `--as` are not used, and the envelope
  has no `meta.repo`. The answer says `vouched: true`; no entry of the directory is followed if it
  is a symbolic link, and `.git` and `.swarmws` are no part of the tree. `REV` and `--dir`
  together are a usage error.

### What it looks at

| Kind | A fault when | `key` | `value` |
| --- | --- | --- | --- |
| `need_undefined` | A need names no check of the file. | `check.<name>.needs` | The need. |
| `need_off_stage` | A need is a check of the file, but not of every stage the check that names it is of: `check run` of one of those stages refuses the run. | `check.<name>.needs` | The need. |
| `input_matches_nothing` | An input pattern matches no entry of the tree. A pattern that names a directory exactly matches nothing, and a link is matched by its own path. | `check.<name>.inputs` | The pattern. |
| `dir_missing` | A check's `dir` is no directory of the tree (a link is none). The root, `.`, always is. | `check.<name>.dir` | The directory. |

Each fault carries the `check` it is of and the `line` its table starts on. The faults come
ordered by check name, then by kind in the order of the table, then by value, at most 1,000 of
them: the rest are counted in `faults_omitted`. A file that does not read is refused as
`check list` refuses it (`E_CHECK_FILE`, with the reason it gives), and so are checks that need
one another in a circle (`cycle`); neither is a fault of the kinds above.

### The answer

No fault: the result holds `vouched`, the `tree` (the store form), the `file` and `version` read,
how many `checks` it looked at and an empty `faults`; exit 0. A tree with no check file has no
check and no fault.

Any fault: `E_CHECK_FILE`, exit 1, not retryable, `details.reason` `lint`. `details.file` and
`details.vouched` say what was read, `details.line` and `details.key` are the first fault's, and
`details.lint` is the whole result, the one the clean answer would have been, with its faults.
The message counts the faults and names the first three, so `--human` prints what to fix; the
hint says where the rest are.

### In the gate

`just check` runs `check lint --dir .` with the build under test, after `check list --dir .`, so
that a need or a pattern that names nothing fails the gate with its line in the log. The CI job
that runs `check run` uses a pinned released build, which reads the file without the keys that
build does not know, so this repository's file declares none of `inputs` or `needs` until that
build holds them.

## Return information

`result` is a `CheckLintResp` (`swarmops schema CheckLintResp` prints its JSON Schema).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checks` | `integer` | yes | How many checks the file defines. |
| `faults` | `array of CheckLintFaultOut` | yes | What cannot work, at most 1,000 of them: ordered by check name, then by kind (`need_undefined`, `need_off_stage`, `input_matches_nothing`, `dir_missing`), then by value. |
| `faults_omitted` | `integer` | no | The faults past the 1,000 returned, counted. Omitted when 0. |
| `file` | `string or null` | no | The file the checks came from, as `check list` names it. Omitted when the tree holds no check. |
| `tree` | `string or null` | no | The root tree the file was read from: 64 hex digits. Omitted for a directory. |
| `version` | `integer or null` | no | The check file's `version`, 1. Omitted unless `file` is `.swarmops/checks.toml`. |
| `vouched` | `boolean` | yes | Whether only the caller stands behind the file: `true` when it was read from a directory the caller named (`check lint --dir`); `false` when it was read from the store, at `tree`. |

Envelope `op`: `check_lint`.

Exit codes:

- `0`: Success.
- `1`: The operation failed.

## Errors

- [`E_CHECK_FILE`](../errors.md#e_check_file) (exit 1): A check file does not read, or cannot work: `.swarmops/checks.toml` (or, in a tree without one, `.swarmops/workspaces.json`) is too large, not text, not a file, not TOML (JSON), not version 1, holds a key, a name or a value version 1 does not take, has checks that need one another in a circle (`details.cycle`), or is one whose need a run cannot satisfy (`details.check`, `details.need`, `details.stage`): `details.file`, `details.reason`, `details.vouched`, and `details.line` and `details.key` when known.

Any command that opens a store may also fail with a store error, such as [`E_NOT_A_REPO`](../errors.md#e_not_a_repo), [`E_IO`](../errors.md#e_io) or [`E_STORE_CORRUPT`](../errors.md#e_store_corrupt); a command line the grammar refuses is [`E_INVALID_ARG`](../errors.md#e_invalid_arg) (exit 2).

## See also

- [`swarmops check list`](check-list.md)
- [`swarmops check plan`](check-plan.md)
- [`swarmops check run`](check-run.md)
- [`swarmops check runs`](check-runs.md)
- [`swarmops check log`](check-log.md)
- [CLI reference](../cli.md)
- [Error codes](../errors.md)
