# `Beancount.Engine.CLI`
[🔗](https://github.com/thanos/beancount_ex/blob/v0.6.0/lib/beancount/engine/cli.ex#L1)

The default engine: a thin wrapper around the Beancount `bean-check` and
`bean-query` CLI tools.

This is the behavioral oracle. Rendering is delegated to
`Beancount.Renderer`, checking to `Beancount.Checker` (shells out to
`bean-check`), and queries to `Beancount.Query` (shells out to `bean-query`).

The native `Beancount.Engine.Elixir` implements the same
`Beancount.Engine` behaviour and is validated against this oracle.

# `check`

Validate `.bean` text via `bean-check`.

## Examples

    text = "2026-01-01 open Assets:Bank USD\n"

    if Beancount.Checker.available?() do
      {:ok, %Beancount.Result{status: :ok}} = Beancount.Engine.CLI.check(text)
    end

# `check_file`

Validate a `.bean` file on disk via `bean-check`.

## Examples

    path = Path.join(System.tmp_dir!(), "cli_check.bean")
    File.write!(path, "2026-01-01 open Assets:Bank USD\n")

    if Beancount.Checker.available?() do
      {:ok, _} = Beancount.Engine.CLI.check_file(path)
    end

# `query`

Run a BQL query via `bean-query`.

## Examples

    text = "2026-01-01 open Assets:Bank USD\n"

    if Beancount.Query.available?() do
      {:ok, _} = Beancount.Engine.CLI.query(text, "SELECT account GROUP BY account")
    end

# `render`

Render directives to `.bean` text via `Beancount.Renderer`.

## Examples

    iex> Beancount.Engine.CLI.render([Beancount.open(~D[2026-01-01], "Assets:Bank", ["USD"])])
    "2026-01-01 open Assets:Bank USD\n"

---

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