jscpd
यह क्या करती है
यह jscpd डुप्लिकेट डिटेक्टर चलाने और उसका आउटपुट पढ़ने का तरीका बताती है। यह उन डेवलपर्स के लिए है जो कई भाषाओं में दोहराया गया कोड मापना या कम करना चाहते हैं।
कब इस्तेमाल करें
- ✓जब डेवलपर जानना चाहे कि प्रोजेक्ट का कितना हिस्सा कॉपी-पेस्ट कोड है।
- ✓जब टीम को उन फ़ाइलों की छोटी सूची चाहिए जिनमें सबसे ज़्यादा दोहराव है।
- ✓जब डेवलपर पेस्ट करने के बाद संपादित की गई लगभग-नकल ढूँढना चाहे।
Skill का लिंक
https://github.com/kucherenko/jscpd/blob/master/skills/jscpd/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस प्रोजेक्ट का कितना हिस्सा कॉपी-पेस्ट किया हुआ है, और मुझे पहले किन फ़ाइलों को देखना चाहिए?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह स्किल डिटेक्टर को संक्षिप्त रिपोर्ट फ़ॉर्मेट के साथ चलाती है, फिर मिलते ब्लॉक और सबसे ज़्यादा दोहराव वाली फ़ाइलों का सारांश सूचीबद्ध करती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
jscpd
Copy-paste detector for programming source code, supports 220+ languages. Use this skill to run jscpd and understand its output.
Quick Start
# Run with ai reporter (compact output optimized for agents)
npx jscpd --reporters ai <path>
# With ignore patterns
npx jscpd --reporters ai --ignore "**/node_modules/**,**/dist/**" <path>
# Scope to specific formats
npx jscpd --reporters ai --format "javascript,typescript" <path>
# Second pass, noisier: copies that only differ in names and values (Type-2, "renamed").
# Review each hit before acting on it.
npx jscpd --reporters ai --ignore-identifiers --min-tokens 70 <path>
# Third pass, noisier still: copies with a few edited lines or the same function
# structure (Type-3, "similar"). Keep the settings tight.
npx jscpd --reporters ai --max-gap-lines 1 --similarity <path>
# Where to refactor first: clone list plus a hotspot summary
npx jscpd --reporters ai --summary <path>
# Most complex files only, without clone detection
npx jscpd --complexity --reporters ai <path>
AI Reporter Output Format
The ai reporter produces compact, token-efficient output designed for agent consumption:
Clones:
src/ foo.ts:10-25 ~ bar.ts:42-57
src/utils/helpers.ts:100-120 ~ src/utils/other.ts:5-25
src/cart/ basket.js:1-9 ~ cart.js:1-9 (renamed)
src/api/ save-account.js:1-12 ~ save-user.js:1-11 [~0.91 gap]
src/billing/ orders.ts:1-14 ~ refunds.ts:1-15 [~0.85 ast]
---
5 clones · 4.2% duplication
Each line represents one clone pair:
- Same file:
path/file.ts 10-25 ~ 45-60(shared path shown once) - Same directory:
shared/prefix/ file-a.ts:10-25 ~ file-b.ts:42-57(common prefix factored out) - Different paths:
path/a.ts:10-25 ~ path/b.ts:42-57
A suffix tells the kind of clone; no suffix means an exact copy:
(renamed): the two blocks differ only in identifier names, literal values or annotations (Type-2). Only appears with--ignore-identifiers,--ignore-literalsor--ignore-annotations.[~0.91 gap]: two exact clones merged across up to--max-gap-linesunmatched lines (Type-3). The number is matched tokens over the merged span.[~0.85 ast]: two functions whose normalized syntax trees share at least--similarityof their subtrees (Type-3). The number is that share. The names of called functions and methods and the operators count, local names and literal values do not, so a renamed copy with other constants scores 1 and a copy that calls other methods scores lower. A name still has to stand for one name on the other side: a copy that swaps the roles of two names scores lower.
Options
| Option | Description |
|---|---|
--reporters ai |
Use the AI-optimized reporter (compact clone list for agents) |
--reporters html |
Generate HTML report |
--reporters json |
Output JSON report |
--min-tokens N |
Minimum tokens to consider a duplication (default: 50) |
--min-lines N |
Minimum lines to consider a duplication (default: 5) |
--threshold N |
Exit with error if duplication % exceeds N |
--ignore "glob" |
Ignore patterns (comma-separated) |
--format "list" |
Limit to specific languages (e.g. typescript,javascript) |
--cross-formats "groups" |
Detect clones across related formats (e.g. javascript,typescript or the js-ts preset) |
--ignore-identifiers |
Treat all identifiers as equal, so blocks that differ only in variable, function or type names match (Type-2, reported as renamed); a name must stand for one name on the other side, so look-alikes with another data flow stay out, while a field and a local of one text are two names, so this.url = url still matches this.url = link (--ignore-identifiers=blind matches any names) |
--ignore-literals |
Treat all string literals as equal and all numeric literals as equal (Type-2) |
--ignore-annotations |
Drop @Name / @Name(...) annotations and decorators before matching, in languages where @ means one (Type-2) |
--max-gap-lines N |
Merge clones of one file pair separated by at most N unmatched lines into one similar clone (Type-3, default: 0 = off) |
--similarity [RATIO] |
Report pairs of functions whose normalized syntax trees share at least RATIO of their subtrees, in (0, 1], as similar clones (Type-3, 0.8 without a value). JavaScript, TypeScript, Python, Java, Kotlin, Scala, C#, Go, Rust, C, C++, PHP, Ruby, Swift and Clojure; test files are left out |
--min-nodes N |
The fewest |
अक्सर पूछे जाने वाले सवाल
यह कितनी भाषाएँ सपोर्ट करती है?
स्किल के अनुसार यह 200 से ज़्यादा भाषाएँ सपोर्ट करती है।
नाम बदली हुई नकल क्या है?
वह नकल जिसमें केवल वेरिएबल के नाम या मान बदले गए हों।
क्या नतीजे हमेशा दोष होते हैं?
नहीं। स्किल कहती है कि शोर वाले चरण मिलता-जुलता कोड चिह्नित कर सकते हैं, इसलिए कार्रवाई से पहले हर मिलान पढ़ना चाहिए।
जानकारी
लेखक का मूल विवरण
Copy-paste detector for 220+ languages. Detect exact, renamed and near-miss duplicated code, measure duplication percentages, and find refactoring hotspots with the codebase summary.
repo: kucherenko/jscpd
लोकप्रियता
- GitHub स्टार
- 6.5k
- रैंकिंग में स्थान
- #14191
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
code-migration
6.5kआपके एजेंट को एक भाषा या फ़्रेमवर्क से दूसरे में कोड एक-एक फ़ंक्शन करके ले जाने में मदद करती है, पहले टेस्ट के साथ और मूल से तुलना करके प्रगति मापते हुए।
codebase-refactoring
6.5kआपके एजेंट को किसी कोडबेस की सेहत सुधारने में मदद करती है: दोहराया कोड ठीक करके, बेकार कोड हटाकर और सबसे जटिल फ़ाइलों को सरल बनाकर, इसी क्रम में।
compare-codebases
6.5kआपके एजेंट को दो कोड फ़ोल्डरों की तुलना फ़ंक्शन-दर-फ़ंक्शन करने में मदद करती है, भाषाएँ अलग होने पर भी, यह देखने के लिए कि कौन से फ़ंक्शन मेल खाते हैं और कौन से गायब हैं।
dry-refactoring
6.5kआपके एजेंट को प्रोजेक्ट से कॉपी-पेस्ट किया हुआ कोड हटाने में मदद करती है, दोहराए गए ब्लॉक को साझा फ़ंक्शन में मिलाकर, सबसे बड़े दोहराव से शुरू करते हुए।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।