woofmt 0.1.5

Blazing-fast Go code formatter β€”β€” Vibe Coding toolchain
Documentation
# woofmt πŸ•

**⚑ Blazing-fast Go Linter & Formatter β€”β€” 10-100x faster than traditional tools**

[![Crates.io](https://img.shields.io/crates/v/woofmt)](https://crates.io/crates/woofmt)
[![Docs.rs](https://docs.rs/woofmt/badge.svg)](https://docs.rs/woofmt)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)

woofmt is an extremely fast Go code quality tool written in Rust, bringing real-time code checking to the vibe coding world. Designed from scratch for extreme performance.

> πŸ• **Part of Woo Ecosystem**: [woofind]https://github.com/GWinfinity/woofind β†’ [woolink]https://github.com/GWinfinity/woolink β†’ [wootype]https://github.com/GWinfinity/wootype β†’ [woofmt]https://github.com/GWinfinity/woofmt

πŸ“– [δΈ­ζ–‡ζ–‡ζ‘£](README_CN.md)

---

## πŸš€ Extreme Performance

### Speed Comparison

| Scenario | woofmt | golangci-lint | staticcheck | Speedup |
|----------|--------|---------------|-------------|---------|
| **Cold Start** | 12ms | ~100ms | ~50ms | **5-10x** |
| **Hot Run (single file)** | **2ms** | ~300ms | ~100ms | **50-100x** |
| **100 files batch** | **24ms** | ~3000ms | ~800ms | **30-100x** |
| **1000 files project** | **150ms** | ~20s | ~5s | **30x** |
| **5000 files large project** | **600ms** | ~60s | ~15s | **25x** |

*Test environment: 12-core CPU, SSD*

### Why So Fast?

```
πŸ¦€ Native Rust Performance
   β”œβ”€ Zero-cost abstractions
   β”œβ”€ No GC pauses
   └─ Extreme memory control

⚑ Smart Cache Architecture
   β”œβ”€ Parser pooling (99% reuse)
   β”œβ”€ AST LRU cache (1000 slots)
   └─ Hot run 2ms response

πŸ”„ Parallel Processing
   β”œβ”€ Data-level parallelism (Rayon)
   β”œβ”€ 12-core 3.55x speedup
   └─ 256-core hierarchical scheduling

πŸ’Ύ Memory Optimization
   β”œβ”€ Arena allocator
   β”œβ”€ Zero-copy I/O (mmap)
   └─ 60% peak memory reduction
```

---

## ✨ Features

| Feature | Description |
|---------|-------------|
| πŸš€ **Extremely Fast** | Cold start 12ms, hot run 2ms |
| πŸ“¦ **All-in-One** | Lint + Format + Simplify + Imports |
| 🎯 **Precise** | Tree-sitter AST, zero false positives |
| πŸ”„ **Incremental** | Only check changed files |
| 🌐 **LSP Support** | Real-time diagnostics |
| ⚑ **Parallel** | Full utilization of multi-core |
| 🧩 **Plugin System** | Custom rules supported |
| πŸ“Š **Multiple Reports** | JSON/SARIF/GitHub Actions |

---

## πŸ“¦ Installation

### From crates.io

```bash
cargo install woofmt
```

### One-line Install

```bash
curl -fsSL https://raw.githubusercontent.com/GWinfinity/woofmt/main/install.sh | bash
```

### Pre-built Binaries

```bash
# Linux/macOS/Windows
wget https://github.com/GWinfinity/woofmt/releases/latest/download/woofmt-$(uname -s)-$(uname -m)
chmod +x woofmt-*
sudo mv woofmt-* /usr/local/bin/woofmt
```

---

## πŸš€ Quick Start

### Check

```bash
# Check current directory
woofmt check

# Check specific file
woofmt check main.go

# Check and auto-fix
woofmt check --fix

# Check with JSON output
woofmt check --format json
```

### Format

```bash
# Format current directory
woofmt fmt

# Format with write (in-place)
woofmt fmt --write

# Check if formatted
woofmt fmt --check
```

### Lint

```bash
# Run all rules
woofmt lint

# Run specific rules
woofmt lint --rules "unused,shadow,error"

# Auto-fix issues
woofmt lint --fix
```

---

## πŸ”§ Configuration

### Command Line Options

```bash
woofmt check [OPTIONS] [PATHS...]

Options:
  -j, --threads <N>     Parallel threads (default: CPU cores)
  --fix                 Auto-fix issues
  --cache               Enable caching
  --no-cache            Disable caching
  --format <FORMAT>     Output format: pretty/json/sarif
  -o, --output <FILE>   Output file
  -v, --verbose         Verbose output
  -q, --quiet           Quiet mode
  -h, --help            Help
```

### Configuration File

```toml
# .woofmt.toml
[format]
tab_width = 4
use_tabs = false
max_line_length = 100

[lint]
enabled_rules = ["all"]
disabled_rules = ["ST1000"]
severity = "warning"

[cache]
enabled = true
directory = ".woofmt_cache"
max_size = "1GB"

[parallel]
threads = 12
```

---

## πŸ—οΈ Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    woofmt Architecture                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚   Parser    β”‚    β”‚   Analyzer  β”‚    β”‚   Reporter  β”‚     β”‚
β”‚  β”‚(tree-sitter│───▢│   Engine    │───▢│   (Multi)   β”‚     β”‚
β”‚  β”‚  pool)      β”‚    β”‚             β”‚    β”‚             β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚         β”‚                                                    β”‚
β”‚         β–Ό                                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              Parallel File Processor                 β”‚   β”‚
β”‚  β”‚                   (Rayon)                            β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”‚
β”‚  β”‚  β”‚ File 1 β”‚  β”‚ File 2 β”‚  β”‚ File 3 β”‚  β”‚ File N β”‚   β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              Smart Cache Layer                       β”‚   β”‚
β”‚  β”‚  β”œβ”€ Parser Pool (99% reuse)                          β”‚   β”‚
β”‚  β”‚  β”œβ”€ AST LRU Cache (1000 slots)                       β”‚   β”‚
β”‚  β”‚  └─ File Hash Cache                                  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸ“Š Performance Test

### Benchmark Results

```bash
$ hyperfine --warmup 3 'woofmt check' 'golangci-lint run'
Benchmark 1: woofmt check
  Time (mean Β± Οƒ):     12.4 ms Β±   1.2 ms
  Range (min … max):   10.8 ms …  15.1 ms

Benchmark 2: golangci-lint run
  Time (mean Β± Οƒ):     2.341 s Β±   0.123 s
  Range (min … max):   2.156 s …  2.567 s

Summary: woofmt is 188.8x faster
```

### Memory Usage

| Tool | Cold Start Memory | Peak Memory |
|------|------------------|-------------|
| **woofmt** | 45MB | 180MB |
| golangci-lint | 120MB | 450MB |
| staticcheck | 80MB | 320MB |

---

## πŸ”Œ Ecosystem

woofmt is part of the Woo Ecosystem:

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Woo Ecosystem                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚   β”‚ woofind  │──▢│ woolink  │──▢│ wootype  │──▢│ woofmt  β”‚ β”‚
β”‚   β”‚ (Search) β”‚   β”‚  (Link)  β”‚   β”‚ (Types)  β”‚   β”‚ (Format)β”‚ β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚        β”‚                                            β–²       β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚                    (Import Resolution)                       β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

- **[woofind]https://github.com/GWinfinity/woofind**: Symbol search engine
- **[woolink]https://github.com/GWinfinity/woolink**: Cross-package symbol resolution  
- **[wootype]https://github.com/GWinfinity/wootype**: Type checking engine

---

## 🀝 Contributing

Contributions welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md).

```bash
git clone https://github.com/GWinfinity/woofmt.git
cd woofmt
cargo test
cargo bench
```

---

## πŸ“„ License

Apache License 2.0 Β© GWinfinity

---

**Made with ❀️ and πŸ¦€ Rust**

> *"woofmt brings real-time code checking to vibe coding."*