npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cpd

v5.3.0

Published

Copy/paste detector for programming source code — Rust engine, self-contained binary, installs the cpd command

Readme

jscpd — Rust engine

Copy/paste detector for programming source code. A self-contained binary that finds duplicated blocks across 224 language formats, writes reports in 15 formats and can fail CI when duplication grows.

Published as jscpd on npm (installs the jscpd command), cpd on npm (installs the cpd command), and jscpd on crates.io (installs both). Full documentation: jscpd.dev and docs/rust.md.

Install

npm

# installs the jscpd command
npm install -g jscpd

# installs only the cpd command
npm install -g cpd

Prebuilt binaries for 8 platforms (macOS arm64/x64, Linux arm64/x64 with glibc or musl, Windows arm64/x64) — no Node.js runtime required.

crates.io

cargo install jscpd
# or, without compiling (prebuilt release binaries via cargo-binstall):
cargo binstall jscpd

Installs both jscpd and cpd binaries.

PyPI

Platform wheels carrying the same prebuilt binary, for Python toolchains and pre-commit hooks that should not need Node.js:

pip install jscpd          # or: pipx install jscpd / uv tool install jscpd
uvx jscpd /path/to/code    # run without installing

Installs both jscpd and cpd commands.

Nix

# Run without installing
nix run github:kucherenko/jscpd -- /path/to/code

# Install permanently
nix profile install github:kucherenko/jscpd

Homebrew

brew install jscpd

From source

git clone https://github.com/kucherenko/jscpd.git
cd jscpd/rust
cargo build --release
# binaries at target/release/jscpd and target/release/cpd

Quick Start

jscpd .
jscpd ./src ./lib
jscpd . --blame --reporters console-full
jscpd . --reporters json,html
jscpd . --threshold 10
jscpd --baseline-from-ref origin/main --fail-on-new-clones .
jscpd --mcp .
jscpd --list

Architecture

jscpd/cpd (CLI binary)
 ├── cpd-core      — Detection algorithm (Rabin-Karp rolling hash)
 ├── cpd-tokenizer — Language tokenization (224 formats)
 ├── cpd-finder    — File walking, orchestration, baseline, git blame
 └── cpd-reporter  — Output formatting (15 reporters)

| Crate | Purpose | |-------|---------| | jscpd | CLI binary and entry point (crates/cpd) | | cpd-core | Detection algorithm, rolling hash, models | | cpd-tokenizer | Language tokenization (224 formats); pure, no I/O | | cpd-finder | File walking, orchestration, git blame | | cpd-reporter | Output formatting (15 reporters) |

Current versions are in each crate's Cargo.toml; scripts/sync-version.mjs keeps them and the npm packages in step. The workspace layout, npm launcher packages and platform packages are described in docs/packages.md.

Programmatic Usage (Rust)

use cpd_finder::orchestrate::{RunConfig, run};

let config = RunConfig {
    paths: vec!["./src".into()],
    min_tokens: 50,
    ..Default::default()
};

let result = run(&config).unwrap();
println!("Found {} clones", result.clones.len());
println!("Analyzed {} files", result.statistics.total.sources);

See docs/api.md and examples/rust-cpd-finder.

Building and testing

Requires Rust 1.96+ (the MSRV declared in Cargo.toml, enforced by the msrv job in CI). Development uses the exact toolchain pinned in rust-toolchain.toml.

cargo build --release
cargo nextest run --workspace        # or: cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all --check

# End-to-end run over the multi-format corpus (what CI's smoke job does)
./target/release/jscpd ../fixtures --reporters console,json --output ../smoke-report --min-tokens 50

After changing the format table in crates/cpd-tokenizer/src/formats.rs, regenerate the root FORMATS.md with node scripts/gen-formats-md.mjs.

Benchmarks

Compared against other copy/paste detectors (jscpd-rs, Duplo, Fallow, Simian, PMD CPD) on the repository's fixtures/ corpus — timing, detection counts, cross-format detection and AI-token efficiency — in benchmark/BENCHMARK.md. Re-run with benchmark/benchmark.sh.

Documentation

Coming from jscpd v4?

The CLI flags, .jscpd.json config and reporters are the same; see the migration table for the few differences. jscpd v4 (TypeScript engine, Node.js API, LevelDB/Redis stores) is maintained on the master-v4 branch and published as jscpd@4.

License

MIT