> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fallow.tools/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating from jscpd

> Migrate from jscpd to fallow when you want duplication detection together with unused code, complexity, circular dependencies, and architecture boundaries.

Fallow can replace jscpd when you want duplication detection as part of a broader codebase audit. It also covers unused code detection, complexity analysis, circular dependencies, and architecture boundaries in the same binary.

## Migration workflow

<Steps>
  <Step title="Preview the migration">
    Run `fallow migrate --dry-run` to see the generated config without writing anything:

    ```bash theme={null}
    fallow migrate --dry-run
    ```

    Fallow searches for `.jscpd.json` and the `jscpd` field in `package.json`.
  </Step>

  <Step title="Generate the config">
    Once you're happy with the preview, run the migration:

    ```bash theme={null}
    fallow migrate            # Write .fallowrc.json
    fallow migrate --toml     # Or output as fallow.toml
    ```
  </Step>

  <Step title="Review the config">
    Open the generated config and verify the translated thresholds, token counts, and ignore patterns.
  </Step>

  <Step title="Run fallow dupes">
    Run your first duplication analysis:

    ```bash theme={null}
    fallow dupes
    ```
  </Step>
</Steps>

<Tip>
  The default `mild` mode normalizes syntax variations and may flag more clones than jscpd did. For results closest to jscpd's exact token matching, use `--mode strict`.
</Tip>

## What gets migrated

| jscpd       | fallow                             |
| :---------- | :--------------------------------- |
| `threshold` | `duplicates.threshold`             |
| `minTokens` | `duplicates.minTokens`             |
| `minLines`  | `duplicates.minLines`              |
| `ignore`    | `ignorePatterns`                   |
| `format`    | -- (fallow auto-detects languages) |

## Comparison

|                              | fallow                            | jscpd                                                       |
| :--------------------------- | :-------------------------------- | :---------------------------------------------------------- |
| Raw duplication speed        | Part of the broader audit flow    | jscpd v5 is faster on the current README benchmark fixtures |
| Detection modes              | 4 (strict, mild, weak, semantic)  | 3 (strict, mild, weak)                                      |
| Algorithm                    | Suffix array with LCP             | Rust rewrite in v5                                          |
| Unused code + circular deps  | Built-in (`fallow dead-code`)     | Not included                                                |
| Complexity + maintainability | Built-in (`fallow health`)        | Not included                                                |
| Clone families               | Yes, with refactoring suggestions | No                                                          |
| Cross-language               | TS to JS type stripping           | Format-based                                                |
| Baseline tracking            | Yes                               | No                                                          |
| Runtime dependency           | Native binary                     | Native binary in v5                                         |

## Detection mode mapping

jscpd v5 supports `strict`, `mild`, and `weak` modes. The closest fallow equivalent for exact token matching is `strict`.

Fallow defaults to `mild` mode, which normalizes syntax variations and may flag more clones than jscpd did. To match jscpd's behavior more closely, use `strict` mode:

```bash theme={null}
fallow dupes --mode strict
```

For broader matching that catches renamed variables:

```bash theme={null}
fallow dupes --mode semantic
```

## One tool for the full picture

<Check>
  Fallow covers unused code, duplication, complexity hotspots, circular dependencies, and architecture boundaries in a single binary. It can replace separate jscpd, knip, and madge workflows when you want one combined audit.
</Check>

```bash theme={null}
fallow dead-code    # Unused code + circular deps + boundaries
fallow dupes        # Code duplication (replaces jscpd)
fallow health       # Complexity hotspots + maintainability scores
fallow              # All of the above in one pass
```

## See also

<CardGroup cols={2}>
  <Card title="Duplication analysis" icon="clone" href="/analysis/duplication">
    Deep dive into fallow's duplication detection engine.
  </Card>

  <Card title="fallow dupes" icon="terminal" href="/cli/dupes">
    Full CLI reference for the dupes command.
  </Card>
</CardGroup>
