Compare two folders function by function
compare_foldersPairs functions across two folders using an embedding model to identify matching implementations and list unmatched code, returning a JSON report for porting or cross-platform comparison.
Instructions
Compare two folders function by function, in one language or across languages: a port and its original (the source first, the target second), or two implementations of one app (iOS and Android). Every function of one folder is paired with the function of the other that does the same job, by the embedding model, and what has no counterpart is listed. Returns the JSON report of jscpd --compare: 'code' and 'tests' sections, each with 'sides' (per folder: 'functions', 'matched', 'percentage', 'files', 'unmatched', 'readyToPort': unported functions whose callees are all ported) and 'pairs' (each with both functions, 'similarity', 'level' high/medium/low, 'renamed' and 'matchedBy' code or name). Read a few low pairs and the pairs matched by name before relying on them. Needs the embedding model; the first comparison of two folders embeds every function and can take minutes, later ones reuse the cached vectors.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| left | Yes | The first folder (or file): the source of a port, or one of two implementations. It must lie inside the scanned folders: give it relative to one of them, or absolute. | |
| limit | No | Maximum number of entries of each list ('pairs', 'unmatched', 'readyToPort', 'files') in the response. 'functions' always carries the full count, so a small limit still tells you how much was found. | |
| right | Yes | The second folder (or file): the target of a port, or the other implementation. It must lie inside the scanned folders too, and must not contain the first or lie inside it. |