>_

cloc

agent-ready json output non-interactive

cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.

How to install cloc

npm install -g cloc

cloc use case

Analyze source code repositories to count lines of code, comments, and blanks by language and file type.

When to use cloc

  • When you need a quick breakdown of a codebase by programming language and line types (code, comments, blanks).
  • When estimating project size or complexity for planning or reporting.
  • When auditing or analyzing codebases for comment-to-code ratios or license header counts.

When not to use cloc

  • For deep static analysis like detecting bugs, security vulnerabilities, or code smells.
  • When you need to count lines of code in a non-text binary file or compiled code.

cloc features

  • · Counts blank lines, comment lines, and physical lines of code across many programming languages.
  • · Supports counting entire directories, single files, tarballs, zip archives, and git repositories.
  • · Outputs results in multiple formats including plain text, JSON, CSV, XML, and YAML.
  • · Automatically detects languages by file extension and shebang lines with customizable language definitions.

Want your agent to find this automatically?

Add the MCP server to your agent config and it will discover tools like cloc on its own.

Set up MCP →

Similar tools to cloc