mehen metrics is the single-file analysis command. It takes one path, auto-detects the language, and
emits a complete metrics report.
| Argument | Description |
|---|---|
<PATH> | Path to the file to analyze. mehen metrics never walks directories. |
| Flag | Default | Description |
|---|---|---|
--language <LANGUAGE> | auto-detected | Override language detection. Accepts canonical names or aliases (e.g. python, py, ts, tsx, markdown, md). |
--format <FORMAT> | json | One of json, markdown, yaml, toml. |
--pretty | off | Pretty-print JSON output. |
--profile <PROFILE> | default | One of default, ci, strict. |
Examples
- JSON (default)
- Pretty JSON
- Markdown report
- Forced language
- CI profile
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success. |
| 1 | IO error, unsupported language, or analyzer-fatal diagnostic on this file. |
| 3 | Invalid serialization state — should not happen in production runs. |
What gets reported
Source-code files yield the code metric family (cyclomatic, cognitive, Halstead, MI, ABC, LOC family, NOM, NPA, NPM, NARGS, NEXITS, WMC). Markdown files yield the Markdown metric suite — DMI, MRPC, MCC, Markdown Halstead, link debt, table burden, visual scaffold, artifact debt, repository grounding, evidence coverage, filler/lazy risk, review criticality, section balance, good scaffold. The opt-in prose layer ships behind Cargo features. When an analyzer supports source-resolved evidence, the default profile also emits acontributions array. Each entry identifies the metric, weighted amount, stable reason code, and
byte/line span responsible for that amount. SQL change risk is the first supported metric:
sql.change_risk_score explains destructive DDL/DML and distinct object-touch terms. The
ci/strict profiles skip this optional evidence to keep automated payloads lean.
Profiles
--profile selects a built-in preset for what gets reported and how thresholds are interpreted:
| Profile | Use case |
|---|---|
default | Local developer output, including supported contribution evidence. No implicit failure policy. |
ci | GitHub Action-friendly defaults without contribution evidence. Stable tables, standard metric selector set. |
strict | Same evidence behavior as ci, with tighter built-in threshold suggestions. |
Inspecting contribution evidence
Maintainers can print only the contribution array for a file through the developer task:mehen metrics path, so language detection,
profile behavior, reason codes, and spans match the public CLI report.
See also
mehen diff— compare metrics between revisions.mehen top-offenders— rank files by metric.- Concepts → Output formats — schema details.