# `mix ex_mujoco.gen`
[🔗](https://github.com/d-led/ex.mujoco/blob/main/lib/mix/tasks/ex_mujoco.gen.ex#L1)

Rewrites the NIF bindings, the Elixir that calls them, and `docs/coverage.md`
from the MuJoCo headers this build is against.

    $ mix ex_mujoco.gen
    $ mix ex_mujoco.gen --check

The headers come from the MuJoCo that `scripts/prepare_mujoco.exs` prepared, so
the bindings and the library are always the same version. What is bound is
`c_src/manifest.exs`; everything else the headers describe is written to
`docs/coverage.md` as unbound, with the reason.

`--check` writes nothing and exits non-zero when a generated file disagrees with
what would be generated. CI runs it on every push, so a hand-edited generated
file, or a MuJoCo version bump without a regeneration, fails the build rather
than drifting.

The output is committed: a package that generated its bindings at build time
would need a generator on the machine that builds it, and would make two builds
of the same version differ.

---

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