Automation tasks for RustyWind development, written in Rust.
This crate provides developer automation tools for the RustyWind project, replacing the previous Python scripts with native Rust implementations. All tasks can be run using cargo xtask <command>.
Compare RustyWind against immutable snapshots of real-world JSX, TSX, Svelte, and Astro Tailwind projects.
# compare every corpus
cargo xtask compare run
# compare selected corpora
cargo xtask compare run --corpus shadcn-ui --corpus astrowind
# reuse cached repositories and npm packages without network access
cargo xtask compare run --offlineThe command builds the release binary, installs the pinned comparison harness with
npm ci, checks out each corpus at its exact revision, and writes aggregate reports
to target/tailwind-compare/results/.
Set up the fuzz test environment by building the RustyWind release binary and installing npm dependencies.
cargo xtask fuzz setupWhat it does:
- Builds RustyWind with
cargo build --release - Installs npm dependencies with
npm installintests/fuzz - Verifies that all prerequisites are in place
Note: The fuzz run command automatically runs setup if needed, so you typically don't need to run this manually. However, it's useful if you want to prepare the environment before running tests.
Run fuzz tests in parallel with automatic failure analysis.
# run 25 rounds (default) with auto-detected workers
cargo xtask fuzz run
# run 100 rounds
cargo xtask fuzz run 100
# run 50 rounds with 4 workers
cargo xtask fuzz run 50 --workers 4What it does:
- Automatically runs setup if needed (builds binary + installs npm deps)
- Pre-flight checks (RustyWind binary, npm, node_modules)
- Runs fuzz tests in parallel with progress bar
- Tracks pass/fail counts
- Generates aggregate statistics:
- Total tests, passed, failed counts
- Overall pass rate
- Min/max/avg pass rates
- Distribution histogram
- Automatically analyzes failures:
- Categorizes CSS classes (custom, arbitrary, opacity, shadow, ring, border, color, filter, etc.)
- Identifies top category mismatches
- Shows specific class pairs (appearing 3+ times)
- Saves detailed results to
tests/fuzz/tools/output/failure_analysis.txt
- Reports failed rounds by error type
Configuration:
- Number of parallel workers auto-detected (CPU count, min 2, max 8)
- Override with
--workersflag orFUZZ_WORKERSenvironment variable
Replaces: test_many_rounds.py, collect_failures.py, and analyze_failures.py
Commands require:
- Node.js 20.19 or newer and npm installed system-wide
- Git for the real-world comparison corpora
The fuzz run command automatically ensures that:
- RustyWind binary is built (
cargo build --release) - npm dependencies are installed (
cd tests/fuzz && npm install)
You can also run cargo xtask fuzz setup manually to prepare the environment.
xtask/
├── src/
│ ├── main.rs # CLI entry point with clap
│ ├── commands/ # Command implementations
│ │ ├── compare.rs # pinned real-world Tailwind comparisons
│ │ ├── npm.rs # npm package publishing
│ │ ├── setup.rs # setup command
│ │ └── run.rs # run command with integrated analysis
│ └── utils/ # Shared utilities
│ ├── categories.rs # CSS class categorization
│ └── parser.rs # Test output parsing
└── Cargo.toml
- clap - CLI argument parsing
- color-eyre - Error handling
- regex - Test output parsing
- rayon - Parallel execution
- indicatif - Progress bars
- which - Binary detection
- num_cpus - CPU count detection
- Type Safety - Catch errors at compile time
- Performance - Faster parallel execution with rayon
- Integration - Can import rustywind-core directly
- Consistency - One language for entire project
- Tooling - Better IDE support, debugging, profiling
- Dependencies - No external runtime (Python) needed
- Cross-platform - Rust handles platform differences
- Unified Workflow - Run tests and analyze in one command
cargo build --package xtaskcargo test --package xtask- Create new file in
src/commands/ - Implement
pub fn run(...) -> Result<()> - Add the module to
src/commands.rs - Add variant to appropriate enum in
src/main.rs - Add match arm in the match expression
- Start inline comments with lowercase
- Capitalize doc comments (///)
- Use
color-eyrefor error handling - Minimize nesting in functions
- Use meaningful variable names