Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

cloc

$ cloc Community Low Risk
AlDanial · Files & Search · GPL-2.0-or-later · macos / linux / windows

cloc counts blank lines, comment lines, and physical lines of source code across 300+ languages, and compares commits or branches via --git --diff. Native --json, --quiet, and --exclude-dir flags make codebase inventory straightforward for agents.

FCRS-1.0 Score
89 /100
Good
Medium Confidence
Zero-Friction Install
brew install cloc
CLI vs MCP Decision CLI Only

cloc --json --quiet summarizes entire repositories into tiny JSON payloads directly from disk.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
✓ Read-Only Mode
✓ NO_COLOR Clean
— Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 23 / 25

Native --json, --quiet, --csv, and --exclude-dir flags yield clean structured stdout with zero interactivity.

  • Supports --json, --quiet, and --exclude-dir
  • No ANSI color pollution in --json mode
Trust & Safety 24 / 25

Strictly read-only code and Git-diff counter with zero write or network actions.

  • Read-only source analyzer
Setup & Portability 12 / 15

Packaged via brew install cloc, Linux repos, and Windows .exe releases; Unix script requires Perl.

  • Single Perl script on Unix (requires Perl); standalone binary on Windows
Utility & Efficiency 12 / 15

Supports 300+ languages and --git --diff commit comparisons, though slower than Rust/Go counters (tokei, scc).

  • Rich language definitions and --git --diff support
Maintenance & Lineage 9 / 10

Actively maintained by AlDanial for nearly two decades with frequent language updates.

  • Active AlDanial/cloc GitHub repository
Docs & Verifiability 9 / 10

Extensive README, --help, and --show-lang self-documentation.

  • Complete flag and language reference online and in --help

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None required; read-only local source and Git repository counter.

Side Effects
Read-Only
Cost & Quotas

100% free, offline, and open-source (GPL-2.0-or-later).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# cloc Agent Rules
- Always pass `--json --quiet` and `--exclude-dir=node_modules,dist,target` on large repos.
- Use `tokei` or `scc` when raw speed on multi-million-line repos matters; use `cloc` when `--git --diff` or 300+ language coverage is needed.

Agent-Ready Command Recipes

Safe Read-Only Queries

Count lines of code by language as JSON
cloc --json --quiet --exclude-dir=node_modules,dist .

Outputs clean JSON totals for files, blank lines, comments, and code across languages.

Diff LOC changes between two Git refs as JSON
cloc --git --diff main HEAD --json --quiet

Reports added, modified, removed, and unchanged lines between main and HEAD.

Strengths for Agents

  • + Clean --json --quiet output covering 300+ languages.
  • + --git --diff computes structured added/removed/modified LOC deltas between commits.

Caveats & Pitfalls

  • ! Written in Perl, so it is noticeably slower than tokei or scc on very large monorepos.
  • ! Does not skip node_modules automatically unless --exclude-dir or --vcs=git is passed.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI