scl339-codebase-analyzer
v1.0.0
Published
Analyze local codebases and generate beautiful HTML statistics reports — file counts, language distribution, lines of code, comment ratios, and complexity estimates
Downloads
165
Maintainers
Readme
scl339-codebase-analyzer
Analyze local codebases and generate beautiful HTML statistics reports in seconds.
Features
- 📊 Comprehensive stats — file count, language distribution, lines of code, comment ratio, blank lines
- 🧠 Smart analysis — per-language comment detection, cyclomatic complexity estimate
- 🎨 Beautiful dark-themed HTML report — interactive, responsive, ready to share
- 🚀 Fast — walks your project directory efficiently with smart exclusions (node_modules, .git, etc.)
- 🔧 Customizable — add exclude patterns, control output path
Quick Start
# Analyze the current directory
npx scl339-codebase-analyzer analyze .
# Analyze a specific project
npx scl339-codebase-analyzer analyze /path/to/project
# Specify output file
npx scl339-codebase-analyzer analyze . -o my-report.html
# Console-only mode (no HTML)
npx scl339-codebase-analyzer analyze . --no-html
# Exclude additional patterns
npx scl339-codebase-analyzer analyze . --exclude "*.log" "temp"Output
The command produces two outputs:
Console Report — a colorized summary showing:
- Total files, lines, code lines, comments, blanks
- Comment rate and complexity estimate
- Per-language breakdown with visual bars
HTML Report (
codebase-report.htmlby default) — a beautiful dark-themed page with:- Stats cards for all metrics
- Language distribution with colored bars
- Detailed code/comment/blank breakdown per language
Example HTML Report Screenshot
The report features a GitHub-dark theme with:
- Gradient stat cards with hover effects
- Language bars with GitHub-style colors
- Responsive layout (mobile-friendly)
- Cross-links to related SCL339 projects
CLI Options
Usage: scl339-codebase-analyzer analyze [options] [path]
Analyze a codebase and generate a report
Arguments:
path Path to the codebase directory (default: ".")
Options:
-o, --output <path> Output HTML file path (default: "codebase-report.html")
--no-html Skip HTML generation, output to console only
--exclude <patterns...> Additional exclude patterns (glob)
-h, --help Display help for commandSupported Languages
JavaScript, TypeScript, JSX, TSX, Python, Ruby, Java, Go, Rust, C, C++, C#, Swift, Kotlin, Scala, PHP, Shell, Bash, Zsh, YAML, JSON, XML, HTML, CSS, SCSS, Less, Markdown, SQL, Dockerfile, TOML, Vue, Svelte, and more.
How It Works
- Walks the directory tree, excluding common build/artifact directories
- Classifies files by extension into supported languages
- Analyzes each file for total lines, code lines, comments, blanks
- Estimates cyclomatic complexity by counting control flow keywords
- Generates a console report and an HTML report
Related SCL339 Projects
- scl339-mcp-server — MCP (Model Context Protocol) server scaffolding CLI
Sponsorship
If you find this project useful, please consider sponsoring via Alipay:
Alipay Account: 18559219554
Your support helps maintain and improve this project!
License
MIT © SCL339
