This section documents how to build mehen, run its tests, and contribute changes.Documentation Index
Fetch the complete documentation index at: https://mehen.ophi.dev/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A recent stable Rust toolchain. See rust-lang.org/tools/install.
- For tree-sitter grammar regeneration (Go / Kotlin / C / PowerShell): a Linux or macOS shell, or Windows via WSL.
Clone
Build and lint
From the repo root:Testing
mehen usesnextest when available, falling back to cargo test:
Snapshot tests (insta)
Many metric tests use insta snapshots. Always pass --workspace to avoid false unreferenced
failures.
- CI-style check
- Update intentionally
Repository layout
| Crate | Purpose |
|---|---|
crates/mehen-cli | CLI binary — entry point, command routing, exit codes. |
crates/mehen-engine | Pipeline orchestration — run_diff, run_top_offenders, registry. |
crates/mehen-core | Parser-neutral domain types and the LanguageAnalyzer trait. |
crates/mehen-metrics | Shared metric formulas, accumulators, finalizers. |
crates/mehen-python | Python analyzer (Ruff). |
crates/mehen-typescript | TypeScript / JavaScript / TSX / JSX analyzer (Oxc). |
crates/mehen-php | PHP analyzer (Mago). |
crates/mehen-ruby | Ruby analyzer (Prism). |
crates/mehen-rust | Rust analyzer (ra_ap_syntax). |
crates/mehen-go, mehen-kotlin, mehen-c, mehen-powershell | Tree-sitter-backed analyzers. |
crates/mehen-markdown | Markdown analyzer (pulldown-cmark) with embedded-code dispatch via LanguageDispatcher. |
crates/mehen-tree-sitter | Shared tree-sitter wrapper and CST traversal helpers. |
crates/mehen-git | Git operations. |
crates/mehen-report | JSON, YAML, TOML, and GitHub-Markdown rendering. |
xtask | Developer-only commands (kind-enum codegen, AST dumps, audits). |
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.