treefmt

The formatter multiplexer.

treefmt streamlines running multiple code formatters across a repository with a single command. It provides a unified CLI, runs formatters in parallel, and only processes files that changed.

Highlights

  • Unified CLI and output: trigger all configured formatters at once.
  • Parallel execution: faster runs versus sequential scripts.
  • Change tracking: formats only modified files.

Install

Download prebuilt binaries from the releases page, or install from source with Go or via Nix.

Releases: github.com/numtide/treefmt/releases

Quick start

Initialize a config file and format your repo:

treefmt --init
treefmt

Discover flags and options:

treefmt --help

Configuration

Define formatters in treefmt.toml at the project root. Example:

[formatter.nix]
command = "nixpkgs-fmt"
includes = ["*.nix"]
[formatter.rust]
command = "rustfmt"
options = ["--edition", "2018"]
includes = ["*.rs"]

See the formatter spec and supported tools attreefmt.com.

Integrations