Architecture
Overview
RepoMetro is built as a monorepo with npm workspaces. The core analysis engine is shared with the GitHub Action — no analysis logic is duplicated.
Packages
@repometro/core
The heart of RepoMetro. Contains:
- Scanner (
scanner/) — File system traversal, binary detection, line counting,.gitignoreparsing - Analyzers (
analyzers/) — Modular analysis components:filesystem.ts— Builds the file treelanguages.ts— Detects languages by extension (extensible registry)statistics.ts— Calculates file/dir stats, largest files, extension countstests.ts— Detects test files and testing frameworksdependencies.ts— Parses dependency manifestsgit.ts— Analyzes git history and PR changesimportant-files.ts— Detects README, LICENSE, configs, GitHub filessecurity.ts— Filters sensitive files
- Generators (
generators/) — Output formatters:json.ts— JSON outputmarkdown.ts— Markdown reportsvg.ts— SVG visualizations
@repometro/action
GitHub Action entry point. Uses @actions/core and @actions/github for GitHub integration, including PR comments.
Data Flow
Repository files
↓
Scanner (traverse, filter, classify)
↓
Analyzers (languages, stats, tests, deps, git)
↓
RepoMetroData (the JSON structure)
↓
Generators (JSON, Markdown, SVG)
↓
Artifacts / PR comments
Design Principles
- No AI — Everything is deterministic
- No external APIs — Analysis runs entirely from local files
- No file contents — Only metadata is analyzed
- Extensible — New analyzers implement the
Analyzerinterface - Fast — Streaming traversal, size limits, no unnecessary file reads
- Zero-cost — Runs in GitHub Actions, no paid services