Metadata-Version: 2.4
Name: drywall
Version: 0.1.3
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
License-File: LICENSE
Summary: Polyglot AST subtree DRY analyzer. A Rust port of unclebob/dry4go, extended to Rust, JavaScript, TypeScript, and Python.
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/gabadi/drywall

# drywall

Polyglot AST subtree DRY analyzer. Detects duplicate code across files using Jaccard similarity over normalized AST fingerprints.

A Rust port of [unclebob/dry4go](https://github.com/unclebob/dry4go), extended to work across Rust, JavaScript, TypeScript, and Python (dry4go is Go-only).

## Install

```bash
# Rust
cargo install drywall

# Python
pip install drywall
# or, without installing:
uvx drywall ./src

# Node.js
npm install --save-dev drywall-cli
# then: npx drywall ./src, or add a package.json script
```

Or download the binary for your platform from the [latest release](https://github.com/gabadi/drywall/releases/latest):

| Platform | Binary |
|----------|--------|
| Linux x86_64 | `drywall-linux-x86_64` |
| macOS Apple Silicon | `drywall-macos-aarch64` |
| macOS Intel | `drywall-macos-x86_64` |

```bash
# Linux
curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-linux-x86_64 -o drywall
chmod +x ./drywall

# macOS Apple Silicon
curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-macos-aarch64 -o drywall
chmod +x ./drywall

# macOS Intel
curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-macos-x86_64 -o drywall
chmod +x ./drywall
```

The Linux binary is statically linked (musl) — no runtime dependencies.

## Usage

```bash
drywall [--threshold 0.82] ./src
```

`--threshold` is the Jaccard similarity cutoff (default `0.82`, same as dry4go). Pairs at or above the threshold are reported. Exit codes: `0` = no duplicates, `1` = duplicates found, `2` = bad arguments.

## Use as a CI gate

Add to any project's CI pipeline:

```yaml
- name: Install drywall
  run: |
    curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-linux-x86_64 -o drywall
    chmod +x ./drywall

- name: DRY check
  run: ./drywall --threshold 0.82 ./src
```

`--threshold` sets the Jaccard similarity cutoff (default `0.82`). Pairs at or above the threshold are flagged. The step fails (exit 1) if any duplicates are found.

## Build from source

Requires Rust 1.96+:

```bash
cargo build --release
./target/release/drywall ./src
```

