# swarmops check list

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

List the checks REV's tree describes, or those of a directory with --dir.

A tree names its checks in .swarmops/checks.toml (version 1): one \[check.NAME\] table a check, each one command (argv) run with no shell, with a directory (dir), a timeout (timeout\_s), the stages its answer is wanted at (stages, default before-land) and the paths it reads (inputs, default the whole tree: path patterns in which \* is one whole segment and a last \*\* every depth below), the checks that run before it (needs, names of checks of the file; a check whose need did not pass is skipped), whether it runs even then (always, default false) and the group it belongs to (group, a table of name, scope host and wait\_s: only one check of a group runs on a host at a time); any other key is refused at its line, and checks that need one another in a circle are refused. This reads .swarmops/checks.toml at REV (default main), resolved once; a tree without it lists check.argv of .swarmops/workspaces.json as the one check default, and a tree with neither lists no check. Each check comes with its argv, its directory, its timeout, the digest of its definition, its stages, the inputs, the needs and the group it declares, sorted by name; --stage lists only the checks of one stage. --dir DIR reads the files below DIR on this host instead, and opens no store: the answer says vouched, since only the caller stands behind them. A file that does not read is E\_CHECK\_FILE, naming its line and key. Reads only: no identity, no lock.

```yaml
title: "swarmops check list"
description: "List the checks REV's tree describes, or those of a directory with --dir."
group: "checks"
since: "0.13.0"
mutates: false
identity_required: false
mcp_tool: "check_list"
envelope_op: "check_list"
exit_codes: [0, 1]
errors: [E_CHECK_FILE]
syntax: "swarmops check list [OPTIONS] [REV]"
```

## Syntax

```text
swarmops check list [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 list.

### `--dir`

Syntax: `--dir <DIR>`.

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

### `--stage`

Syntax: `--stage <STAGE>`.

List only the checks of this stage. Values: `before-land`: Before a change lands: the gate; `after-land`: After a change has landed; `scheduled`: On a schedule; `release`: Before a release is cut; `manual`: Only when someone asks for it; `deploy`: Before a deployment.

## Examples

### CLI

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

```json
{
  "ok": true,
  "op": "check_list",
  "api": 1,
  "result": {
    "vouched": false,
    "tree": "[tree_c0]",
    "file": ".swarmops/checks.toml",
    "version": 1,
    "checks": [
      {
        "name": "docs",
        "argv": [
          "python3",
          "-I",
          "scripts/check-docs.py"
        ],
        "dir": ".",
        "timeout_s": 900,
        "definition_digest": "[docs_digest]",
        "stages": [
          "before-land",
          "after-land"
        ],
        "inputs": [
          "docs/**",
          "scripts/check-docs.py"
        ],
        "line": 13
      },
      {
        "name": "lint",
        "argv": [
          "cargo",
          "clippy",
          "--",
          "-D",
          "warnings"
        ],
        "dir": "crates/app",
        "timeout_s": 600,
        "definition_digest": "[lint_digest]",
        "stages": [
          "before-land"
        ],
        "line": 8
      },
      {
        "name": "unit",
        "argv": [
          "cargo",
          "test",
          "--locked"
        ],
        "dir": ".",
        "timeout_s": 900,
        "definition_digest": "[unit_digest]",
        "stages": [
          "before-land"
        ],
        "reports": [
          {
            "format": "junit",
            "path": "target/nextest/default/junit.xml"
          }
        ],
        "line": 4
      }
    ]
  },
  "meta": {
    "repo": "[tmp]/store",
    "elapsed_ms": "[elapsed_ms]",
    "resolved": {
      "[c0]": "[c0]",
      "main": "[c0]"
    },
    "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 list` says what a tree names as its checks. It reads one file, writes nothing, takes no
lock and needs no identity. Nothing in SwarmOps runs these checks yet: `ws land --check` still runs
`check.argv` of `.swarmops/workspaces.json` alone.

### Two forms

- **From the store**, `check list [REV]`: the tree of `REV` (default `main`), resolved once and
  recorded in `meta.resolved`; the result names that `tree` and says `vouched: false`.
- **From a directory**, `check list --dir DIR`: the files below `DIR` on this host, for a host with
  no store at hand, such as a CI job on a git checkout. It opens no store, so `--repo`,
  `SWARMOPS_REPO` and `--as` are not used, and the envelope has no `meta.repo`. The result, and an
  `E_CHECK_FILE` refusal's `details`, say `vouched: true`: only the caller stands behind what the
  directory holds, so no gate accepts such an answer. `.swarmops` and the file are never followed
  if they are symbolic links. `REV` and `--dir` together are a usage error.

In both forms a `.swarmops` that is a symbolic link is refused, `not_a_file`, and the message
names it: the store follows no link either, and such a tree is not listed as one without checks.

### The check file, version 1

`.swarmops/checks.toml` at the tree's root, in TOML 1.1 (which also reads every TOML 1.0 file):

```toml
version = 1

[check.unit]
argv = ["cargo", "test", "--locked"]

[check.lint]
argv = ["cargo", "clippy", "--", "-D", "warnings"]
dir = "crates/app"
timeout_s = 600
stages = ["before-land", "after-land"]
inputs = ["crates/app/**", "Cargo.toml", "Cargo.lock"]

[check.test]
argv = ["cargo", "nextest", "run", "--profile", "ci"]
reports = [{ format = "junit", path = "target/nextest/ci/junit.xml" }]
```

| Key | Required | Default | Rule |
| --- | --- | --- | --- |
| `version` | yes | | The integer `1`. |
| `[check.<name>]` | no | no checks | One table a check. The name is 1 to 64 bytes of `a-z`, `0-9`, `-` and `_`, starting with a letter or a digit. |
| `argv` | yes | | The program and its arguments, 1 to 1,024 strings, 64 KiB together, no NUL byte, the program not empty. It runs with no shell: steps and conditions belong in the repository's own scripts. |
| `dir` | no | `"."` | The directory of the tree it runs in: `.` or a repository path (no empty, `.` or `..` part, no leading or trailing `/`). Whether the tree holds it is not checked. |
| `timeout_s` | no | `900` | The most seconds it may run, 1 to 86,400. |
| `stages` | no | `["before-land"]` | When its answer is wanted: 1 to 6 of `before-land`, `after-land`, `scheduled`, `release`, `manual` and `deploy`, none twice. An unknown stage, an empty array, an item that is not a string, or a stage given twice is refused as `value`, at the line of the item (or the array) at fault. The key is `stages`, plural: `stage` is refused as an unknown key. |
| `reports` | no | none | The JUnit and SARIF reports the check leaves in its tree, which `check run` reads into findings once it has ended ([check run](../commands/check-run.md)): 1 to 16 tables, each of `format` (`junit` or `sarif`) and `path` (a repository path relative to the check's `dir`, no path twice in one check), as an inline table or a `[[check.<name>.reports]]` table. Not an array, an empty one, a 17th report or an item that is not a table is refused as `value` with `details.key` `check.<name>.reports`; a format or path outside its rule, or a table without one of them, as `value` with `details.key` `check.<name>.reports.format` or `.path`; any other key in a table as `unknown_key`. Each at the line at fault. |
| `inputs` | no | the whole tree | The paths the check reads: 1 to 256 path patterns of at most 4,096 bytes each, none twice. A pattern is names between `/`: a name stands for itself, `*` for any one name, and a last `**` for everything below that point, never the directory itself. So `crates/app/*` meets `crates/app/Cargo.toml` and not `crates/app/src/lib.rs`, `crates/app/**` meets both and not `crates/app`, and `**` meets every path. A pattern is matched against a path from the tree's root, whatever the check's `dir`. A `*` beside other bytes (`*.rs`, `server-*`), a `**` before the last segment and a name no repository path holds (an empty one, `.`, `..`) are refused. A pattern matches files, executables and symbolic links, a link by its own path and never by what it points at; it matches no directory, so `web` matches nothing in a tree where `web` is a directory. Whether a pattern matches any path of the tree is not checked. Not an array, an empty one (leave the key out for the whole tree), an item that is not a string, a pattern outside these rules, one given twice or a 257th is refused as `value` with `details.key` `check.<name>.inputs`, at the line of the item (or the array) at fault. |
| `needs` | no | none | The checks that must pass before this one starts: 1 to 32 names of checks of the same file, each of the grammar of a check's name, none twice, none the check itself. [`check run`](../commands/check-run.md) runs a check after the checks it needs, and skips it when one of them did not pass, unless it says `always`. Not an array, an empty one (leave the key out), an item that is not a string or not a check's name, the check itself, a name given twice or a 33rd is refused as `value` with `details.key` `check.<name>.needs`, at the line of the item (or the array) at fault. Whether a need names a check of the file is not judged by `check list`, nor by the reader: `check run` refuses a run that selects a check whose need is no check of the stage it runs, and [`check lint`](../commands/check-lint.md) names each such fault. Checks that need one another in a circle are refused as `cycle` (below). |
| `always` | no | `false` | `true` to run the check even when a check it needs did not pass, or was skipped. Not a boolean is refused as `value` with `details.key` `check.<name>.always`. |
| `group` | no | none | A table `{ name, scope, wait_s }` naming an exclusive group: `check run` lets only one check of a group run on a host at a time, the others wait. `name` is required, of the grammar of a check's name, and names the lock file `<name>.lock`; `scope` is required and is `host` (another word is refused as `value`); `wait_s` is a whole number of seconds from 0 to 86,400, 900 when left out: how long `check run` waits for the group, 0 trying once. A table that is none, lacks `name` or `scope`, or holds another key is refused as `value` (`unknown_key` for another key), with `details.key` `check.<name>.group` or `check.<name>.group.<key>`, at the line at fault. The directory the locks are in is the operator's setting of `check run`, not a key of the file. |

The file holds at most 1 MiB and 1,000 checks, and a check at most 16 reports, 256 input
patterns and 32 needs. Any TOML table syntax reads alike: a header, dotted keys (`check.unit.argv = [...]`) or
an inline table. The
[limits](../limits.md) page lists each bound with its constant.

**Any other key is refused**, at its line, as `unknown_key`. Later releases add keys to version 1
(what a check is run with, say); a build that does not know a key refuses the file instead of
listing, or running, a check without it: a build up to 0.13.0 refuses a file that names `inputs`,
`needs`, `always` or `group` (as `unknown_key`, at the key's line). A change to what an
existing key means is a new version.

### The answer

The checks come sorted by name, so moving a table in the file changes nothing but their `line`. Each
has its `argv`, its `dir`, its `timeout_s` and its `stages` with the defaults filled in, the `line`
its table starts on, its `reports` in declared order, its `inputs` and its `needs` sorted
bytewise when it declares any, `always` when it is `true`, its `group` when it names one, and
`definition_digest`, a digest of `argv`, `dir`, `timeout_s`, `reports`, `inputs`, `needs` and
`always` (not of the name, nor of the stages, which say when an answer is wanted, nor of the group,
which says when the command may run: not what it computes): two checks that differ only in name,
stages or group, or a check renamed, share a digest, and a default written out gives the
same digest as one left out; a check that declares no report, no input, no need and no `always`
has the digest it had before those keys existed, and the order `inputs` or `needs` are written in
changes none. `stages`
come in the stages' own order (`before-land`, `after-land`, `scheduled`, `release`, `manual`,
`deploy`), whatever order the file wrote them in. The same tree gives the same `result` byte for
byte, whichever changeset names it.

**The digest is provisional.** Its recipe is not part of the hash contract and may change in a
later release; compare digests made by one release only.

### A tree without the file

When the tree holds no `.swarmops/checks.toml`, `check.argv` of `.swarmops/workspaces.json`, if it
names a command, is the one check `default`: that argv, at the root, with `check.timeout_s` or 900,
the stage `before-land` (the check `ws land --check` runs before a land), and no `line`; `file` says
`.swarmops/workspaces.json`. That file is read in the shape and the size a workspace reads it in, at
most 64 KiB of JSON, so `check list` refuses every file that `ws land --check` refuses (as
`E_CHECK_FILE`, where the land says `E_INVALID_ARG`). It also holds `check.argv` and
`check.timeout_s` to version 1's rules, which the land does not: a timeout past 86,400 s, or an argv
whose program is empty, is refused here and accepted by the land. The land never reads
`check.timeout_s` at all, and takes its own `--check-timeout`; the `timeout_s` listed for `default`
is the one a later runner will use. A tree with neither file, or with an empty or missing
`check.argv`, lists no check and exits 0.

### One stage

`--stage STAGE` (the request's `stage`) lists only the checks whose `stages` hold `STAGE`, still
sorted by name, in either form, and the result echoes `stage`; without it every check is listed
and the result has no `stage`. A stage no check names lists none and exits 0. `--stage
before-land` lists what `check run` runs by default.

A tree that holds `.swarmops/checks.toml` is listed from it alone, whatever `workspaces.json`
says. `ws land --check` does not read the check file yet, so in such a tree the two can disagree
until checks run through SwarmOps.

### Refusals

A file that does not read is `E_CHECK_FILE`, exit 1, and nothing is listed. `details.reason` is
one of `too_large`, `not_text`, `not_a_file`, `syntax`, `version`, `unknown_key`, `name`, `value`,
`too_many` and `cycle`; `details.line` names the line (1 is the first) when the fault has one (keys
dotted past the reader's nesting depth are a `syntax` fault without one), and
`details.key` the key at fault as a dotted path. The faults are judged in file order after the
version, and the first one is the refusal, except a `cycle`, which is found once every key is
read: the checks that need one another in a circle, `details.cycle` naming them from the smallest
check on the circle round to itself (`["a", "b", "a"]`), `details.key` that check's `needs`, and
`details.line` its table. [Troubleshooting](../../troubleshooting.md#e_check_file)
says what fixes each.

The directory form has two errors of its own. A `.swarmops` or a file in it that the host will not
let it read (a permission, say) is `E_IO`, exit 1, with `details.path` naming it below `DIR` and
`details.vouched: true`. A `DIR` that is not a directory is `E_INVALID_ARG`, exit 2, with
`details.reason: dir` and `details.dir` as given.

### Through MCP

The MCP tool is `check_list`, with an optional `rev`. It has the store form alone: the server
always serves the store it was started on, and a directory of the server's host is not something
an agent's request should name.

## Return information

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checks` | `array of CheckOut` | yes | The checks, sorted by name, bytewise; empty when the tree describes none (or none of `stage`). |
| `file` | `string or null` | no | The file the checks came from: `.swarmops/checks.toml`, or `.swarmops/workspaces.json` for the one check `default`. Omitted when the tree holds neither, or a `workspaces.json` with no `check.argv`. |
| `stage` | `CheckStage or null` | no | The stage asked for: `checks` holds only the checks of it. Omitted when every check is listed. |
| `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 list --dir`), which no gate accepts; `false` when it was read from the store, at `tree`. |

Envelope `op`: `check_list`.

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 lint`](check-lint.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)
