Development
This page is for contributors who want to modify dup-code-check: how to build, test, and navigate the repo structure.
Repo layout
crates/core: Rust core (scanning, normalization, detectors, report generation)crates/cli: Rust CLI binarybin/: built binary output (bin/dup-code-check)scripts/: build/validation scripts
Build
bash
npm install
npm run buildThe binary is written to bin/dup-code-check.
Run
bash
./bin/dup-code-check --help
./bin/dup-code-check .Tests & validation
Rust tests
bash
cargo testCLI smoke tests
bash
npm testnpm test runs scripts/smoke.mjs, which creates small temporary repos/files to validate:
- duplicate file scan is correct
- argument validation (e.g.
--max-file-size) is strict --option terminator works.gitignoreis respected by default and can be disabled via--no-gitignore
Unified gate (for local/hooks)
bash
./scripts/gate.shIt auto-detects project markers and runs:
cargo fmt --checkcargo checknpm run check
Git hooks (optional but recommended)
bash
./scripts/bootstrap.shThis configures core.hooksPath=githooks and enables:
pre-commit: requires updatingCHANGELOG.mdfor every commit, then runs the gatecommit-msg: enforces Conventional Commits + branch prefix rules