# Commands (/docs/commands)

<!-- Generated by scripts/gen.mjs from scripts/commands.mjs. Do not edit by hand. -->

marmot follows the `go` command where it can. Run it inside a Go module.

| Command | What it does |
| --- | --- |
| [`marmot build`](/docs/commands/build) | Compile packages and their dependencies into an executable. |
| [`marmot run`](/docs/commands/run) | Compile and run a program. |
| [`marmot test`](/docs/commands/test) | Compile and run package tests, like go test. |
| [`marmot check`](/docs/commands/check) | Run vet, lint, format and the other code checks in one pass. |
| [`marmot fix`](/docs/commands/fix) | Apply the suggested fixes of build errors and check findings. |
| [`marmot fmt`](/docs/commands/fmt) | Format Go source and fix its imports, as goimports does. |
| [`marmot watch`](/docs/commands/watch) | Build, run or test again after every change. |
| [`marmot repl`](/docs/commands/repl) | Evaluate Go declarations, statements and expressions interactively. |
| [`marmot size`](/docs/commands/size) | Size of a binary by section, package and function. |
| [`marmot bench`](/docs/commands/bench) | Run benchmarks and compare them with go or a saved run. |
| [`marmot prof`](/docs/commands/prof) | Read a CPU or memory profile in the terminal. |
| [`marmot doctor`](/docs/commands/doctor) | Check the installation and the environment and say what to fix. |
| [`marmot explain`](/docs/commands/explain) | Describe an error code. |
| [`marmot mcp`](/docs/commands/mcp) | Serve build, run, test, fix and explain to coding agents. |
| [`marmot generate`](/docs/commands/generate) | Run //go:generate directives, with their outputs cached. |
| `marmot cache` | Show the build cache size; `cache trim` and `cache clean` shrink or remove it. |
| `marmot completion SHELL` | Print shell completion for bash, zsh, fish or powershell. |
| `marmot version` | Print the version. |

## Top level help [#top-level-help]

```text title="marmot --help"
marmot compiles Go programs to native executables through MLIR and LLVM.
It works like the go command: run it inside a Go module.

Errors are shown with the source, the exact span, and suggested fixes on a
terminal, as plain file:line:col lines otherwise, and as JSON Lines with
-json or MARMOT_OUTPUT=json (the default under coding agents).

Usage:
  marmot [command]

Examples:
# build the package in the current directory
marmot build

# build and run a program with arguments
marmot run ./cmd/app -v input.txt

# smallest release binary
marmot build -release -O z -s -o app ./cmd/app

# apply the suggested fixes of the build errors
marmot fix

# what an error code means
marmot explain M0002

Available Commands:
  bench       Run benchmarks and compare them with go or a saved run
  bind        Generate Go bindings from a C header
  build       Compile packages and their dependencies
  cache       Show, trim or remove the build cache
  check       Run every code check in one pass: fmt, vet, lint, modernize, vuln, tidy, cross, deadcode
  completion  Generate the autocompletion script for the specified shell
  doctor      Check the toolchain, runtime, cache and environment
  explain     Describe an error code
  fix         Apply the suggested fixes of build errors
  fmt         Format Go source and fix its imports (gofmt plus goimports)
  generate    Run //go:generate directives, with their outputs cached
  help        Help about any command
  mcp         Serve marmot's tools to coding agents (Model Context Protocol)
  prof        Read a CPU or memory profile in the terminal
  repl        Evaluate Go interactively
  run         Compile and run a Go program
  size        Show what an executable's size is made of
  test        Compile and run package tests
  version     Print the marmot version
  watch       Rebuild, rerun or retest on every change

Flags:
  -h, --help      help for marmot
  -v, --version   version for marmot

Use "marmot [command] --help" for more information about a command.
```