Sprawl Guard
Coding agents (and some coding humans!) like to crowd code into giant, unnavigable files and messy flat directories with little organization. To help battle this entropy, Sprawl Guard counts the lines in each file (using Tokei) and the source files directly inside each directory, and enforces limits that you set.
(Sprawl Guard can only admonish your agent when it goes over the limits; proper reorganization requires reasoning.)
* Sprawl Guard supports every language bundled with Tokei,
including Rust, TypeScript, JavaScript, Python, Go, Java, Kotlin, Swift, C, and C++. Run
sprawl-guard languages for the complete list.
Sprawl Guard or ESLint?
Section titled “Sprawl Guard or ESLint?”If all you’re looking for is line-count limits for JavaScript or TypeScript, simply use the
max-lines rule in ESLint or
Oxlint.
Choose Sprawl Guard when you also want:
- support for polyglot repositories
- a ratchet that allows existing oversized files and crowded directories to shrink but not grow
- separate limits for production and test code
- limits on the number of direct files per directory
- byte limits on (binary) file sizes
If you already use max-lines, Sprawl Guard can
import its limit and existing exemptions.
Browse the source and releases, or open an issue.