Skip to content

About

machin CLI that classifies codebases by LOC and publishes hart reports

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

codebase-size

A native machin CLI that measures a codebase, classifies it by size, and publishes a self-contained HTML report to hart.intrane.fr via machin-hart.

It delegates counting to sloc-guard so it does not re-implement SLOC parsing. The added value is the size class and mass score — a single number/name pair that tells an AI agent (or a human) how heavy the codebase is and how much context it will cost.

Build

Needs machin and a C compiler on PATH.

./build.sh

This embeds report.html, mints codebase-size.mfl, and compiles to a static native binary named codebase-size.

Usage

# print a text summary to stdout
./codebase-size /path/to/repo

# write a local HTML report
./codebase-size /path/to/repo --html report.html

# publish directly to hart (interactive link)
./codebase-size /path/to/repo \
  --hart --owner my-name --artifact my-project

# compare two codebases side-by-side
./codebase-size /path/to/repo --compare /path/to/other/repo --html compare.html
./codebase-size /path/to/repo --compare /path/to/other/repo \
  --hart --owner my-name --artifact my-comparison

# list all hart reports shipped by an owner
./codebase-size --list --owner my-name
./codebase-size --list --owner my-name --json

# machine-readable JSON summary
./codebase-size /path/to/repo --json

Size classification

Mass score = size-class base score + a small bloat penalty for files over 500 LOC.

class code lines mass score meaning
Fragment < 1 000 0–10 fits in a single prompt
Snippet 1k – 10k 10–25 one person can rewrite it in a day
Module 10k – 50k 25–45 small team, well-contained
Service 50k – 100k 45–60 typical microservice territory
Platform 100k – 250k 60–75 context must be chunked
Monolith 250k – 500k 75–90 no agent can load it all
Megasystem 500k – 1M 90–98 requires architectural decomposition
Galaxy > 1M 98–100 multiple products / decades of growth

Layout

codebase-size/
├── codebase-size.src   # MFL source: CLI, scanning, scoring
├── src/
│   ├── report.src      # single-repo report formatting
│   └── compare.src     # two-repo comparison report formatting
├── report.html         # single-repo HTML template
├── compare.html        # comparison HTML template
├── build.sh            # embeds templates, mints .mfl, compiles binary
├── README.md           # this file
├── AGENTS.md           # agent notes
└── .gitignore

src/*_template.src, codebase-size.mfl, and the codebase-size binary are generated by build.sh and should not be committed.

About

machin CLI that classifies codebases by LOC and publishes hart reports

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages