mdsmith metrics

July 18, 2026 · View on GitHub

Metrics are the shared measurements rules compute: file length, section length, token estimate, readability scores. This CLI surfaces them as a standalone tool for triage.

mdsmith metrics <command> [flags] [files...]

Subcommands

SubcommandDescription
getEmit all metrics for a single file
listList available metrics in the registry
rankRank files by selected metrics

metrics get

Emit every registered metric for a single Markdown file as a data object. The shape is a flat map with path plus one key per metric. To narrow to one field, pipe through jq or yq.

mdsmith metrics get [flags] <file>
FlagDefaultDescription
-f, --formattexttext, json, or yaml
mdsmith metrics get docs/guides/install.md
mdsmith metrics get -f json README.md
mdsmith metrics get -f yaml README.md | yq .readability
mdsmith metrics get -f json README.md | jq .avg-words-per-sentence

metrics list

mdsmith metrics list [flags]
FlagDefaultDescription
-f, --formattexttext, json, or yaml
--scopefileMetric scope (only file)

metrics rank

mdsmith metrics rank [flags] [files...]
FlagDefaultDescription
-c, --configautoOverride config path
-f, --formattexttext, json, or yaml
--metricsComma-separated metric IDs to compute
--byMetric ID to rank by
--orderdescasc or desc
--top0Limit output to N rows (0 = all)
--no-gitignorefalseSkip gitignore filtering
--follow-symlinksconfigFollow symlinks; tri-state
--max-input-size2MBMax file size (e.g. 2MB, 0=none)

metrics rank counts only authored bytes. Content between <?include?> and <?catalog?> markers is excluded. Embedded content is measured against its source file, not the host that pulls it in.

With no file arguments, defaults to the current directory.

Available metrics

Three metrics are off by default in rank: readability (MET008), sentences (MET009), and avg-words-per-sentence (MET010). They appear in get and list unconditionally.

MetricDefaultDescription
bytesyesRaw file byte count
linesyesTotal line count
wordsyesWord count from plain text
headingsyesNumber of headings
token-estimateyesToken estimate (0.75 × words)
concisenessyesHeuristic conciseness score (0–100)
readabilitynoAutomated Readability Index (ARI grade level)
sentencesnoSentence count from plain text
avg-words-per-sentencenoAverage words per sentence

Examples

mdsmith metrics list
mdsmith metrics get -f json README.md
mdsmith metrics get -f yaml docs/guides/install.md
mdsmith metrics rank --by bytes --top 10 .
mdsmith metrics rank --by token-estimate --top 5 docs/
mdsmith metrics rank --metrics bytes,sentences --by sentences plan/
mdsmith metrics rank --metrics readability --by readability --top 20 docs/

Exit codes

CodeMeaning
0Output produced
2Runtime / config error