Skip to main content

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.

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 / Kotlin / C / PowerShell): a Linux or macOS shell, or Windows via WSL.

Clone

# HTTPS
git clone -j8 https://github.com/ophidiarium/mehen.git

# SSH
git clone -j8 git@github.com:ophidiarium/mehen.git

Build and lint

From the repo root:
cargo check
cargo build
cargo fmt --all
cargo clippy --all-targets --all-features --locked

Testing

mehen uses nextest when available, falling back to cargo test:
if cargo nextest --version >/dev/null 2>&1; then
  cargo nextest run --all-features
else
  cargo test --all-targets --locked
fi

Snapshot tests (insta)

Many metric tests use insta snapshots. Always pass --workspace to avoid false unreferenced failures.
cargo insta test --workspace --all-features --check --unreferenced reject \
    --test-runner nextest --no-test-runner-fallback --disable-nextest-doctest

Repository layout

CratePurpose
crates/mehen-cliCLI binary — entry point, command routing, exit codes.
crates/mehen-enginePipeline orchestration — run_diff, run_top_offenders, registry.
crates/mehen-coreParser-neutral domain types and the LanguageAnalyzer trait.
crates/mehen-metricsShared metric formulas, accumulators, finalizers.
crates/mehen-pythonPython analyzer (Ruff).
crates/mehen-typescriptTypeScript / JavaScript / TSX / JSX analyzer (Oxc).
crates/mehen-phpPHP analyzer (Mago).
crates/mehen-rubyRuby analyzer (Prism).
crates/mehen-rustRust analyzer (ra_ap_syntax).
crates/mehen-go, mehen-kotlin, mehen-c, mehen-powershellTree-sitter-backed analyzers.
crates/mehen-markdownMarkdown analyzer (pulldown-cmark) with embedded-code dispatch via LanguageDispatcher.
crates/mehen-tree-sitterShared tree-sitter wrapper and CST traversal helpers.
crates/mehen-gitGit operations.
crates/mehen-reportJSON, YAML, TOML, and GitHub-Markdown rendering.
xtaskDeveloper-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.

Pages

Contributing

Issues and pull requests welcome at github.com/ophidiarium/mehen.