cloc
$ cloc Community Low Riskcloc 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.
brew install cloc cloc --json --quiet summarizes entire repositories into tiny JSON payloads directly from disk.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
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
--jsonmode
Strictly read-only code and Git-diff counter with zero write or network actions.
- Read-only source analyzer
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
Supports 300+ languages and --git --diff commit comparisons, though slower than Rust/Go counters (tokei, scc).
- Rich language definitions and
--git --diffsupport
Actively maintained by AlDanial for nearly two decades with frequent language updates.
- Active
AlDanial/clocGitHub repository
Extensive README, --help, and --show-lang self-documentation.
- Complete flag and language reference online and in
--help
Security, Auth & Guardrails
None required; read-only local source and Git repository counter.
100% free, offline, and open-source (GPL-2.0-or-later).
# 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
cloc --json --quiet --exclude-dir=node_modules,dist .
Outputs clean JSON totals for files, blank lines, comments, and code across languages.
cloc --git --diff main HEAD --json --quiet
Reports added, modified, removed, and unchanged lines between main and HEAD.
Strengths for Agents
- + Clean
--json --quietoutput covering 300+ languages. - +
--git --diffcomputes structured added/removed/modified LOC deltas between commits.
Caveats & Pitfalls
- ! Written in Perl, so it is noticeably slower than
tokeiorsccon very large monorepos. - ! Does not skip
node_modulesautomatically unless--exclude-diror--vcs=gitis passed.