Skip to content
CAI
Software that uses CAICheck a score

kucherenko/jscpd

47.9

Weak · 14 November 2026

82.7k

lines of production code

Rust

with JavaScript

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add money utility and report generation to nested-paths-demo

The nested-paths-demo fixture now includes core application logic for financial calculations and reporting. A new money module provides utilities for converting string amounts to integer cents, formatting those cents into human-readable currency strings, and splitting amounts evenly. Additionally, a report module has been added to generate monthly summaries of ledger entries, grouping them by category and displaying totals.

fixtures/nested-paths-demo · high confidence

Added Rust example for jscpd v5 engine integration

A new Rust example (\examples/rust-cpd-finder\) has been added to demonstrate how to integrate and run the jscpd v5 copy-paste detection engine from a Rust application. The example provides a minimal CLI tool that accepts file paths as arguments, configures the detection sensitivity (defaulting to 50 minimum tokens), and outputs the number of detected clones along with details of the first ten matches.

examples/rust-cpd-finder · high confidence

Expanded language support with new fixture files

Added sample code fixtures for ActionScript, Ada, ANTLR4, Apex, APL, Astro, AWK, BASIC, Bicep, Brainfuck, CFML, CFScript, and C-like languages (C, C++, C\#, etc.) to enable testing and validation of duplication detection for these specific file formats and syntaxes.

fixtures · high confidence

HTML migration map and table for code comparison

The \--compare\ mode now generates an interactive HTML report (\jscpd-compare.html\) that visualizes the comparison between two codebases. The report features a migration map that draws the two sides as dependency graphs with bridging pairs, alongside a table view listing the same data. It highlights functions ready to port, displays similarity scores, and shows progress per folder, all driven by embedded JSON data for offline use.

rust/crates/cpd/src/compare · high confidence

Initial implementation of the semantic-demo application

This change introduces the complete codebase for the semantic-demo fixture, providing a functional full-stack application. The backend (Rust/Axum) implements a REST API for listing articles, fetching individual articles by slug, and calculating cart quotes with tax and shipping logic, backed by a PostgreSQL database with automatic migrations. The frontend (Svelte/TypeScript) provides the user interface, including components for article cards, pagination, a shopping cart summary, a signup form with client-side validation, a payment form with Luhn card validation, and a theme toggle. It also includes shared utilities for API communication with retry logic and relative time formatting.

fixtures/semantic-demo/backend, fixtures/semantic-demo/frontend · high confidence

Introduce CPD tool benchmark comparing jscpd@5, jscpd-rs, and others

Added a new benchmark suite in the \benchmark/\ directory that evaluates six copy/paste detection tools (jscpd@5, jscpd-rs, Duplo, Fallow, Simian, PMD CPD) against a multi-language fixture set. The benchmark measures execution speed, clone detection counts, and duplicate line coverage, while also assessing how well each tool handles cross-format detection in component files (.vue, .svelte, .astro) and embedded code in Markdown. Additionally, it compares the AI token efficiency of each tool's output format, highlighting jscpd@5's new 'ai' reporter as the most efficient for LLM consumption.

benchmark · high confidence

Introduce new dead-code detection engine

The \basta\ tool now includes a new engine for detecting dead code, allowing users to find unused files, exports, declarations, and imports. This feature adds a \--dead-code\ flag (accessible via \jscpd --dead-code\ or the \basta\ binary) that builds an import graph from project entry points and reports unreachable code. The engine supports multiple languages, integrates with framework definitions to recognize entry points, and provides confidence scores for findings to help users prioritize cleanup. Also in this area: Improved dead-code detection for framework hooks and constructors; Fixes false positives for backtick imports and magic methods; Switch YAML parsing to serde\_saphyr.

rust/crates/basta/src · high confidence

New Rust tokenizer crate with multi-format and embedded-language support

The cpd-tokenizer crate has been introduced to replace the previous tokenization logic, providing a Rust-native implementation that supports 223 language formats via a new formats registry. It adds specialized tokenizers for embedded languages in container files, including Razor (.razor), Vue Single-File Components (SFC), Svelte, and Astro, ensuring that code blocks within HTML are correctly isolated and tokenized. The crate also introduces cross-format clone detection for TypeScript by stripping type-only syntax to match JavaScript, and adds function-level similarity extraction for JavaScript and TypeScript using the OXC parser. Additionally, it implements a generic whitespace-and-punctuation tokenizer for non-JS/TS languages with correct comment handling for various syntaxes (C-style, hash, semicolon, etc.) and supports ignore regions via \jscpd:ignore\ markers and code-level regex patterns.

rust/crates/cpd-tokenizer/src · high confidence

New Rust-based CLI with advanced analysis modes and integration capabilities

The \rust/crates/cpd\ crate introduces a new Rust-based implementation of the \jscpd\/\cpd\ CLI, replacing the previous TypeScript version. This change adds several new analysis modes: \--compare\ for side-by-side function comparison between two folders using semantic embeddings; \--complexity\ for scanning code complexity without clone detection; \--dashboard\ and \--health\ for generating project health scores and badges; and \--dead-code\ for identifying unused code via the \basta\ engine. It also introduces \--history\ to track duplication trends over git commits, \--baseline-from-ref\ for stateless CI gating, and \--mcp\ to expose the tool as a Model Context Protocol server for LLM integration. The CLI now supports cross-format clone detection (\--cross-formats\), isolated folder skipping (\--skip-isolated\), and detailed summary reports (\--summary\).

rust/crates/cpd/src · high confidence

New boundaries feature to enforce code containment rules

Users can now define 'boundaries' in the configuration file to ensure that code from specific modules, folders, or methods remains within its designated scope. This feature introduces a new \Checker\ and rule system that scans for violations—such as copy-pasted, edited, or semantically similar code appearing in forbidden locations (defined via \notIn\)—and fails the run if such breaches are detected. The implementation supports granular control over which types of copies to detect (exact, renamed, gap, AST, semantic) and allows per-rule thresholds, enabling teams to prevent architectural drift and unauthorized code reuse across different parts of the codebase.

rust/crates/cpd/src/boundaries · high confidence

The cpd-core crate now includes dedicated modules for new analysis capabilities: deadcode.rs defines the data model for unused code findings (files, exports, symbols, imports, members); health.rs implements a 0–100 project health score based on duplication, dead code, and complexity; history.rs provides the data structures and sparkline helpers for duplication trends over git history; and similarity.rs introduces function-level similarity detection using AST shingles and MinHash for JS/TS. These modules support the corresponding CLI flags (--rust-diagnostics, --health, --history, --similarity) by providing the underlying data models and calculation logic.

rust/crates/cpd-core/src · high confidence

New dead-code detection engine for JavaScript, TypeScript, and Python

The \basta\ tool now includes a new engine for detecting dead code, starting with support for JavaScript, TypeScript, JSX, TSX, and Python. The JavaScript analyzer leverages the \oxc\ parser to perform semantic analysis, correctly resolving bindings through shadowing and hoisting, and handles CommonJS patterns (\require\, \module.exports\) that standard ESM parsers miss. It also supports single-file components (Vue, Svelte, Astro) by parsing the script portion while scanning markup for component usage. The Python analyzer uses the \ruff\ parser to infer module boundaries via \\_\all\\_\ and handles dynamic runtime references (e.g., \getattr\, string-based imports) by lowering confidence rather than ignoring them. Both analyzers define entry points via convention-based globs (e.g., \index.ts\, \main.py\) and read manifest files (\package.json\, \pyproject.toml\) to identify project roots and dependencies.

rust/crates/basta/src/lang · high confidence

New release and build automation scripts for Rust-based jscpd

The repository now includes a suite of scripts in rust/scripts to automate the build, packaging, and publishing of the Rust-based jscpd binary. build-pypi-wheels.py repacks release tarballs into PyPI platform wheels for macOS, Linux, and Windows, exposing both jscpd and cpd commands. publish-npm.sh and publish-crates.sh handle publishing to npm and crates.io respectively, managing platform-specific packages, dependency ordering, and idempotency checks. sync-version.mjs synchronizes version numbers across the Rust workspace, npm wrappers, and PyPI metadata, while npm-prebuilt-package.mjs constructs the individual platform packages. gen-formats-md.mjs keeps the supported formats documentation in sync with the tokenizer source.

rust/scripts · high confidence

New semantic code comparison and local embedding engine

The \cpd-semantic\ crate introduces a new \--compare\ mode that pairs functions across two codebases (such as a port to another language) using semantic similarity and name matching, while keeping tests and code separate. It includes a local embedding engine that runs models like CodeRankEmbed in-process on the CPU, a vector cache to persist embeddings between runs, and a catalog of calibrated models with per-model thresholds. Security is improved by restricting API keys from config files to localhost-only URLs and masking keys in error output.

rust/crates/cpd-semantic · high confidence

New structural similarity detection for Clojure and optimized pair matching

The \cpd-similarity\ crate now supports structural similarity analysis for Clojure, treating every top-level form (except \ns\) as a comparable unit with a custom reader that handles reader conditionals and metadata. The similarity engine also introduces an optimized, exact search algorithm for finding code pairs based on Jaccard index thresholds, replacing the previous approach to ensure all matching pairs above the threshold are found without the performance cost of comparing every possible pair. This includes new modules for Clojure parsing (\clojure.rs\), the optimized pair search (\join.rs\), and fingerprint generation (\prints.rs\).

rust/crates/cpd-similarity · high confidence

Rust cpd-reporter workspace introduces new reporters and baseline gating

The Rust cpd-reporter crate has been restructured into a multi-crate workspace, bringing a comprehensive set of new reporting capabilities and CI integration features. Users can now generate SVG badges for duplication and health scores, output reports in CodeClimate/GitLab Code Quality and OpenMetrics formats, and view a unified project dashboard covering health, complexity, and dead code. A new baseline system allows CI pipelines to gate on new duplication only by comparing clone fingerprints against a committed baseline file. Console output has been enhanced with verbose blame comparisons, and the reporter now supports opt-in codebase summaries and duplication history trends.

rust/crates/cpd-reporter/src · high confidence

Rust engine v5 release with semantic clone detection and dead-code analysis

The Rust-based jscpd engine (v5) introduces experimental semantic clone detection via \--semantic\, which uses code embedding models to find functionally similar code beyond token matching. It also adds a new dead-code detection engine (basta) accessible via \--dead-code\, which analyzes import graphs to find unused code. The release includes a comprehensive dashboard (\--dashboard\) and health scoring (\--health\), improved complexity metrics, and fixes for nested scan paths, CRLF line endings, and Svelte store usage. The toolchain is pinned to Rust 1.97.1, and dependencies like \sha2\ and \paste\ (replaced by \pastey\ for security) have been updated.

rust · high confidence

basta 0.1.1: npm package with prebuilt binaries and framework detection

The \rust/basta\ location now ships a standalone npm package (version 0.1.1) that includes a \README.md\, a \platform-map.js\ defining supported OS/arch/libc combinations, and a \run-basta.js\ entry point that resolves and executes the corresponding prebuilt Rust binary. This enables users to install and run \basta\ via npm without manual compilation. The tool also introduces framework detection, allowing it to automatically identify and keep alive files loaded by specific frameworks (e.g., Next.js, Django) based on a built-in list and optional custom configuration, ensuring that framework-managed entry points are not reported as dead code.

rust/basta · high confidence

jscpd now runs as a language server with dedicated dead-code, complexity, and semantic analyses

Users can now start jscpd as a language server using the \--lsp\ flag, enabling real-time clone detection, dead-code analysis, complexity warnings, and semantic similarity checks directly in their editors. The server splits workspaces into projects based on \.jscpd.json\ files, runs analyses in the background, and publishes findings as diagnostics, hovers, and code actions. Users can control which analyses run via the \--lsp-analyses\ command-line flag or the \lsp\ section of their configuration, with separate settings for clones, AST similarity, semantic clones, dead code, and complexity thresholds.

rust/crates/cpd/src/lsp · high confidence

jscpd now runs as an MCP server for AI agent integration

The \rust/crates/cpd/src/mcp\ module introduces a new Model Context Protocol (MCP) server, allowing jscpd to be used by AI agents via stdio. This implementation supports both the legacy handshake protocol (versions 2024-11-05 through 2025-11-25) and the new stateless protocol (2026-07-28). It exposes five tools: \check\_duplication\ to find clones in a code snippet against the project, \get\_file\_clones\ to list clones for a specific file, \get\_statistics\ for project-wide duplication metrics, \check\_current\_directory\ to re-scan the project, and \compare\_folders\ to compare two directories function-by-function using semantic embeddings. The server handles four clone types (exact, renamed, similar/gap, similar/ast, and semantic) and respects the project's existing configuration for thresholds and filters.

rust/crates/cpd/src/mcp · high confidence

jscpd v5 engine release with Rust implementation and expanded capabilities

The project has transitioned to a Rust-based engine (v5) that ships as a self-contained binary with no runtime dependencies, replacing the previous Node.js/TypeScript implementation. This new version supports 224 programming languages and introduces advanced detection features including Type-2 clones (ignoring identifiers, literals, and annotations), Type-3 near-miss clones via syntax-tree similarity and gap merging, and experimental Type-4 semantic clones using code embeddings. The release also adds a built-in MCP server for AI integration, a GitHub Action, and a pre-commit hook that uses a PyPI wheel instead of Node.js. Documentation has been restructured to separate v4 and v5 details, and the project now includes a CITATION file, Code of Conduct, and security policy.

(repo-wide) · high confidence

Security

Replace unmaintained paste crate with pastey to address security advisory

The \paste\ crate has been replaced with \pastey\ to resolve RUSTSEC-2024-0436, addressing the unmaintained status of the original library. This change ensures that dependencies like \gemm\, \pulp\, and \tokenizers\ continue to function correctly by providing the \paste!\ macro through the maintained \pastey\ successor, while keeping the workspace patch in place until \paste\ is no longer required.

rust/patches/paste · high confidence

Behavioural changes

Rust cpd-finder crate restructured with new blame, orchestration, and walker modules

The Rust cpd-finder crate has been reorganized into distinct modules: blame.rs now handles git blame enrichment for clone fragments, orchestrate.rs manages the full detection pipeline configuration and execution, pass.rs defines the trait for whole-file clone passes, statistics.rs computes duplication metrics, and walker.rs handles file discovery with improved symlink and pattern handling. This restructuring supports new features like cross-format clone detection, function-level similarity analysis, and improved path filtering while maintaining compatibility with existing CLI options. Also in this area: Improved file format detection and .git folder exclusion.

rust/crates/cpd-finder/src · high confidence

jscpd v5 introduces a Rust-based engine with native Windows on ARM support

The jscpd tool now offers a v5 release built on a Rust engine, providing a self-contained binary that runs without a Node.js runtime. This update adds native support for Windows on ARM, alongside existing support for macOS and Linux (x64 and arm64, glibc and musl). The npm package now installs a prebuilt binary for the detected platform, and the CLI behavior (including exit codes) has been aligned with v4 standards. Users should note that persistent stores (LevelDB/Redis) and the Node.js programming API are no longer supported in this version.

rust/jscpd · high confidence

Test coverage

5 commits adding/updating tests in rust/crates/cpd-tokenizer/tests; Added Scala test fixtures for Spark Command class; Added demo fixtures for ignore mechanisms; Added integration tests for cpd CLI features and configurations; Added integration tests for cpd-finder; Added integration tests for reporter blame data and output generation; Added integration tests for the basta binary and analysis engine.

Dependencies

Introduce Rust-based jscpd v5 engine and dead-code detection via Basta

This change adds the foundational dependency manifests and lockfiles for the new Rust-based jscpd v5 engine (jscpd 5.3.3) and the new dead-code detection tool (basta 0.3.0). It establishes the Rust workspace structure in \rust/Cargo.toml\ with crates for core logic, tokenization, finding, reporting, and semantic analysis, alongside platform-specific npm packages for the prebuilt binaries. It also introduces the \basta\ package for detecting unused code across JavaScript, TypeScript, Python, and Rust, and adds a benchmark tool configuration using \fallow\ and \jscpd-rs\. As part of this architectural shift, the legacy root \package.json\ is removed.

(dependencies) · high confidence

Housekeeping

Added demo fixtures for dead-code detection analysis

Added sample application code in the \fixtures/dead-code-demo\ directory to serve as test cases for dead-code detection tools. This includes a Vite-based bundler demo with internationalization, routing, and legacy API stubs, as well as a monorepo structure containing a shop app and a shared UI package with unused components.

fixtures/dead-code-demo/bundler, fixtures/dead-code-demo/monorepo/apps/shop, fixtures/dead-code-demo/monorepo/packages/ui · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 56 → 48 (-8.5)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 51 → 33 (-17.6)
  • Architecture 98 → 98 (-0.1)
  • Maturity 73 → 80 (+7.1)
  • Readiness 54 → 54 (+0.0)
  • Security 83 → 80 (-3.6)
  • Domain Modelling 100 → 100 (+0.0)
  • Accessibility 52 → 48 (-3.5)
  • Performance 100 → 100 (+0.0)

Resolved (19)

  • Duplicated block (10 lines × 2) (rust/crates/cpd-reporter/src/dashboard.rs)
  • Duplicated block (13 lines × 2) (fixtures/clike/file1.kt)
  • Duplicated block (8 lines × 2) (rust/crates/cpd-reporter/src/dashboard.rs)
  • High secret: WD-SECRET-0005 (package-lock.json)
  • Hotspot: rust/crates/basta/src/analyze.rs (rust/crates/basta/src/analyze.rs)
  • Hotspot: rust/crates/basta/src/classify.rs (rust/crates/basta/src/classify.rs)
  • Hotspot: rust/crates/cpd-core/src/deadcode.rs (rust/crates/cpd-core/src/deadcode.rs)
  • Hotspot: rust/crates/cpd-reporter/src/dashboard.rs (rust/crates/cpd-reporter/src/dashboard.rs)
  • Hotspot: rust/crates/cpd-reporter/src/reporter.rs (rust/crates/cpd-reporter/src/reporter.rs)
  • Hotspot: rust/crates/cpd-similarity/src/syntax.rs (rust/crates/cpd-similarity/src/syntax.rs)
  • Medium vulnerability: RUSTSEC-2026-0367 (rust/Cargo.lock)
  • Medium: security finding (details withheld)
  • Near-duplicate member pair (35 shared lines) (rust/crates/cpd-reporter/src/dashboard.rs)
  • No ADRs found
  • Off-boarding risk: anonymized user #1
  • Outdated: globset
  • Outdated: ignore
  • Outdated: memmap2
  • Repeated repair: rust/crates/cpd-core/src/hash.rs (rust/crates/cpd-core/src/hash.rs)

New (42)

  • Duplicated block (10 lines × 2) (rust/crates/cpd-reporter/src/dashboard.rs)
  • Duplicated block (13 lines × 2) (fixtures/clike/file1.kt)
  • Duplicated block (6 lines × 2) (rust/crates/basta/src/classify.rs)
  • Duplicated block (6 lines × 2) (rust/crates/cpd/src/lsp/findings.rs)
  • Duplicated block (8 lines × 2) (rust/crates/cpd-reporter/src/dashboard.rs)
  • Duplicated block (9 lines × 2) (fixtures/similarity-demo/languages/Shelf.kt)
  • Edited copies of one member (3 members, 16+ corresponding lines) (rust/crates/basta/src/entry.rs)
  • Edited copy of a member (10 corresponding lines) (rust/crates/basta/src/lang/javascript.rs)
  • Edited copy of a member (10 corresponding lines) (rust/crates/basta/src/lang/javascript.rs)
  • Edited copy of a member (10 corresponding lines) (rust/crates/cpd/src/cli.rs)
  • Edited copy of a member (11 corresponding lines) (fixtures/similarity-demo/languages/Shelf.cs)
  • Edited copy of a member (11 corresponding lines) (rust/crates/cpd-reporter/src/boundaries_render.rs)
  • Edited copy of a member (12 corresponding lines) (rust/crates/cpd-reporter/src/csv_reporter.rs)
  • Edited copy of a member (12 corresponding lines) (rust/crates/cpd-semantic/src/embed/jina_bert.rs)
  • Edited copy of a member (12 corresponding lines) (rust/crates/cpd-tokenizer/src/ts_strip.rs)
  • Edited copy of a member (13 corresponding lines) (rust/crates/cpd-tokenizer/src/ts_strip.rs)
  • Edited copy of a member (17 corresponding lines) (rust/crates/basta/src/cli.rs)
  • Edited copy of a member (17 corresponding lines) (rust/crates/cpd-semantic/src/embed/jina_bert.rs)
  • Edited copy of a member (20 corresponding lines) (rust/crates/basta/src/lang/javascript.rs)
  • Edited copy of a member (22 corresponding lines) (rust/crates/cpd-reporter/src/deadcode/mod.rs)
  • …and 22 more

Changes since last survey

  • 72 commits — 51 feature/other, 21 fixes

By area

  • (repo) — 32 commits
  • rust/crates — 12 commits
  • rust/Cargo.lock — 11 commits
  • .github/workflows — 9 commits
  • (root) — 3 commits
  • rust/jscpd — 3 commits
  • docs/editors.md — 1 commit
  • rust/.cargo — 1 commit

Notable commits

  • fix: Merge pull request #1260 from kucherenko/fix/lsp-jsx-ignore-markers
  • fix: Merge pull request #1262 from kucherenko/fix/npmmirror-sync
  • fix: Merge pull request #1264 from kucherenko/fix/lsp-jsx-markers-followup
  • fix: Merge pull request #1272 from kucherenko/fix/nix-package
  • fix: Merge pull request #1279 from kucherenko/fix/rustsec-2026-0429
  • fix: Merge pull request #1291 from kucherenko/fix/rustix-1.1.6
  • fix: Merge pull request #1292 from kucherenko/fix/get-jscpd-report-review
  • fix: Merge remote-tracking branch 'origin/master' into fix/lsp-jsx-markers-followup
  • fix: Merge remote-tracking branch 'origin/master' into fix/nix-package
  • fix: fix(deps): bump candle to 0.11.1 for zip 9 (RUSTSEC-2026-0429)
  • fix: fix(deps): bump rustix to 1.1.6 for RUSTSEC-2026-0486
  • fix: fix(deps): keep windows-sys 0.61.2 for errno, tempfile and winapi-util
  • fix: fix(html): review fixes for the side-by-side report
  • fix: fix(lsp): ignore markers in the format of each copy
  • fix: fix(lsp): no code actions for a request of other kinds only
  • fix: fix(lsp): no line comment from a slash before the start marker
  • fix: fix(lsp): put JSX ignore markers in {/* */} and outside tags
  • fix: fix(nix): build from the whole rust folder
  • fix: fix(nix): keep the paste shim real in the dependency build
  • fix: fix(npm): getJscpdReport names what jscpd wrote when there is no report
  • …and 52 more

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

kucherenko/jscpd was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit b79927a32fbfa38f9580c224d679c8ef855c1d5f — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-e1a3b69fc8ee.