{"name":"jscpd","version":"4.2.4","author":{"name":"Andrey Kucherenko","email":"kucherenko.andrey@gmail.com"},"license":"MIT","_id":"jscpd@4.2.4","maintainers":[{"name":"apk","email":"kucherenko.andrey@gmail.com"}],"homepage":"https://github.com/kucherenko/jscpd#readme","bugs":{"url":"https://github.com/kucherenko/jscpd/issues"},"bin":{"jscpd":"bin/jscpd"},"dist":{"shasum":"043692f132eb772a0e8792d12c57979241634672","tarball":"http://registry-npm.ywwl.com/jscpd/download/jscpd-4.2.4.tgz","fileCount":20,"integrity":"sha512-PSo2U0G8OxULayGyQMv7T/0ZQ+c3PPltdMOz/57v9Xnmq5xSIhh4cnZ0oYZPKqejy10aFwAbMVxqAlo24+PQ3g==","signatures":[{"sig":"MEYCIQDcHSWPcJX++5JJQPIKTrBbcyWsI2WSJXaHG553owwtRwIhAIst8mibkRr4hPj7NfS2UOxKdsh970Jgt5GynGIWpQdG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":127940,"size":31949,"noattachment":false,"key":"/jscpd/-/jscpd-4.2.4.tgz"},"main":"dist/src/index.js","_from":"file:jscpd-4.2.4.tgz","module":"dist/src/index.mjs","exports":{".":{"types":"./dist/src/index.d.mts","import":"./dist/src/index.mjs","require":"./dist/src/index.js"},"./README.md":"./README.md"},"gitHead":"87a118f80343288c0099a4e3e47ccd875476bf6c","scripts":{"dev":"nodemon","test":"vitest run","build":"tsup-node --dts","cleanup":"rimraf ./dist .turbo","typecheck":"tsc"},"typings":"dist/src/index.d.mts","_npmUser":{"name":"apk","email":"kucherenko.andrey@gmail.com"},"_resolved":"/private/var/folders/rh/82vm3q314snd3ymwr5n577_00000gp/T/f70100a366992fb2eaceb31bd7ad59e2/jscpd-4.2.4.tgz","_integrity":"sha512-PSo2U0G8OxULayGyQMv7T/0ZQ+c3PPltdMOz/57v9Xnmq5xSIhh4cnZ0oYZPKqejy10aFwAbMVxqAlo24+PQ3g==","repository":{"url":"git+ssh://git@github.com/kucherenko/jscpd.git","type":"git"},"_npmVersion":"11.12.1","description":"detector of copy/paste in files","directories":{"bin":"bin","lib":"src","test":"__tests__"},"_nodeVersion":"26.0.0","dependencies":{"colors":"^1.4.0","fs-extra":"^11.2.0","commander":"^5.0.0","@jscpd/core":"4.2.4","@jscpd/finder":"4.2.4","@jscpd/tokenizer":"4.2.4","@jscpd/html-reporter":"4.2.4","jscpd-sarif-reporter":"4.2.4","@jscpd/badge-reporter":"4.2.4"},"preferGlobal":true,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^3.2.4","nodemon":"^3.1.4","ts-node":"^10.9.2","typescript":"^5.5.4","@types/node":"^24.10.0","@types/fs-extra":"^11.0.4","@tsconfig/node20":"^20.1.9","@vitest/coverage-v8":"^3.2.4"},"_npmOperationalInternal":{"tmp":"tmp/jscpd_4.2.4_1779716309028_0.9444437556575531","host":"s3://npm-registry-packages-npm-production"},"readme":"# jscpd — Copy/Paste Detector\n\n[![npm version](https://img.shields.io/npm/v/jscpd.svg)](https://www.npmjs.com/package/jscpd)\n[![npm downloads](https://img.shields.io/npm/dm/jscpd.svg)](https://www.npmjs.com/package/jscpd)\n[![license](https://img.shields.io/npm/l/jscpd.svg)](https://github.com/kucherenko/jscpd/blob/master/LICENSE)\n[![crates.io](https://img.shields.io/crates/v/jscpd.svg)](https://crates.io/crates/jscpd)\n[![homepage](https://img.shields.io/badge/homepage-jscpd.dev-blue.svg)](https://jscpd.dev)\n\n> **jscpd v5** is the Rust engine — a self-contained binary, no Node.js runtime. The TypeScript engine (v4: Node.js API, LevelDB/Redis stores) is maintained on the [`master-v4`](https://github.com/kucherenko/jscpd/tree/master-v4) branch and published as `jscpd@4`.\n\nCopy/paste detector for programming source code. Supports **224 language formats**, **15 output reporters**, and per-line author attribution via git blame. Prebuilt binaries for 8 platforms — no Node.js runtime required.\n\n## Packages\n\n| Package | Installs | Use it when |\n|---------|----------|-------------|\n| [`jscpd`](https://www.npmjs.com/package/jscpd) | `jscpd` | Default install; the `jscpd` command |\n| [`cpd`](https://www.npmjs.com/package/cpd) | `cpd` | Shorter command name only |\n| [`jscpd` (crates.io)](https://crates.io/crates/jscpd) | `jscpd` + `cpd` | Rust-native install; both binaries |\n\nThe npm `jscpd` package installs a single `jscpd` command that runs the same Rust binary as `cpd`. For the shorter `cpd` alias on npm, install the separate [`cpd`](https://www.npmjs.com/package/cpd) package.\n\n## Install\n\n```bash\n# npm — installs the jscpd command\nnpm install -g jscpd\n\n# crates.io — installs both jscpd and cpd binaries\ncargo install jscpd\n\n# Nix — run without installing\nnix run github:kucherenko/jscpd -- /path/to/code\n\n# Nix — install permanently\nnix profile install github:kucherenko/jscpd\n\n# Homebrew (macOS/Linux)\nbrew install jscpd\n```\n\nPrebuilt binaries for: macOS arm64/x64, Linux arm64/x64 (glibc + musl), Windows arm64/x64.\n\n## Quick Start\n\n```bash\njscpd .                                       # scan current directory\njscpd ./src ./lib                             # scan specific paths\njscpd . --min-tokens 30 --min-lines 3         # tune detection sensitivity\njscpd . --blame --reporters console-full      # git blame, side-by-side authors\njscpd . --reporters json,html                 # write report files\njscpd . --threshold 10                        # fail CI if >10% duplicated\njscpd --list                                  # list all supported formats\n```\n\n## Options\n\n| Flag | Short | Default | Description |\n|------|-------|---------|-------------|\n| `--min-tokens` | `-k` | 50 | Minimum tokens in a clone |\n| `--min-lines` | `-l` | 5 | Minimum lines in a clone |\n| `--max-lines` | `-x` | — | Maximum lines per duplicate block |\n| `--max-size` | `-z` | — | Skip files larger than SIZE (e.g. `1mb`) |\n| `--mode` | `-m` | `mild` | Detection mode: `mild`, `weak`, `strict` |\n| `--skip-comments` | — | — | Alias for `--mode weak` |\n| `--format` | `-f` | all | Comma-separated formats to check |\n| `--ignore-pattern` | `-i` | — | Glob patterns to ignore |\n| `--reporters` | `-r` | `console` | Comma-separated reporters |\n| `--output` | `-o` | `report` | Output directory for file reporters |\n| `--config` | `-c` | — | Path to `.jscpd.json` config file |\n| `--threshold` | `-t` | — | Max duplication % before exit 1 |\n| `--blame` | `-b` | — | Enrich clones with git blame data |\n| `--workers` | — | auto | Worker threads for parallel scan |\n| `--skip-local` | — | — | Skip clones within the same directory |\n| `--absolute` | `-a` | — | Use absolute paths in reports |\n| `--silent` | `-s` | — | Suppress console output |\n| `--list` | — | — | List all supported formats and exit |\n\nFull options: [docs/rust.md](https://github.com/kucherenko/jscpd/blob/master/docs/rust.md).\n\n## Reporters\n\n| Reporter | Output |\n|----------|--------|\n| `console` | Clone list + statistics table (default) |\n| `console-full` | Source snippets; with `--blame` shows side-by-side author comparison |\n| `json` | `report/jscpd-report.json` |\n| `html` | `report/jscpd-report.html` |\n| `sarif` | `report/jscpd-report.sarif` (GitHub Code Scanning) |\n| `ai` | Token-efficient output for LLM pipelines |\n| `badge` | `report/jscpd-badge.svg` + `report/jscpd-lines-badge.svg` |\n\nAlso: `xml`, `csv`, `markdown`, `codeclimate`, `openmetrics`, `xcode`, `threshold`, `silent` (15 total).\n\n## Config File\n\nCreate `.jscpd.json` in your project root:\n\n```json\n{\n  \"minTokens\": 30,\n  \"minLines\": 3,\n  \"format\": [\"javascript\", \"typescript\", \"python\"],\n  \"ignorePattern\": [\"node_modules\", \"dist\", \"*.min.js\"],\n  \"reporters\": [\"console\", \"json\"],\n  \"output\": \"report\",\n  \"threshold\": 5,\n  \"blame\": false\n}\n```\n\n## Supported Formats\n\n224 formats including: JavaScript, TypeScript, Python, Go, Rust, Java, C/C++, C#, Ruby, PHP, Swift, Kotlin, Scala, Vue SFC, Svelte, Astro, Markdown, SQL, HTML, CSS, Bash, Dart, Lua, R, Haskell, Clojure, Elixir, Apex, CFML, and 200+ more.\n\nRun `jscpd --list` for the full list, or see [FORMATS.md](https://github.com/kucherenko/jscpd/blob/master/FORMATS.md).\n\n**Cross-format detection:** Vue SFC (`.vue`), Svelte (`.svelte`), Astro (`.astro`), and Markdown files are tokenized per-block, enabling duplicate detection across file types.\n\n## CI\n\nGitHub Action — installs the Rust engine, runs detection, uploads SARIF to GitHub Code Scanning:\n\n```yaml\n- uses: kucherenko/jscpd@v5\n  with:\n    threshold: 5\n```\n\nPre-commit hook (Husky):\n\n```bash\necho 'npx jscpd --threshold 5 --reporters console,silent .' > .husky/pre-commit\n```\n\nFull CI/pre-commit guide: [docs/ci-and-hooks.md](https://github.com/kucherenko/jscpd/blob/master/docs/ci-and-hooks.md).\n\n## Programmatic Usage (Rust)\n\n```rust\nuse cpd_finder::orchestrate::{RunConfig, run};\n\nlet config = RunConfig {\n    paths: vec![\"./src\".into()],\n    min_tokens: 50,\n    ..Default::default()\n};\n\nlet result = run(&config).unwrap();\nprintln!(\"Found {} clones\", result.clones.len());\nprintln!(\"Analyzed {} files\", result.statistics.total.sources);\n```\n\n## Coming from jscpd v4\n\nFlags, config file and reporters are the same. The differences:\n\n| Feature | jscpd v4 (Node.js) | jscpd v5 (Rust) |\n|---------|--------------------|-----------------|\n| `--store` (LevelDB/Redis) | Persistent store for large repos | Not supported (flag ignored with a warning) |\n| Programming API | `jscpd()` Promise, `detectClones()` | Rust crate API; no Node.js API |\n| `--reporters` | All v4 reporters | All except `full` (use `console-full`) |\n| Output filenames | `jscpd-report.json`, `html/` dir | `jscpd-report.*` prefix |\n\nFull table: [docs/rust.md](https://github.com/kucherenko/jscpd/blob/master/docs/rust.md#migrating-from-jscpd-v4). jscpd v4 lives on the [`master-v4`](https://github.com/kucherenko/jscpd/tree/master-v4) branch.\n\n## Architecture\n\n```\njscpd (CLI binary)\n ├── cpd-core      — Detection algorithm (Rabin-Karp rolling hash)\n ├── cpd-tokenizer — Language tokenization (224 formats)\n ├── cpd-finder    — File walking, orchestration, git blame\n └── cpd-reporter  — Output formatting (15 reporters)\n```\n\n## Links\n\n- [Homepage](https://jscpd.dev)\n- [Documentation](https://github.com/kucherenko/jscpd/blob/master/docs/rust.md)\n- [FORMATS.md — all 224 formats](https://github.com/kucherenko/jscpd/blob/master/FORMATS.md)\n- [Benchmark vs other tools](https://github.com/kucherenko/jscpd/blob/master/benchmark/BENCHMARK.md)\n- [AI reporter, MCP server](https://github.com/kucherenko/jscpd/blob/master/docs/ai-ready.md)\n- [GitHub](https://github.com/kucherenko/jscpd)\n- [Changelog](https://github.com/kucherenko/jscpd/blob/master/rust/CHANGELOG.md)\n\n## License\n\nMIT","publish_time":1779716309155,"_cnpm_publish_time":1779716309155,"dist-tags":{"canary":"3.3.0-alpha.8","latest":"5.4.2","latest-4":"4.3.0","prerelease":"1.0.0-rc.6","rc":"4.0.0"}}