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 diff compares metrics between two git revisions and emits a per-file delta report. It is the engine behind the GitHub Action and the recommended way to wire mehen into a PR workflow.
mehen diff [OPTIONS]
FlagDescription
--from <FROM>Base revision to compare from.
--to <TO>Head revision to compare to.
-p, --paths <PATHS>...Repository-relative files or directories to compare.
-M, --metrics <METRICS>Comma-separated metrics. Defaults to cyclomatic,cognitive,nom.functions,loc.lloc,mi.visual_studio. Prefix with + for higher-is-better, - for lower-is-better.
-I, --include <INCLUDE>...Glob to include files.
-X, --exclude <EXCLUDE>...Glob to exclude files.
-O, --output-format <OUTPUT_FORMAT>markdown or json.
--show-unchangedShow files where every metric is unchanged.
--ignore-generated[=<BOOL>]Skip files marked linguist-generated (default true).
--fail-on <FAIL_ON>Exit non-zero when named thresholds are crossed. Comma-separated: dmi-drop, new-broken-link, filler-high, all.

Examples

mehen diff --from main --to HEAD --paths src --output-format markdown

Output formats

GitHub-flavored Markdown table optimized for sticky PR comments. This is what the GitHub Action posts on each PR.

What gets compared

mehen runs the equivalent of mehen metrics against each side, joins by repository-relative path, and computes per-metric deltas. Files that exist on only one side are reported as new or deleted. Files matched by linguist-generated are skipped by default.

--fail-on thresholds

--fail-on accepts a comma-separated list of band-crossing rule IDs:
RuleTriggers when…
dmi-dropA Markdown file’s DMI crosses a band downward.
new-broken-linkAt least one new broken link is added.
filler-highA Markdown file’s Filler / Lazy Risk is ≥ 0.60.
allAny of the above.
The rules align with the severity-1 / severity-2 indicators on the PR comment design page. For per-metric numeric gating (e.g. “fail if cyclomatic delta > 5”), use the GitHub Action’s thresholds input, which post-processes the JSON report. See Concepts → Thresholds and diffs.

Exit codes

CodeMeaning
0Success — the comment is advisory.
1IO, git, parser-fatal, or unsupported-language error.
2One or more --fail-on rules crossed (gating exit).

See also