A powerful and user-friendly CLI tool for analyzing code statistics. Count lines of code, files, and get detailed breakdowns by programming language.
- π Detailed Statistics: Count lines of code and files by language
- π¨ Beautiful Output: Colorized tables with percentages and formatting
- π Fast & Efficient: Optimized for large codebases
- π Progress Indicators: Visual progress bar for long-running scans
- π Smart Filtering: Automatic support for
.gitignoreand.codemeterignore - π Multiple Formats: Output as table or JSON
- πΎ Export Results: Save output to files
- π Language Detection: Recognizes 50+ programming languages
npm install -g codemeterAnalyze the current directory:
codemeterOr specify a directory:
codemeter srcSkip specific directories using the --skip-dir option:
codemeter . --skip-dir node_modules .git distSkip files by their extension using the --skip-ext option:
codemeter . --skip-ext log txt mdYou can combine with directory skipping:
codemeter . --skip-dir node_modules --skip-ext log txtFor large projects, use the progress bar:
codemeter . --progressTable format (default):
codemeter . --format tableJSON format:
codemeter . --format jsonSave results to a file:
codemeter . --output report.txt
codemeter . --format json --output report.jsonBy default, CodeMeter respects .gitignore files. To disable this:
codemeter . --no-gitignoreShow detailed information about the analysis:
codemeter . --verbose| Option | Short | Description |
|---|---|---|
--skip-dir <dirs...> |
-s |
Directories to skip (space-separated) |
--skip-ext <exts...> |
-e |
File extensions to skip (space-separated, e.g., --skip-ext log txt) |
--progress |
-p |
Show progress bar while scanning |
--format <format> |
-f |
Output format: table (default) or json |
--output <file> |
-o |
Save output to a file |
--no-gitignore |
Don't use .gitignore and .codemeterignore files | |
--verbose |
Show verbose output | |
--version |
-v |
Display version number |
--help |
-h |
Display help information |
CodeMeter automatically respects .gitignore files in your project. Files and directories listed in .gitignore will be excluded from analysis.
Create a .codemeterignore file in your project root to specify additional files or patterns to exclude. This file uses the same syntax as .gitignore.
Example .codemeterignore:
# Exclude test files
**/*.test.js
**/*.spec.js
# Exclude generated files
**/generated/
**/*.min.js
# Exclude documentation
docs/
*.md
βββββββββββββββββββββββββββ¬βββββββββββ¬ββββββββββββββββ¬βββββββββ
β Language β Files β Lines β % β
βββββββββββββββββββββββββββΌβββββββββββΌββββββββββββββββΌβββββββββ€
β JavaScript (.js) β 45 β 12,345 β 45.2% β
β TypeScript (.ts) β 23 β 8,901 β 32.6% β
β CSS (.css) β 12 β 2,456 β 9.0% β
β HTML (.html) β 8 β 1,234 β 4.5% β
β JSON (.json) β 15 β 2,345 β 8.6% β
βββββββββββββββββββββββββββΌβββββββββββΌββββββββββββββββΌβββββββββ€
β TOTAL β 103 β 27,281 β 100.0% β
βββββββββββββββββββββββββββ΄βββββββββββ΄ββββββββββββββββ΄βββββββββ
{
"languages": [
{
"extension": "js",
"language": "JavaScript",
"files": 45,
"lines": 12345,
"percentage": "45.23"
},
...
],
"totals": {
"files": 103,
"lines": 27281
}
}CodeMeter recognizes 50+ programming languages including:
- JavaScript/TypeScript (JS, TS, JSX, TSX)
- Python, Java, C/C++, C#, Go, Rust
- PHP, Ruby, Swift, Kotlin
- HTML, CSS, SCSS, Sass, Less
- Shell scripts (Bash, Zsh, Fish)
- Configuration files (JSON, YAML, XML, TOML)
- And many more...
codemeter . --skip-dir node_modules .next --progresscodemeter . --format json --output code-stats.jsoncodemeter . --skip-dir node_modules dist build --no-gitignorecodemeter . --skip-ext log txt md jsoncodemeter src --verbose- Use progress bar for large projects: Add
--progresswhen analyzing large codebases - Create .codemeterignore: Use it to exclude test files, generated code, or documentation
- JSON format for automation: Use
--format jsonfor programmatic access to results - Combine options: Mix and match options for your specific needs
- Node.js >= 16
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
Kritebh Lagan Bibhakar
- GitHub: @kritebh
- Homepage: https://github.com/kritebh/codemeter
