# Sprawl Guard

Keep source files and directories within explicit size limits, in any language that Tokei supports.

Keep source files and directories within explicit size limits, in <a href="#supported-languages">any* language</a>

- [Get started](/sprawl-guard/quick-start.md)
- [Browse reference](/sprawl-guard/reference/cli-and-output.md)

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](https://github.com/XAMPPRocky/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.)

<a id="supported-languages"></a>\* 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?

If all you're looking for is line-count limits for JavaScript or TypeScript, simply use the
`max-lines` rule in [ESLint](https://eslint.org/docs/latest/rules/max-lines) or
[Oxlint](https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-lines).

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](/sprawl-guard/quick-start.md#start-from-a-max-lines-rule).

Browse the [source](https://github.com/kpozin/sprawl-guard) and
[releases](https://github.com/kpozin/sprawl-guard/releases), or
[open an issue](https://github.com/kpozin/sprawl-guard/issues).
