Introduction
CukeDedup is a fast static analyzer for duplicate, ambiguous, reusable, and unused Cucumber/Gherkin step definitions. It reads project configuration and test code without executing either one.
It supports:
- JavaScript, JSX, TypeScript, and TSX step definitions, plus experimental Cucumber-Ruby support.
- Cucumber.js, Playwright-BDD, Cypress Cucumber, Jest-Cucumber, and Vitest Cucumber Plugin projects.
- Classic
.featurefiles and Gherkin Markdown.feature.mdfiles. - Terminal, JSON, JSON Lines, HTML, and SARIF reports.
- Thresholds, baselines, changed-file analysis, suppressions, and ignore files.
Ruby support is experimental. Run cuke-dedup from the project root to analyze a conventional Cucumber-Ruby suite under features/. In mixed repositories, automatic discovery can analyze it alongside a JS/TS suite with separate feature paths declared in a Cucumber.js configuration file. For custom Ruby layouts, select the suite explicitly and include its support files. See the supported subset and known limitations.
Install
Section titled “Install”With Cargo:
cargo install cuke-dedupOr in a JavaScript project, using Node.js 24 LTS (recommended):
npm install --save-dev cuke-dedupnpx cuke-dedup .Building from source requires Rust 1.100 or newer:
cargo build --release --lockedQuick start
Section titled “Quick start”Run CukeDedup from the root of a test project:
cuke-dedup .No configuration is required. CukeDedup respects .gitignore and .cuke-dedupignore, skips
common generated directories, discovers conventional Gherkin and JavaScript/TypeScript files, and
recognizes common Given, When, Then, and defineStep registrations and aliases.
Useful commands:
cuke-dedup . --threshold 5cuke-dedup . --print-configcuke-dedup . --reporters terminal,json,html,sarifcuke-dedup . --reporters jsonlcuke-dedup . --output reports/cuke-dedupcuke-dedup check . is equivalent to cuke-dedup .. The explicit check form requires a path;
use cuke-dedup ./check to analyze a directory literally named check.
Framework support
Section titled “Framework support”| Workflow | Recognized registrations |
|---|---|
| Cucumber.js | @cucumber/cucumber and legacy cucumber; ESM, CJS, aliases, namespaces, and static local re-exports. |
| Playwright-BDD | createBdd() registrations and playwright-bdd/decorators class-method decorators. |
| Cypress Cucumber | @badeball/cypress-cucumber-preprocessor and legacy cypress-cucumber-preprocessor/steps. |
| Jest-Cucumber | jest-cucumber inline defineFeature → scenario → step callbacks; handler-reuse rules. |
| Vitest Cucumber Plugin | ESM Given, When, and Then exports from vitest-cucumber-plugin; global step registry. |
Package entrypoints are matched exactly. Plain Playwright projects are supported when their Gherkin bindings use Cucumber.js or Playwright-BDD.
See Discovery and frameworks for configuration detection, monorepo boundaries, module resolution, and incomplete-corpus behavior.
Configuration
Section titled “Configuration”CukeDedup reads an explicit --config file, an auto-discovered CukeDedup configuration, or
supported framework configuration. CLI flags always have the highest precedence.
A minimal .cuke-dedup.json might be:
{ "definitions": ["features/steps/**/*.ts"], "features": ["features/**/*.{feature,feature.md}"], "exclude": ["dist/**"], "threshold": 5, "reporters": ["terminal", "html"]}Use .cuke-dedupignore for repository-specific exclusions:
features/generated/***/*.generated.ts!features/generated/reviewed.generated.tsSee the configuration reference for precedence, every setting, glob semantics, suppressions, and discovery diagnostics.
Findings and reports
Section titled “Findings and reports”CukeDedup detects eight classes of duplication, ambiguity, reuse, and unused definitions. Exact collisions default to errors; heuristic findings default to warnings. See the rule reference for the meaning, default severity, and remediation guidance for every rule.
| Reporter | Best for |
|---|---|
terminal |
Interactive use and concise CI logs. |
json |
Structured integrations and complete result metadata. |
jsonl |
Streaming shell and agent workflows. |
html |
Searchable human review with light and dark themes. |
sarif |
GitHub code scanning and compatible platforms. |
JSON, HTML, and SARIF files default to reports/cuke-dedup/. See
Reports for schemas,
destinations, reproducibility, truncation signals, and reporter-specific behavior.
GitHub Action
Section titled “GitHub Action”The Action downloads a native binary and verifies its checksum and build provenance:
permissions: contents: read
steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: fetch-depth: 0 persist-credentials: false - uses: figueiredoluiz/cuke-dedup@f0e8281427aa6523f8f6f88862e29ad207dbda4d # v0.18.0 with: path: . threshold: 5 reporters: terminal,json,html,sarifFor changed-file checks, baselines, report artifacts, outputs, and hardened pinning, see CI and baselines.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
The configured quality gate passed. |
1 |
The duplication threshold, an error rule, or the new-finding allowance failed. |
2 |
Discovery, parsing, configuration, or another operational error prevented a valid run. |
Warnings alone do not produce exit code 1.
Agent Skill
Section titled “Agent Skill”CukeDedup includes an Agent Skill for safely interpreting and remediating JSONL findings:
npx skills add figueiredoluiz/cuke-dedup --skill cuke-dedupFrom a local checkout, use npx skills add ./skills --skill cuke-dedup.
The installer can target supported coding agents or install globally. Run
npx skills add --help for agent and scope options.
Invoke it as $cuke-dedup where supported, or ask the agent to analyze and safely fix duplicate
Cucumber step definitions. The skill lives in
skills/cuke-dedup
and is distributed independently from the Cargo and npm packages.
Documentation
Section titled “Documentation”- Configuration
- Discovery and frameworks
- Rules and duplication threshold
- Reports
- CI and baselines
- Safety and limitations
- All pages, including the per-rule and discovery pages, the development reference and release steps
Compatibility
Section titled “Compatibility”- Building from source requires Rust 1.100 or newer. Node.js 24 LTS is recommended for the npm launcher; Node.js 20 remains the minimum compatible version and is tested in CI.
- Definition extraction supports JavaScript and TypeScript, including JSX and common module variants, plus a subset of Cucumber-Ruby. See Ruby support.
- Static analysis cannot safely resolve every dynamic configuration, matcher, wrapper, or imported handler. CukeDedup reports incomplete analysis instead of treating missing evidence as clean.
- Before version 1.0, configuration and machine-report schemas may change between minor releases.
See Safety and limitations for the complete compatibility contract and resource limits.
Contributing and support
Section titled “Contributing and support”See CONTRIBUTING.md for development commands, corpus guidance, and pull-request expectations. Use the issue templates for reproducible bugs and focused feature requests. Report vulnerabilities privately according to SECURITY.md. Bug reports should include a minimal sanitized fixture with application-specific names, credentials, and source removed.
CukeDedup is an independent project. It is not affiliated with or endorsed by the Cucumber project or its maintainers.
Releases
Section titled “Releases”Release archives include SHA-256 checksums, keyless Sigstore bundles, and GitHub build provenance. Published versions and release notes are maintained in GitHub Releases.
gh attestation verify <archive> \ --repo figueiredoluiz/cuke-dedup \ --signer-workflow figueiredoluiz/cuke-dedup/.github/workflows/release.yml