home / dev-tools / tokei

tokei

14k

Code statistics CLI for counting files, lines, code, comments, and blanks across source trees.

$brew install tokei
Language
Rust
Stars
14,039
Category
Dev Tools
Agent
Ready
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis

tokei is a source tree metrics CLI for quickly summarizing language mix and line counts. It scans directories or files and reports files, total lines, code, comments, and blanks, with optional per-file and machine-readable output.

What It Enables
  • Measure language mix, file counts, and code, comment, and blank-line totals for a repo, subtree, or set of paths.
  • Drill down to per-file statistics, sort results by files, lines, blanks, code, or comments, and exclude paths when scoping an audit.
  • Export totals as JSON or stream per-file JSON records for CI baselines, repository reports, or follow-up scripts.
Agent Fit
  • --output json and --streaming json give agents structured totals or per-file records without scraping the default table view.
  • Commands are non-interactive, respect ignore files by default, and combine cleanly with path, exclude, type, and sort flags in inspect-parse-report loops.
  • This is inspection-only and metric-focused: it helps agents find where code volume sits, not whether code is correct, complex, or safe.
Caveats
  • YAML and CBOR output require extra compile-time features; JSON is the portable structured format available in standard builds.
  • Counts depend on language detection and ignore rules, so ambiguous extensions or excluded paths can change totals until you adjust patterns or flags.