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 guide covers three things: analyzing one file, scanning a repository for the worst offenders, and producing a per-PR metric report from CI.
1

Install mehen

See the full installation guide. The shortest path:
npm install -g mehen
2

Analyze a single file

mehen metrics is the one-file command. It auto-detects the language and emits a report in JSON (default), Markdown, YAML, or TOML.
mehen metrics src/main.py --pretty
Source-code files yield the code metric family; Markdown files yield the documentation suite.
3

Find the worst offenders in a tree

mehen top-offenders walks one or more paths and ranks the files by one or more metrics:
mehen top-offenders src --metric cognitive --metric loc.lloc --max-results 20
Polarity is automatic — mehen knows that lower cognitive complexity is better. Override with + or - prefixes when you want different ordering.
4

Diff metrics on a PR

mehen diff compares two git revisions. This is the workhorse behind the GitHub Action:
mehen diff --from main --to HEAD --paths src --output-format markdown
The same command renders the sticky GitHub comment when run from the action.
5

Add the GitHub Action

Drop a few lines into .github/workflows/mehen.yml to publish a metric trend on every PR:
name: mehen
on: pull_request

jobs:
  mehen:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
      issues: write
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: ophidiarium/mehen@v0
        with:
          paths: src
See the GitHub Action guide for thresholds, monorepos, and the sticky comment template.

Where to next

Pick a metric

Read what each metric means, with formulas and references.

Markdown analysis

Documentation Maintainability Index, link debt, filler/lazy risk, prose layer.

GitHub Action

Inputs, outputs, thresholds, and PR comment design.

Concepts

How mehen organizes parsers, analyzers, and the metric pipeline.