{"id":13512345,"url":"https://github.com/numtide/treefmt","last_synced_at":"2025-05-14T09:11:38.069Z","repository":{"id":39621075,"uuid":"322563105","full_name":"numtide/treefmt","owner":"numtide","description":"one CLI to format your repo [maintainers=@zimbatm,@brianmcgee]","archived":false,"fork":false,"pushed_at":"2025-05-12T14:13:53.000Z","size":4223,"stargazers_count":734,"open_issues_count":50,"forks_count":43,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-12T15:31:10.760Z","etag":null,"topics":["buildbot-numtide","cli","formatter","treefmt","unifies"],"latest_commit_sha":null,"homepage":"https://treefmt.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numtide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-18T10:30:54.000Z","updated_at":"2025-05-12T14:13:56.000Z","dependencies_parsed_at":"2023-12-18T18:49:53.388Z","dependency_job_id":"1c338a14-443e-4365-9813-e5b27c083658","html_url":"https://github.com/numtide/treefmt","commit_stats":{"total_commits":419,"total_committers":14,"mean_commits":"29.928571428571427","dds":0.3627684964200477,"last_synced_commit":"2dcfe67bbe190b77d4a646c4ba27af1280bb17f9"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Ftreefmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Ftreefmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Ftreefmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Ftreefmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtide","download_url":"https://codeload.github.com/numtide/treefmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110374,"owners_count":22016391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buildbot-numtide","cli","formatter","treefmt","unifies"],"created_at":"2024-08-01T03:01:45.109Z","updated_at":"2025-05-14T09:11:38.052Z","avatar_url":"https://github.com/numtide.png","language":"Go","readme":"\u003cdiv align=\"center\"\u003e\n\n# treefmt\n\n\u003cimg src=\"docs/site/assets/images/logo.svg\" height=\"150\"/\u003e\n\n**The formatter multiplexer**\n\n_A \u003ca href=\"https://numtide.com/\"\u003enumtide\u003c/a\u003e project._\n\n\u003cp\u003e\n\u003ca href='https://coveralls.io/github/numtide/treefmt?branch=main'\u003e\u003cimg src='https://coveralls.io/repos/github/numtide/treefmt/badge.svg?branch=main' alt='Coverage Status' /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/numtide/treefmt/actions/workflows/release.yml\"\u003e\u003cimg src=\"https://github.com/numtide/treefmt/actions/workflows/release.yml/badge.svg\"/\u003e\u003c/a\u003e\n\u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/status-beta-yellow\"\u003e\n\u003ca href=\"https://app.element.io/#/room/#home:numtide.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/Support-%23numtide-blue\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c/div\u003e\n\n`treefmt` streamlines the process of applying formatters to your project, making it a breeze with just one command line.\n\n## Motivation\n\nModern code repositories are rarely written in a single language. They often contain a mix of languages, each with its own formatting requirements.\n\nWhile working for our customers, we noticed that projects each tended to re-implement the same formatter multiplexing logic. A script that invokes all the formatters.\n\nWhat if that script was a single command?\n\nWhat if that single command would handle all the formatters in parallel? And only format files that have changed since the previous run?\n\nThat's what treefmt is about.\n\n## About treefmt\n\n`treefmt` runs all your formatters with one command. It’s easy to configure and fast to execute.\n\n![Treefmt Init](docs/site/assets/images/init.gif)\n\nIts main features are:\n\n- **Providing a unified CLI and output**\n    - You don’t need to remember which formatters are necessary for each project.\n    - Once you specify the formatters in the config file, you can trigger all of them with one command and get a\n      standardized output.\n- **Running all the formatters in parallel**\n    - A standard script loops over your folders and runs each formatter sequentially.\n    - In contrast, `treefmt` runs formatters in parallel. This way, the formatting job takes less time.\n- **Tracking file changes**\n    - When formatters are run in a script, they process all the files they encounter, regardless of whether or not\n      they have changed.\n    - `treefmt` tracks file changes, and only attempts to format files which have changed.\n\nTo reformat the whole source tree, just type `treefmt` in any folder. This is a fast and simple formatting solution.\n\n## Installation\n\nYou can install `treefmt` by downloading the binary. Find the binaries for different architectures [here](https://github.com/numtide/treefmt/releases).\nOtherwise, you can install the package from source code — either with [Go], or with the help of [nix].\n\nWe describe the installation process in detail in the [docs].\n\n## Usage\n\nIn order to use `treefmt` in your project, make sure the config file `treefmt.toml` is present in the root folder and\nis edited to suit your needs.\n\nYou can generate it with:\n\n```\n$ treefmt --init\n```\n\nYou can then run `treefmt` in your project root folder like this:\n\n```\n$ treefmt\n```\n\nTo explore the tool’s flags and options, type:\n\n```console\n$ treefmt --help\n```\n\nAdditionally, there's a wrapper called [`treefmt-nix`](https://github.com/numtide/treefmt-nix) for using `treefmt` with [`nix`](https://github.com/NixOS/nix).\n\n## Configuration\n\nFormatters are specified in the config file `treefmt.toml`, which is usually located in the project root folder. The\ngeneric way to specify a formatter is like this:\n\n```\n[formatter.\u003cname\u003e]\ncommand = \"\u003cformatter-command\u003e\"\noptions = [\"\u003cformatter-option-1\u003e\"...]\nincludes = [\"\u003cglob\u003e\"]\n```\n\nFor example, if you want to use [nixpkgs-fmt] on your Nix project and rustfmt on your Rust project, then\n`treefmt.toml` will look as follows:\n\n```toml\n[formatter.nix]\ncommand = \"nixpkgs-fmt\"\nincludes = [\"*.nix\"]\n\n[formatter.rust]\ncommand = \"rustfmt\"\noptions = [\"--edition\", \"2018\"]\nincludes = [\"*.rs\"]\n```\n\nBefore specifying the formatter in the config, make sure it’s installed.\n\nTo find and share existing formatter recipes, take a look at the [docs].\n\nIf you are a Nix user, you might also be interested in [treefmt-nix](https://github.com/numtide/treefmt-nix) to use Nix to configure and bring in\nformatters.\n\n## Compatibility\n\n`treefmt` works with any formatter that adheres to the [following specification](https://github.com/numtide/treefmt/blob/main/docs/site/reference/formatter-spec.md).\n\nFor instance, you can go for:\n\n- [clang-format] for C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C#\n- gofmt for Golang\n- Prettier for JavaScript/HTML/CSS\n\nYou can find information on supported formatters [here](https://treefmt.com/latest/getting-started/configure/#supported-formatters).\n\n## IDE Integration\n\n`treefmt` currently has support for vscode via an extension:\n\n- [treefmt-vscode](https://marketplace.visualstudio.com/items?itemName=ibecker.treefmt-vscode) | [GitHub repo](https://github.com/isbecker/treefmt-vscode)\n\n## Upcoming features\n\nThis project is still pretty new. Down the line we also want to add support for:\n\n- More IDE integration\n- Pre-commit hooks\n\n## Related projects\n\n- [EditorConfig](https://editorconfig.org/): unifies file indentations configuration on a per-project basis.\n- [prettier](https://prettier.io/): an opinionated code formatter for a number of languages.\n- [Super-Linter](https://github.com/github/super-linter): a project by GitHub to lint all of your code.\n- [pre-commit](https://pre-commit.com/): a framework for managing and maintaining multi-language pre-commit hooks.\n\n## Contributing\n\nAll contributions are welcome! We try to keep the project simple and focused. Please refer to the [Contributing](docs/site/contributing/code.md)\nguidelines for more information.\n\n## Commercial support\n\nLooking for help or customization?\n\nGet in touch with [Numtide](https://numtide.com/) to get a quote. We make it easy for companies to work with Open\nSource projects: \u003chttps://numtide.com/contact\u003e\n\n## License\n\nUnless explicitly stated otherwise, any contribution intentionally submitted for inclusion will be licensed under the\n[MIT license](LICENSE) without any additional terms or conditions.\n\n[Brian]: https://github.com/brianmcgee\n[zimbatm]: https://github.com/zimbatm\n[Version 1]: https://github.com/numtide/treefmt/tree/v1\n[Rust]: https://www.rust-lang.org/\n[Go]: https://go.dev/\n[Toml]: https://toml.io/en/\n[docs]: https://treefmt.com\n[nix]: https://github.com/NixOS/nix\n[nixpkgs-fmt]: https://github.com/nix-community/nixpkgs-fmt\n[clang-format]: https://clang.llvm.org/docs/ClangFormat.html\n","funding_links":[],"categories":["Go","Rust","Command-Line Tools"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Ftreefmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtide%2Ftreefmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Ftreefmt/lists"}