mehen is a fast, deterministic command-line tool that measures source code and Markdown documentation across a repository. It tracks complexity, maintainability, size, and documentation health, and is purpose-built for CI runs, pre-PR hooks, and pull request automation.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.
Installation
Install via npm, PyPI, or
cargo binstall from a single GitHub Release.Quickstart
Analyze a file, rank a tree, and diff a PR in under a minute.
GitHub Action
Drop the action into a workflow to publish per-PR metric trends.
Code metrics
Cyclomatic, cognitive, Halstead, MI, ABC, LOC family, NOM/NPA/NPM/WMC.
Markdown metrics
DMI, MRPC, MCC, Halstead-md, link debt, filler/lazy risk, prose layer.
SQL metrics (preview)
Roadmap for the upcoming
mehen-sql analyzer.What is Mehen?
Mehen is a mythical ancient Egyptian serpent associated with guarding Ra. In the same spirit, themehen CLI helps guard your codebase and documentation from collapsing under hidden complexity.
Why teams use mehen
Polyglot by design
Per-file language detection across nine source languages plus Markdown — built for monorepos.
Real parsers, not regex
Each language uses the best available parser: Ruff for Python, Oxc for TS/JS/JSX/TSX, Mago for
PHP, Prism for Ruby, ra_ap_syntax for Rust, pulldown-cmark for Markdown, tree-sitter for Go, C,
Kotlin, PowerShell.
Deterministic, no network
Pure static analysis. Same input → same output. Safe for air-gapped CI.
Code and documentation
A single tool covers source-code complexity and Markdown documentation health.
Pull-request native
Built-in
mehen diff plus a sticky comment GitHub Action — no glue code required.Many output formats
Console, JSON, YAML, TOML, GitHub-flavored Markdown.
What mehen computes
For source code:- Cyclomatic complexity and Cognitive complexity
- Halstead metrics (volume, difficulty, effort, estimated bugs)
- Maintainability Index (Original, Visual Studio, SEI variants)
- ABC (Assignments / Branches / Conditions)
- NOM, NARGS, NEXITS, NPA, NPM, WMC
- LOC family — SLOC, PLOC, LLOC, CLOC, blanks
- Documentation Maintainability Index (DMI)
- Markdown Reading Path Complexity (MRPC)
- Markdown Cognitive Complexity (MCC)
- Markdown Halstead
- Link Debt, Table Burden, Visual Scaffold, Artifact Debt
- Repository Grounding, Evidence Coverage
- Filler / Lazy Structure Risk, Review Criticality Index
- An opt-in English readability ensemble and Japanese script composition prose layer.
Get started
Add the GitHub Action
Publish per-PR metric trends with a few lines of YAML.
See the GitHub Action guide.