Analyzers
RepoMetro uses eight modular analyzers. Each implements the Analyzer interface and runs on the scanned file list.
Analyzer Interface
interface Analyzer {
id: string;
name: string;
analyze(context: AnalysisContext): AnalysisResult;
}
Filesystem (filesystem.ts)
Builds a recursive tree structure from the flat file list. Each node is either a directory or a file, with metadata (name, path, extension, size, line count).
Languages (languages.ts)
Detects programming languages by file extension. Supports 25+ languages including TypeScript, JavaScript, Python, Go, Rust, Java, C, C++, Ruby, PHP, Swift, Kotlin, and more. Each language has a GitHub-style color for visualizations.
The registry is extensible — add a new entry to LANGUAGE_REGISTRY to support a new extension:
'.xyz': { language: 'MyLanguage', color: '#hexcolor' },
Statistics (statistics.ts)
Calculates:
- Total file count, directory count, line count, and total size
- Largest files (sorted by size)
- Largest directories (by file count and total size)
- Files grouped by extension
- Counts of test, documentation, and configuration files
Tests (tests.ts)
Detects test files and test directories:
- Files matching
.test.*,.spec.*,*_test.*,test_*.* - Directories named
test/,tests/,__tests__/ - Frameworks detected from config files (vitest, jest, pytest, go test, cargo test, etc.)
Dependencies (dependencies.ts)
Parses dependency manifests:
package.json(npm)requirements.txt(pip)Cargo.toml(Rust)go.mod(Go)pom.xml/build.gradle(Java)composer.json(PHP)Gemfile(Ruby)pubspec.yaml(Dart)
Counts dependencies and dev-dependencies per manifest.
Git (git.ts)
Analyzes git history using the git CLI:
- Current branch name
- Total commit count
- Latest commit (SHA, message, author, date)
- Top contributors (by commit count)
- Recent activity (commits per day)
- PR change data (files changed, additions, deletions, changed tree) when running on a pull request
Uses GitHub Actions environment variables (GITHUB_*) for PR detection.
Important Files (important-files.ts)
Detects key repository files:
- README, LICENSE, CHANGELOG
- Configuration files (tsconfig, eslint, prettier, etc.)
- GitHub-specific files (CODEOWNERS, workflows, issue templates)
- CI/CD configuration
Security (security.ts)
Filters sensitive files from the output. Detects and excludes:
.envand.env.*files- Private keys (
.pem,.key,id_rsa) - Credential files
- Certificate files (
.p12,.pfx)
These files are detected but their contents are never included — RepoMetro only ever processes metadata, not file contents.