EVERYTHING XIAOMI
Get listed

@kongyo2/similarity-ts

@kongyo2/similarity-ts is a free TypeScript-only analyzer for structurally comparing functions, types and classes across a repository.

Place
#21 of 23
Score
5.3
@kongyo2/similarity-ts's website

What @kongyo2/similarity-ts is

@kongyo2/similarity-ts is a free TypeScript-only analyzer for structurally comparing functions, types and classes across a repository. The package provides a CLI and JavaScript library and requires Node.js 20 or newer. A quick start scans the current directory with npx @kongyo2/similarity-ts .. By default it checks .ts, .tsx, .mts and .cts files, using functions, types, classes and overlap modes. Equivalent coding styles such as arrow functions and declarations, .then() and await, and selected loop forms are normalized. Parameters, locals, inner functions and declaration names are alpha-renamed, while free identifiers remain significant. Behavior-changing forms such as map versus filter, async versus synchronous code, and ?? versus || stay distinct. Users can set thresholds, minimum sizes, extensions, exclusions and output format. Pretty or JSON reports are available, alongside --fail-on-duplicates for CI.

Good

  • Free MIT-licensed package
  • CLI and JavaScript library forms
  • AST-based repository scanning
  • Pretty, JSON and CI-failure outputs
  • Normalizes several equivalent coding styles

Watch out

  • Requires Node.js 20 or newer
  • No IDE integration is listed
  • Supports TypeScript file extensions by default

Who it suits

This suits TypeScript developers and teams seeking repository-level duplicate-code analysis. It also fits CI workflows and refactoring work assisted by AI coding tools.

Verdict

similarity-ts offers configurable structural similarity analysis for TypeScript repositories, with normalization that separates stylistic changes from behavioral differences. Its CLI, library entry point and CI option make it practical for automated duplicate detection.

The facts

Each one read from @kongyo2/similarity-ts's own pages, with the date it was checked.

What it does

Accuracy benchmark
The README reports that version 0.7.0 correctly labeled all 300 pairs in its stated benchmark corpus.checked 7 Oct 2026
Analysis modes
Its default modes are functions, types, classes, and overlap, and the README documents options to select modes and restrict scan scope.checked 5 Oct 2026
Analysis targets
It compares functions, types, and classes structurally.checked 7 Oct 2026
Behavioral distinctions
The README says behavior-changing differences such as `.map` versus `.filter` and `async` versus synchronous contracts retain distinct shapes.checked 7 Oct 2026
CI use
The CLI offers a `--fail-on-duplicates` option that exits non-zero when any pair is reported.checked 7 Oct 2026
CLI controls
The CLI supports selecting analysis modes, setting a similarity threshold, filtering file extensions, excluding patterns, and choosing pretty or JSON output.checked 7 Oct 2026
Code style matching
It canonicalizes documented style variants, including arrow functions versus declarations, `.then()` versus `await`, and several loop forms.checked 5 Oct 2026
Exclusions
A declaration can be excluded from the report with a `// similarity-ignore` comment on the preceding line.checked 5 Oct 2026
Install and run
The README’s quick start runs the analyzer with `npx @kongyo2/similarity-ts .`.checked 5 Oct 2026
Intended workflow
The README suggests using the command with an AI coding assistant to find duplicate code patterns and create a refactoring plan.checked 7 Oct 2026
License
The repository identifies its license as MIT.checked 7 Oct 2026
Output and CI
It supports pretty or JSON output and a `--fail-on-duplicates` option that exits nonzero when any pair is reported.checked 5 Oct 2026
Package form and runtime
The package metadata describes a CLI and library, exposes a command-line binary and JavaScript entry point, and specifies Node.js 20 or newer.checked 5 Oct 2026
Package formats
The package metadata exposes both a `similarity-ts` command-line executable and a JavaScript library entry point with TypeScript declarations.checked 7 Oct 2026
Purpose
The project describes itself as a TypeScript-only similarity analyzer for detecting semantic code similarities.checked 7 Oct 2026
Rename handling
It alpha-renames function parameters, locals, inner functions, and declaration names before comparison, while retaining free identifier names.checked 7 Oct 2026
Runtime requirement
The package metadata specifies Node.js version 20 or newer.checked 7 Oct 2026
Style normalization
The analyzer canonicalizes several equivalent coding forms, including function declarations and arrow functions, some loop rewrites, and structurally identical interfaces and type aliases.checked 7 Oct 2026
Supported file extensions
The default extensions it scans are `ts`, `tsx`, `mts`, and `cts`.checked 5 Oct 2026
Threshold and size controls
The similarity threshold defaults to 0.8, the minimum function length defaults to three lines, and a minimum AST-token size can replace the line gate.checked 5 Oct 2026
Usage
The README shows running it on the current directory with `npx @kongyo2/similarity-ts .`.checked 7 Oct 2026

The company

Maker identity
The repository is hosted under the GitHub account `kongyo2`; the opened project pages do not state a maker’s personal or company name, headquarters, or founding date.checked 5 Oct 2026

Alternatives to @kongyo2/similarity-ts

All alternatives
  1. 1jscpd logo

    jscpd

    Free planOpen sourceAPILinuxmacOSSelf-hosted
    7.4Free plan
  2. 2

    PMD

    Free planLinuxmacOSSelf-hostedWindows
    6.8Free plan
  3. 3

    Duplo

    Free planLinuxmacOSWindows
    6.5Free plan
  4. 4

    CCFinderSW

    Free planWindows
    6.4Free plan
  5. 5

    CopyPaste

    Free planmacOSWindows
    6.2Free plan
  6. 6

    dcd

    Free planLinuxmacOS
    6.2Free plan