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
