$git clone https://github.com/kucherenko/jscpd> Copy/paste detector for programming source code. Supports 224+ formats. AI-ready with MCP server and token-efficient reporter. Now with a Rust-powered engine — 24-37x faster.
| 1 | # jscpd |
| 2 | |
| 3 | [](https://www.npmjs.com/package/jscpd) |
| 4 | |
| 5 | [](https://crates.io/crates/jscpd) |
| 6 | |
| 7 |  |
| 8 | [](https://github.com/kucherenko/jscpd/actions/workflows/nodejs.yml) |
| 9 | |
| 10 | > Copy/paste detector for programming source code. Supports 224+ formats. AI-ready with MCP server and token-efficient reporter. Now with a Rust-powered engine — 24-37x faster. |
| 11 | |
| 12 | jscpd implements the [Rabin-Karp](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm) algorithm to find duplicated code blocks across files. |
| 13 | |
| 14 | ## Quick Start |
| 15 | |
| 16 | ```bash |
| 17 | # Install (all platforms — installs the jscpd command) |
| 18 | curl -fsSL https://jscpd.dev/install.sh | bash |
| 19 | |
| 20 | # TypeScript engine (Node.js, v4.x) |
| 21 | npm install -g jscpd@4 |
| 22 | jscpd /path/to/code |
| 23 | # or use without installing |
| 24 | npx jscpd@4 /path/to/code |
| 25 | |
| 26 | # Rust engine (v5.x, 24-37x faster) — installs the jscpd command |
| 27 | npm install -g jscpd@5 |
| 28 | jscpd /path/to/code |
| 29 | |
| 30 | # Rust engine — cpd command only |
| 31 | npm install -g cpd |
| 32 | cpd /path/to/code |
| 33 | |
| 34 | # Rust-native install (exposes both jscpd and cpd) |
| 35 | cargo install jscpd |
| 36 | |
| 37 | # Nix (installs both jscpd and cpd) |
| 38 | nix run github:kucherenko/jscpd -- /path/to/code |
| 39 | # or install permanently |
| 40 | nix profile install github:kucherenko/jscpd |
| 41 | |
| 42 | # Homebrew (macOS/Linux) |
| 43 | brew install jscpd |
| 44 | ``` |
| 45 | |
| 46 | ## Documentation |
| 47 | |
| 48 | | Document | Description | |
| 49 | |----------|-------------| |
| 50 | | [TypeScript (v4.x)](docs/typescript.md) | Node.js engine — CLI, reporters, config, detection modes | |
| 51 | | [Rust (v5.x)](docs/rust.md) | Rust engine — installation, CLI, reporters, blame, Rust API | |
| 52 | | [AI-Ready](docs/ai-ready.md) | AI reporter, agent skills, MCP server | |
| 53 | | [Programming API](docs/api.md) | TypeScript and Rust programmatic APIs | |
| 54 | | [CI & Pre-Commit Hooks](docs/ci-and-hooks.md) | GitHub Action, pre-commit hooks | |
| 55 | | [Packages](docs/packages.md) | Monorepo package and crate overview | |
| 56 | |
| 57 | ## Two Engines |
| 58 | |
| 59 | | | TypeScript (v4) | Rust (v5) | |
| 60 | |---|---|---| |
| 61 | | **npm package** | [`jscpd@4`](https://www.npmjs.com/package/jscpd) | [`jscpd@5`](https://www.npmjs.com/package/jscpd) or [`cpd`](https://www.npmjs.com/package/cpd) | |
| 62 | | **CLI command** | `jscpd` | `jscpd` (from `jscpd@5`) or `cpd` (from `cpd`) | |
| 63 | | **Speed** | Baseline | 24-37x faster | |
| 64 | | **Formats** | 224 | 223 | |
| 65 | | **Node.js required** | Yes | No (self-contained binary) | |
| 66 | | **Programming API** | TypeScript (`jscpd()`, `detectClones()`) | Rust (`cpd-finder` crate) | |
| 67 | | **LevelDB store** | Yes | No | |
| 68 | | **Reporters** | 13 | 13 | |
| 69 | |
| 70 | `jscpd@5` installs the `jscpd` command. The `cpd` npm package installs the `cpd` command. Both contain the same Rust binary. For both command names from a single install, use [crates.io](https://crates.io/crates/jscpd): `cargo install jscpd`. |
| 71 | |
| 72 | ## What's New |
| 73 | |
| 74 | ### v5.0.x — Rust Engine |
| 75 | |
| 76 | jscpd v5 is a ground-up Rust rewrite that ships as [`jscpd@5`](https://www.npmjs.com/package/jscpd) (installs the `jscpd` command) or [`cpd`](https://www.npmjs.com/package/cpd) (installs the `cpd` command). Self-contained binary — no Node.js runtime required. |
| 77 | |
| 78 | **Same interface, 24-37x faster:** |
| 79 | |
| 80 | - All CLI options from v4 are preserved — drop-in replacement: `jscpd` → `jscpd@5` |
| 81 | - Same `.jscpd.json` config file, same detection algorithm, same reporters |
| 82 | - 223 language formats with cross-format detection (Vue SFC, Svelte, Astro, Markdown) |
| 83 | |
| 84 | **New in v5:** |
| 85 | |
| 86 | - **24-37x faster** detection on real projects (see [benchmark](docs/performance-comparison.md)) |
| 87 | - Small codebases (548 files): 34x faster |
| 88 | - Medium codebases (9K files): 37x faster |
| 89 | - Large codebases (17K files, 900 MB): 24x faster |
| 90 | - **Git blame** with side-by-side author comparison (`--blame --reporters console-full`) |
| 91 | - **`--workers`** — control parallelism for file tokenization and detection (default: auto, uses all CPU cores; not available in v4) |
| 92 | - **13 reporters**: `console`, `con |