Skip to content

feat: add bootcamp metrics command for standalone codebase metrics#58

Merged
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/metrics-command
Jun 11, 2026
Merged

feat: add bootcamp metrics command for standalone codebase metrics#58
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/metrics-command

Conversation

@Arthur742Ramos

Copy link
Copy Markdown
Owner

Summary

Adds a bootcamp metrics <repo-url> command โ€” the codebase-metrics counterpart to bootcamp health.

The project already exposes the HEALTH.md engine as a standalone, LLM-free bootcamp health command. The parallel METRICS.md engine (computeCodebaseMetrics) had no standalone equivalent โ€” you could only get those metrics by running a full generation. This closes that asymmetry.

What it reports

Scans any repo (local path or remote URL) and reports the deterministic metrics that power METRICS.md:

  • Language breakdown with percentage bars
  • Composition โ€” source / test / doc / config / other file counts
  • Sizing โ€” total/average/median file size, size class, test-to-source ratio
  • Top-level directory distribution
  • Largest-file hotspots (review targets)
  • Approachability score (0โ€“100 + Aโ€“F grade) with human-readable drivers
$ bootcamp metrics ./my-repo
๐Ÿ“Š Codebase Metrics
Repository: local/my-repo
196 files ยท 2.8 MB ยท size class: small

๐ŸŸข Approachability 82/100 (Grade: B)
  โ€ข Compact codebase (56 source files) is quick to navigate
  โ€ข Healthy test-to-source ratio (1.36)
  ...
Languages
  TypeScript     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 99.9% (130 files)
  ...

Flags

  • --json โ€” full CodebaseMetrics payload for scripting
  • --check / --min-score โ€” CI gate on the approachability score (exit non-zero when below)
  • --branch, --max-files (routed past root-command flag collisions, same as health), --keep-temp, --verbose

Implementation

Mirrors health-command.ts in structure and reuses computeCodebaseMetrics verbatim, so the command output can never drift from METRICS.md. Repo resolution, scanning, cleanup, and the --check gate all follow the established pattern.

Testing

  • 9 unit tests (DI-mocked resolve/scan/compute): report, --json, --check both directions, custom --max-files, local path, --keep-temp, scan-failure cleanup, resolve-failure.
  • 4 E2E tests spawning the real CLI against a multi-language fixture: human report, JSON shape, --check gate (pass + fail), and --max-files routing.
  • Full suite green: npm test โ†’ 1115 passing; typecheck + lint + build clean.

๐Ÿค– Generated with Claude Code

`bootcamp health` already exposes the HEALTH.md engine as a standalone,
LLM-free command โ€” but the parallel METRICS.md engine had no equivalent. This
closes that gap.

`bootcamp metrics <repo-url>` (local path or remote URL) scans the repo and
reports the deterministic codebase metrics that power METRICS.md: language
breakdown, source/test/doc/config composition, average/median file size,
test-to-source ratio, size classification, top-level directory distribution,
largest-file hotspots, and an approachability score (0-100 + A-F grade) with
human-readable drivers.

- Human-readable report by default (language bars, distribution, hotspots)
- `--json` for scripting (full CodebaseMetrics payload)
- `--check`/`--min-score` CI gate on the approachability score
- `--branch`, `--max-files` (routed past root-flag collisions like `health`),
  `--keep-temp`, `--verbose`

Mirrors `health-command.ts` in structure and reuses `computeCodebaseMetrics`
verbatim, so the command can never drift from METRICS.md.

Tests: 9 unit (DI-mocked: report/JSON/check/local/keep-temp/scan-failure/
resolve-failure), 4 E2E spawning the real CLI (human report, JSON, --check
gate both directions, --max-files routing).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Arthur742Ramos Arthur742Ramos merged commit a61124e into main Jun 11, 2026
13 checks passed
@Arthur742Ramos Arthur742Ramos deleted the arthur742ramos/metrics-command branch June 11, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

โšก