type: service
status: active
timestamp: 2026-06-20
tags: [services, code-quality, code-stats, line-count, rust, oss, auto-tracking]

Tokei

Rust CLI for per-language line counts; runs in CI, outputs JSON to /stats page

Tokei

Role

Tokei is a Rust CLI that counts files, blanks, comments, code, and total lines, broken down per programming language. Run in every public family repo’s CI as a single step; emits JSON; uploaded as a workflow artefact and consumed at build time by the family-wide /stats page.

CI step shape (lands in templates/per-site-ci/.github/workflows/ci.yml):

- name: Count lines of code
  run: |
    cargo install tokei --quiet || curl -sSL https://github.com/XAMPPRocky/tokei/releases/latest/download/tokei-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C /usr/local/bin
    tokei --output json . > tokei.json
- uses: actions/upload-artifact@v4
  with:
    name: tokei-stats
    path: tokei.json

The family /stats page build consumes the JSON via the GitHub REST API (/repos/{owner}/{repo}/actions/artifacts) and renders the per-language breakdown across all family repos.

Free tier

OSS, Apache-2.0 / MIT dual-licensed. No SaaS backend — runs locally or in CI. Zero quota.

Card / subscription required?

NO. Static binary, no signup.

Alternatives

Swap cost

Low. Replace one CI step + one downstream consumer in the stats page builder. Output JSON shape is similar across cloc / scc.

Why this is our pick

Fastest of the OSS line counters at family scale (sub-second on typical repos), single static binary with no runtime dependencies, JSON output that the family /stats page consumes directly without a parser. Used inside the 9-tool code-stats stack as the canonical “lines of code” source — its JSON output also backs the Lines of Code badge rendered in every repo’s README.

Auto-tracked end-to-end: Tokei runs on every CI invocation without human action, in line with the auto-only-tracking rule.

Cross-refs


Edit on GitHub · Back to index