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.
$ npx -y skills add kucherenko/jscpd --agent claude-code
Run the curl in your terminal, the rest in Claude Code.
Repo: kucherenko/jscpd
What's inside
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.
jscpd implements the Rabin-Karp algorithm to find duplicated code blocks across files.
# Install (all platforms — installs the jscpd command)
curl -fsSL https://jscpd.dev/install.sh | bash
# TypeScript engine (Node.js, v4.x)
npm install -g jscpd@4
jscpd /path/to/code
# or use without installing
npx jscpd@4 /path/to/code
# Rust engine (v5.x, 24-37x faster) — installs the jscpd command
npm install -g jscpd@5
jscpd /path/to/code
# Rust engine — cpd command only
npm install -g cpd
cpd /path/to/code
# Rust-native install (exposes both jscpd and cpd)
cargo install jscpd
# Nix (installs both jscpd and cpd)
nix run github:kucherenko/jscpd -- /path/to/code
# or install permanently
nix profile install github:kucherenko/jscpd
# Homebrew (macOS/Linux)
brew install jscpd
| Document | Description |
|---|---|
| TypeScript (v4.x) | Node.js engine — CLI, reporters, config, detection modes |
| Rust (v5.x) | Rust engine — installation, CLI, reporters, blame, Rust API |
| AI-Ready | AI reporter, agent skills, MCP server |
| Programming API | TypeScript and Rust programmatic APIs |
| CI & Pre-Commit Hooks | GitHub Action, pre-commit hooks |
| Packages | Monorepo package and crate overview |
| TypeScript (v4) | Rust (v5) | |
|---|---|---|
| npm package | jscpd@4 | jscpd@5 or cpd |
| CLI command | jscpd | jscpd (from jscpd@5) or cpd (from cpd) |
| Speed | Baseline | 24-37x faster |
| Formats | 224 | 223 |
| Node.js required | Yes | No (self-contained binary) |
| Programming API | TypeScript (jscpd(), detectClones()) | Rust (cpd-finder crate) |
| LevelDB store | Yes | No |
| Reporters | 13 | 13 |
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: cargo install jscpd.
jscpd v5 is a ground-up Rust rewrite that ships as jscpd@5 (installs the jscpd command) or cpd (installs the cpd command). Self-contained binary — no Node.js runtime required.
Same interface, 24-37x faster:
jscpd → jscpd@5.jscpd.json config file, same detection algorithm, same reportersNew in v5:
--blame --reporters console-full)--workers — control parallelism for file tokenization and detection (default: auto, uses all CPU cores; not available in v4)console, console-full, json, xml, csv, html, markdown, badge, sarif, ai, xcode, threshold, silentNot yet in v5 (use v4 for these):
--store leveldb)jscpd(), detectClones())See Rust docs for the full CLI reference and differences from v4.
prismjs with own backend built on reprism. ~11.5% faster tokenization on real projects--store-path — configure LevelDB cache directory for parallel runs--skipComments — shorthand for --mode weak--formats-names — map filenames (e.g. Makefile, Dockerfile) to formats--noTips — suppress tip output in CIpackage.json (#739), Vue SFC cross-file detection (#737), Vue SFC column numbers (#737), 50 dependency security vulnerabilitiesSee TypeScript docs for the full CLI reference.
| Package | Description |
|---|---|
| jscpd | CLI and Node.js API (v4.x) |
| jscpd-server | REST API + MCP server |
| @jscpd/core | Core detection algorithm |
| @jscpd/finder | File detection, reporters |
| @jscpd/tokenizer | Source code tokenization |
| @jscpd/html-reporter | HTML report |
| @jscpd/badge-reporter | SVG badge |
| jscpd-sarif-reporter | SARIF (GitHub Code Scanning) |
| @jscpd/leveldb-store | LevelDB persistent store |
| @jscpd/redis-store | Redis distributed store |
| cpd (Rust engine) | Rust-powered engine (v5.x) — also available as jscpd@5 |
Benchmarked on macOS (Apple Silicon), 10 runs per target (3 for CopilotKit). v4 ran with --no-gitignore -i "node_modules" to ensure comparable file scanning.
| Target | Files | Size | jscpd v4 | jscpd v5 | Speedup |
|---|---|---|---|---|---|
| fixtures | 548 | 1.5 MB | 1.03s | 0.03s | 34.3x |
| svelte | 9K | 38 MB | 15.80s | 0.43s | 36.9x |
| CopilotKit | 17K | 159 MB | 82.89s | 3.44s | 24.1x |
See performance-comparison.md for full methodology and raw data.
jscpd integrates into AI-powered workflows through three mechanisms:
Token-efficient output for LLM pipelines (~79% fewer tokens than the default console reporter):
jscpd --reporters ai /path/to/source # v4
cpd --reporters ai /path/to/source # v5
Two installable skills that teach AI coding assistants how to use jscpd and refactor detected duplications:
| Skill | Purpose | Install |
|---|---|---|
jscpd | Tool reference — CLI options, AI reporter format, config syntax | npx skills add kucherenko/jscpd --skill jscpd |
dry-refactoring | Guided refactoring workflow — read clones, choose strategy, apply, verify | npx skills add kucherenko/jscpd --skill dry-refactoring |
After installation, ask your agent to "find and fix code duplication" and it will invoke jscpd with the right options and act on the results.
See AI-Ready docs for full details.
git clone https://github.com/{your-id}/jscpd)pnpm install)pnpm devpnpm testpnpm buildThank you to all our backers! 🙏 [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
MIT © Andrey Kucherenko
.changeset/
config.json
README.md
.editorconfig
.eslintrc.json
.github/
actions/
jscpd/
parse-output.js
CONTRIBUTING.md
dependabot.yml
FUNDING.yml
ISSUE_TEMPLATE/
bug_report.md
custom.md
feature_request.md
PULL_REQUEST_TEMPLATE.md
workflows/
crates-publish.yml
nodejs.yml
npm-rust-publish.yml
release-rust.yml
release.yml
rust.yml
.gitignore
.jscpd.json
.npmrc
.pre-commit-hooks.yaml
.prettierignore
action.yml
apps/
jscpd/
jscpd-server/
__tests__/
mcp-server.test.ts
server.test.ts
.npmignore
bin/
jscpd-server
jscpd-server.ts
CHANGELOG.md
nodemon.json
package.json
README.md
src/
detect.ts
index.ts
server/
constants.ts
ephemeral-store.ts
index.ts
mcp-server.ts
middleware.ts
routes.ts
server.ts
service.ts
types/
index.ts
requests.ts
responses.ts
state.ts
setup/
cli-utils.ts
hooks.ts
ignore.ts
index.ts
options.ts
reporters.ts
store.ts
subscribers.ts
tsconfig.build.json
tsconfig.json
tsup.config.ts
__tests__/
cli-parsing.test.ts
formats.test.ts
ignore.test.ts
modes.test.ts
options-unit.test.ts
options.test.ts
print.test.ts
reporters.test.ts
store.test.ts
.npmignore
bin/
jscpd
jscpd.ts
CHANGELOG.md
LICENSE
nodemon.json
package.json
README.md
src/
index.ts
init/
cli.ts
hooks.ts
ignore.ts
index.ts
options.ts
reporters.ts
store.ts
subscribers.ts
options.ts
print/
files.ts
index.ts
options.ts
supported-format.ts
tsconfig.build.json
tsconfig.json
tsup.config.ts
vitest.config.ts
assets/
jscpd-badge.svg
logo-small-box.svg
logo-small.svg
logo.svg
screenshot-1.png
screenshot-2.png
screenshot.png
benchmark/
.gitignore
BENCHMARK.md
benchmark.sh
tools/
package-lock.json
package.json
README.md
build-utils/
prismjs-languages-concat.ts
publish-util.ts
CHANGELOG.md
CODE_OF_CONDUCT.md
docs/
ai-ready.md
api.md
ci-and-hooks.md
packages.md
performance-comparison.md
rust.md
typescript.md
examples/
api/
example_github_action.yml
example-detectClones.ts
example-jscpd.ts
example-persist-store.ts
fixtures/
.jscpd.json
actionscript/
file1.as
file2.as
ada/
file1.ada
file2.ada
antlr4/
file1.g4
file2.g4
apex/
file1.cls
file2.cls
apl/
file1.apl
file1.dyalog
file2.apl
file2.dyalog
astro/
component1.astro
component2.astro
awk/
file1.awk
file2.awk
basic/
file1.bas
file2.bas
bicep/
file1.bicep
file2.bicep
brainfuck/
file1.b
file1.bf
file2.b
file2.bf
cfml/
file1.cfm
file2.cfm
cfscript/
file1.cfc
file2.cfc
clike/
file1.c
file1.c++
file1.cc
file1.cpp
file1.cs
file1.cxx
file1.h
file1.h++
file1.hh
file1.hpp
file1.hxx
file1.java
file1.kt
file1.m
file1.mm
file1.nut
file1.scala
file2.c
file2.c++
file2.cc
file2.cpp
file2.cs
file2.cxx
file2.h
file2.h++
file2.hh
file2.hpp
file2.hxx
file2.java
file2.kt
file2.m
file2.mm
file2.nut
file2.scala
clojure/
file1.clj
file1.cljc
file1.cljs
file1.cljx
file1.edn
file2.clj
file2.cljc
file2.cljs
file2.cljx
file2.edn
cmake/
file1.cmake
file1.cmake.in
file2.cmake
file2.cmake.in
cobol/
file1.cob
file1.cpy
file2.cob
file2.cpy
coffeescript/
file1.coffee
file2.coffee
commonlisp/
file1.cl
file1.el
file1.lisp
file2.cl
file2.el
file2.lisp
cross-formats/
a.ts
b.js
crystal/
file1.cr
file2.cr
css/
file1.css
file1.gss
file1.less
file1.scss
file10.css
file2.css
file2.gss
file2.less
file2.scss
csv/
file1.csv
file2.csv
custom/
file.cc1
file.ccc
cypher/
file1.cyp
file1.cypher
file2.cyp
file2.cypher
d/
file1.d
file2.d
dart/
file1.dart
file2.dart
diff/
file1.diff
file1.patch
file2.diff
file2.patch
dot/
file1.dot
file2.dot
dtd/
file1.dtd
file2.dtd
dylan/
file1.dyl
file1.dylan
file1.intr
file2.dyl
file2.dylan
file2.intr
ecl/
file1.ecl
file2.ecl
eiffel/
file1.e
file2.e
elm/
file1.elm
file2.elm
erlang/
file1.erl
file2.erl
factor/
file1.factor
file2.factor
folder1/
file_1.js
file2.c
folder2/
file_2.js
forth/
file1.4th
file1.forth
file1.fth
file2.4th
file2.forth
file2.fth
fortran/
file1.f
file1.f77
file1.f90
file1.for
file2.f
file2.f77
file2.f90
file2.for
gas/
file1.s
file2.s
gdscript/
file1.gd
file2.gd
gettext/
file1.po
file2.po
gherkin/
file1.feature
file2.feature
gitignore/
file1.gitignore
file2.gitignore
go/
file1.go
file2.go
graphql/
file1.graphql
file2.graphql
groovy/
file1.gradle
file1.groovy
file2.gradle
file2.groovy
haml/
file1.haml
file2.haml
handlebars/
file1.hbs
file2.hbs
haskell/
haskell-literate/
file1.lhs
file2.lhs
file1.hs
file2.hs
haxe/
file1.hx
file1.hxml
file2.hx
file2.hxml
hcl/
file1.tf
file2.tf
htmlembedded/
file1.aspx
file1.ejs
file1.erb
file1.jsp
file2.aspx
file2.ejs
file2.erb
file2.jsp
htmlmixed/
file1.htm
... 1060 moreFAQ
jscpd is a Claude Code plugin with 2 hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. It includes dry-refactoring, jscpd. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.