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, .gitignore parsing
  • Analyzers (analyzers/) — Modular analysis components:
    • filesystem.ts — Builds the file tree
    • languages.ts — Detects languages by extension (extensible registry)
    • statistics.ts — Calculates file/dir stats, largest files, extension counts
    • tests.ts — Detects test files and testing frameworks
    • dependencies.ts — Parses dependency manifests
    • git.ts — Analyzes git history and PR changes
    • important-files.ts — Detects README, LICENSE, configs, GitHub files
    • security.ts — Filters sensitive files
  • Generators (generators/) — Output formatters:
    • json.ts — JSON output
    • markdown.ts — Markdown report
    • svg.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

  1. No AI — Everything is deterministic
  2. No external APIs — Analysis runs entirely from local files
  3. No file contents — Only metadata is analyzed
  4. Extensible — New analyzers implement the Analyzer interface
  5. Fast — Streaming traversal, size limits, no unnecessary file reads
  6. Zero-cost — Runs in GitHub Actions, no paid services