मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग6.5k · #14189

compare-codebases

यह क्या करती है

यह बताती है कि दो कोडबेस के फ़ंक्शन कैसे जोड़ें और हर एक में क्या है जो दूसरे में नहीं है, यह रिपोर्ट करें। यह उन डेवलपर्स के लिए है जो दो प्रोजेक्ट के संबंध जाँचते हैं या देखते हैं कि कोई पोर्ट कहाँ तक पहुँचा है।

कब इस्तेमाल करें

  • ✓जब टीम जानना चाहे कि ऐप के एक वर्शन में ऐसे कौन से फ़ंक्शन हैं जो दूसरे में नहीं हैं।
  • ✓जब डेवलपर जाँचना चाहे कि ऐप के iOS और Android वर्शन मेल खाते हैं या नहीं।
  • ✓जब डेवलपर को एक फ़ोल्डर के फ़ंक्शन का दूसरे फ़ोल्डर में समकक्ष ढूँढना हो।

Skill का लिंक

https://github.com/kucherenko/jscpd/blob/master/skills/compare-codebases/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/kucherenko/jscpd/blob/master/skills/compare-codebases/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“हमारे iOS और Android कोड फ़ोल्डरों की तुलना कीजिए और बताइए कि Android ऐप में कौन से फ़ंक्शन गायब हैं।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह स्किल एक तुलना चलाती है जो फ़ंक्शन को उनके नाम से नहीं, बल्कि उनके काम से मिलाती है। फिर मिले और न मिले फ़ंक्शन सरल शब्दों में समझाए जाते हैं।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

compare-codebases

jscpd --compare A B pairs every function of folder A with the function of folder B that does the same job, and lists the functions of each folder that have no counterpart. The two folders may be in one language or in two (Python and TypeScript, Kotlin and Swift, Java and Rust). This skill explains how the comparison works and how to run one well. For porting code with the comparison as the progress measure, use the code-migration skill; for the rest of jscpd, the jscpd skill.

How the comparison works

jscpd finds the functions of JavaScript, TypeScript, JSX, TSX, Vue, Svelte, Astro, Python, Rust, Go, Java, Kotlin, C#, C, C++, PHP, Ruby, Scala and Swift files in both folders. It turns the code of each function into a vector with a code embedding model that runs inside jscpd (CodeRankEmbed by default), so two functions that do the same job point the same way even when their languages, names and structure differ. Functions of one folder are never compared with each other.

Functions pair in two steps:

  1. By code. Two functions pair when each is the other's closest match in the other folder, their cosine similarity reaches the model's threshold (0.4125 across languages and 0.6375 within one language, with CodeRankEmbed), and the similarity stands out from the function's other matches. A function close to the best one also pairs when it reaches a higher bar, so a feature written twice on one side gets two pairs. A pair stays only when it is the best match of at least one of its two functions, so a lookalike from another class does not join a function and its counterpart; a tie goes to the file of the same name. Functions shorter than --min-tokens (30 with --compare) or --min-lines (5) stay out of this step, because a short function resembles too many others.
  2. By name. A function left over pairs with a function of the other folder under the same name, once case, underscores, spaces and punctuation are ignored (encodeBinary, encode_binary, _encode_binary; the test title rounds cents and rounds_cents), when their similarity reaches the medium level (0.5625 across languages with CodeRankEmbed). A name pair skips the closest-match and stand-out checks of the first step, so it needs more than that step's threshold; otherwise every load and init of two codebases would pair. Size does not matter here, so a short port is found. A name pair has to stay within modules the first step linked. A module is the folder right under the deepest folder all files of a side share (notification in android/notification/…), and a file that sits higher than the rest, such as a build script, does not move that folder up. Two modules link when one holds the most of the other's pairs, counted for code and for tests separately. So checkPermissions of one plugin does not pair with its namesake in another.

Each pair gets a level on the scale of the model, because a cosine that is high for one model is low for another:

Level With CodeRankEmbed, across languages Meaning
high 0.7125 and up almost always the same function
medium 0.5625 to 0.7125 usually the same function, restructured
low 0.4125 to 0.5625 read both: related code pairs here too

jscpd measures tests and code apart, in two blocks of the report, and pairs a test only with a test. It tells a test by the conventions of its language:

  • a test file such as *_test.go, test_*.py, *.test.ts, *.spec.js, *Tests.swift or *_spec.rb;
  • a test folder such as tests/, __tests__/, spec/, src/test/ (where Java, Kotlin and Scala keep their tests), MyAppTests/ or MyApp.Tests.Integration/, the compared folder's own name included;
  • a Rust function in a #[cfg(test)] module or under #[test];
  • a JavaScript or TypeScript test case such as it('rounds cents', () => …).

When neither side has a test that counts (see below), the report has one block and no headings.

Totals count the functions of at least --min-tokens tokens and --min-lines lines; smaller ones appear only as partners. Declarations without a body (TypeScript overloads, the functions of a .d.ts file, interface and abstract methods) take no part. Anonymous functions (callbacks, closures) take no part either, except JavaScript and TypeScript test cases. A test case such as it('rounds cents', () => …) goes by its title, and so do those written with test,

अक्सर पूछे जाने वाले सवाल

क्या एक ही भाषा ज़रूरी है?

नहीं। दोनों फ़ोल्डर अलग भाषाओं में हो सकते हैं, जैसे Python और TypeScript।

क्या यह फ़ंक्शन को नाम से मिलाती है?

नहीं। यह एक कोड embedding मॉडल का इस्तेमाल करके फ़ंक्शन को उनके काम से मिलाती है।

क्या यह एक ही फ़ोल्डर के अंदर के फ़ंक्शन तुलना करती है?

नहीं। यह केवल दो फ़ोल्डरों के बीच फ़ंक्शन की तुलना करती है।

जानकारी

लेखक का मूल विवरण

Compare two folders function by function with jscpd --compare, in the same language or across languages, and explain the result. Use when asked how two codebases relate, which functions one implementation has and the other lacks, how far a port has come, whether the iOS and Android versions of an app match, or which function in one folder corresponds to a function in the other.

repo: kucherenko/jscpd

लोकप्रियता

GitHub स्टार
6.5k
रैंकिंग में स्थान
#14189
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

code-migration

6.5k

आपके एजेंट को एक भाषा या फ़्रेमवर्क से दूसरे में कोड एक-एक फ़ंक्शन करके ले जाने में मदद करती है, पहले टेस्ट के साथ और मूल से तुलना करके प्रगति मापते हुए।

कोडिंगसामान्य कोडिंग

codebase-refactoring

6.5k

आपके एजेंट को किसी कोडबेस की सेहत सुधारने में मदद करती है: दोहराया कोड ठीक करके, बेकार कोड हटाकर और सबसे जटिल फ़ाइलों को सरल बनाकर, इसी क्रम में।

कोडिंगसामान्य कोडिंग

dry-refactoring

6.5k

आपके एजेंट को प्रोजेक्ट से कॉपी-पेस्ट किया हुआ कोड हटाने में मदद करती है, दोहराए गए ब्लॉक को साझा फ़ंक्शन में मिलाकर, सबसे बड़े दोहराव से शुरू करते हुए।

कोडिंगसामान्य कोडिंग

jscpd

6.5k

आपके एजेंट को प्रोजेक्ट में सटीक, नाम बदले हुए या लगभग-नकल वाले कॉपी-पेस्ट कोड खोजने में मदद करती है, और यह मापने में कि कितना कोड दोहराया गया है।

कोडिंगसामान्य कोडिंग

मिलती-जुलती skills