codemeter
v0.0.3
Published
A CLI tool for code analysis. Counts lines and files
Downloads
127
Maintainers
Readme
CodeMeter 📊
A powerful and user-friendly CLI tool for analyzing code statistics. Count lines of code, files, and get detailed breakdowns by programming language.

Features ✨
- 📈 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
Installation
npm install -g codemeterUsage
Basic Usage
Analyze the current directory:
codemeterOr specify a directory:
codemeter srcSkip Directories
Skip specific directories using the --skip-dir option:
codemeter . --skip-dir node_modules .git distSkip File Extensions
Skip 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 txtShow Progress
For large projects, use the progress bar:
codemeter . --progressOutput Formats
Table format (default):
codemeter . --format tableJSON format:
codemeter . --format jsonSave to File
Save results to a file:
codemeter . --output report.txt
codemeter . --format json --output report.jsonIgnore .gitignore
By default, CodeMeter respects .gitignore files. To disable this:
codemeter . --no-gitignoreVerbose Mode
Show detailed information about the analysis:
codemeter . --verboseOptions
| 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 |
Ignore Files
.gitignore Support
CodeMeter automatically respects .gitignore files in your project. Files and directories listed in .gitignore will be excluded from analysis.
.codemeterignore
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/
*.mdOutput Examples
Table Output
┌─────────────────────────┬──────────┬───────────────┬────────┐
│ 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% │
└─────────────────────────┴──────────┴───────────────┴────────┘JSON Output
{
"languages": [
{
"extension": "js",
"language": "JavaScript",
"files": 45,
"lines": 12345,
"percentage": "45.23"
},
...
],
"totals": {
"files": 103,
"lines": 27281
}
}Supported Languages
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...
Examples
Analyze a React Project
codemeter . --skip-dir node_modules .next --progressGenerate JSON Report
codemeter . --format json --output code-stats.jsonAnalyze with Custom Ignores
codemeter . --skip-dir node_modules dist build --no-gitignoreSkip Specific File Types
codemeter . --skip-ext log txt md jsonQuick Analysis
codemeter src --verboseTips 💡
- 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
Requirements
- Node.js >= 16
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
Author
Kritebh Lagan Bibhakar
- GitHub: @kritebh
- Homepage: https://github.com/kritebh/codemeter
