facet-dev is a comprehensive development automation tool for Rust workspaces. It integrates seamlessly as a pre-commit hook and handles repetitive project setup, code generation, and CI/CD configuration automatically.
facet-dev automates the following tasks:
- README Generation: Generates
README.mdfiles fromREADME.md.intemplates with customizable headers and footers - Code Formatting: Runs
cargo fmtto enforce consistent code style - Pre-push Verification: Validates code before pushing (via
facet-dev pre-push):- Runs clippy for linting
- Executes tests
- Checks documentation compilation
- Verifies all crates in workspace
- MSRV Consistency: Ensures all crates have the same Minimum Supported Rust Version
- Rust Documentation: Auto-generates rustdoc configuration
Install facet-dev from crates.io:
cargo install facet-devOr build from source:
cargo install --git https://github.com/facet-rs/facet-devRun facet-dev in your workspace root to generate/update all project files:
facet-devThis will:
- Generate
README.mdfor the workspace and all crates - Format code with
cargo fmt - Stage all changes with
git add
Before pushing to a remote repository, run:
facet-dev pre-pushThis performs comprehensive checks:
- Runs
cargo clippyon all crates - Executes
cargo test - Validates documentation with
cargo doc - Ensures MSRV consistency
Specify a custom directory for looking up README.md.in templates:
facet-dev --template-dir /path/to/templatesThis searches for {crate_name}.md.in files in the specified directory, falling back
to the crate's own template if not found.
View workspace metadata and package information:
facet-dev debug-packagesEach crate should have a README.md.in file in its directory. The generated README.md
combines three parts:
- Header (with badges and links)
- Main Content (from
README.md.in) - Footer (with sponsors and license information)
To customize the README header and footer templates project-wide, create a .facet-dev-templates
directory at your workspace root with custom templates:
.facet-dev-templates/
├── readme-header.md
└── readme-footer.mdHeader Template Example (readme-header.md):
# {CRATE}
[](https://github.com/your-org/{CRATE}/actions)
[](https://crates.io/crates/{CRATE})The {CRATE} placeholder will be replaced with the actual crate name.
Footer Template Example (readme-footer.md):
## License
Licensed under the MIT License.If these files don't exist, facet-dev uses the built-in default templates.
For README.md.in templates (main content):
- Custom directory specified via
--template-dir(if provided) - Crate's own
README.md.infile (in the crate directory) - Workspace-level
README.md.in(for the workspace README)
facet-dev includes a helper script to install git hooks for the repository and all worktrees. This is typically done automatically during initial setup, but you can run it manually:
./scripts/setup.shThis installs hooks that:
- pre-commit: Runs
facet-devto auto-generate and stage files - pre-push: Runs
facet-dev pre-pushfor comprehensive validation
facet-dev can be configured via [package.metadata.facet-dev] or [workspace.metadata.facet-dev] in your Cargo.toml. Package metadata takes precedence over workspace metadata.
# For single-crate projects:
[package.metadata.facet-dev]
generate-readmes = false # Disable README generation (default: true)
clippy = false # Disable clippy checks on pre-push
# For workspaces (applies to all crates):
[workspace.metadata.facet-dev]
generate-readmes = falseAll options default to true. Set to false to disable.
| Option | Description |
|---|---|
generate-readmes |
Generate README.md files from templates |
rustfmt |
Run cargo fmt to format code |
cargo-lock |
Stage Cargo.lock changes |
arborium |
Set up arborium syntax highlighting for docs |
rust-version |
Enforce consistent MSRV across crates |
| Option | Description |
|---|---|
clippy |
Run cargo clippy with warnings as errors |
nextest |
Run tests via cargo nextest |
doc-tests |
Run documentation tests |
docs |
Build documentation with warnings as errors |
cargo-shear |
Check for unused dependencies |
When facet-dev runs, it automatically stages all generated files with git add.
If facet-dev is updated mid-development, the new changes might appear in an unrelated PR.
This is by design—keep facet-dev stable during active work.
Your project should:
- Be a Rust workspace or single crate with
Cargo.toml - Have git initialized
- Have
README.md.intemplate files for any crates you want documented
Thanks to all individual sponsors:
...along with corporate sponsors:
...without whom this work could not exist.
The facet logo was drawn by Misiasart.
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.