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.

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.
mehen metrics src/main.py --pretty
mehen top-offenders src --metric cognitive
mehen diff --from main --to HEAD --paths src --output-format markdown

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, the mehen 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: For Markdown documentation:

Get started

1

Install mehen

Pick the path that matches your toolchain:
npm install -g mehen
2

Analyze a file

mehen metrics src/main.py --pretty
3

Add the GitHub Action

Publish per-PR metric trends with a few lines of YAML. See the GitHub Action guide.