Skip to main content
This section documents how to build mehen, run its tests, and contribute changes.

Prerequisites

  • A recent stable Rust toolchain. See rust-lang.org/tools/install.
  • For tree-sitter grammar regeneration (Go / C / PowerShell): a Linux or macOS shell, or Windows via WSL.
  • ANTLR grammar regeneration (Kotlin, Java, C#) needs no separately installed generator: xtask links the workspace-pinned antlr-rust-codegen crate directly. Keep that exact pin in lockstep with antlr-rust-runtime; a normal build still uses the checked-in modules.
  • For the C# grammar specifically, also uv: the Roslyn grammar is transformed by crates/mehen-csharp-parser/grammar/prepare-grammar.py, run as a step of generation via its PEP 723 inline metadata.

Clone

Build and lint

From the repo root:

Testing

mehen uses nextest when available, falling back to cargo test:

Snapshot tests (insta)

Many metric tests use insta snapshots. Always pass --workspace to avoid false unreferenced failures.

Repository layout

Coding expectations

  • Keep internals internal (pub(crate) / private) unless a real external API is needed.
  • Prefer explicit imports over wildcard re-exports.
  • Avoid dead code — this is a CLI-focused codebase.
  • Preserve deterministic metric behavior across platforms.

Pages

Contributing

Issues and pull requests welcome at github.com/ophi-dev/mehen.