# `Lynx.Commands`
[🔗](https://github.com/josevalim/lynx/blob/v0.1.0/lib/lynx/commands.ex#L1)

Invokes the Lean runner and Lake.

# `lake`

```elixir
@spec lake(String.t(), [String.t()], binary()) :: {non_neg_integer(), binary()}
```

Runs Lake and returns `{exit_status, stdout}`. Stderr is inherited.

Uses the caller's active toolchain and selects `project_dir` with Lake's `--dir` option.
Arguments are passed directly to the executable.

Commands reading stdin must use framing (such as a terminating newline),
since ports cannot close stdin alone.

# `runner!`

```elixir
@spec runner!(String.t(), map()) :: [map()]
```

Runs a protocol request and collects its JSON updates in order.

Each update includes elapsed milliseconds and diagnostics.
Returns verification errors and skipped files as updates. Raises on failure responses,
invalid JSON output, or unexpected exit statuses.
The caller supplies the complete request, including its command and version.
Updates retain the JSON protocol's string keys and values.

# `verify!`

```elixir
@spec verify!(String.t(), [map()], keyword()) :: [Lynx.Laws.report()]
```

Verifies assembled files and returns their timings and diagnostics.

Verification errors and skipped files are returned as updates. Runner failures raise.
Reports and diagnostics have atom keys; statuses and severities are atoms.
Module names, declarations, paths, and messages remain strings.
Uses the current Mix build directory for cached artifacts, falling back to `_build/dev`.

## Options

  * `:options` - a keyword list of Lean options, such as `[maxRecDepth: 10_000]`,
    set at the top of every translated module. Values are integers, booleans, or
    strings. They are part of every cache key.

  * `:debug_dir` - a directory where the rendered Lean source of every module is
    written by module path, such as `Erlang/json.lean`, when a module does not verify.

  * `:debug` - set to `:lean` to write the sources to `:debug_dir` even when every
    module verifies. Set to `:olean` to also write the compiled files of every
    verified module next to its source, such as `Erlang/json.olean`.

  * `:check_source` - when `true`, parses each module's rendered source and reports
    an error where it differs from the elaborated commands. Used by Lynx's own tests.

  * `:export` - a path where the declarations of the verified modules and their
    dependencies are written in Lean's export format, for `lake check --from-export`.
    It is written only when every module verifies.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
