@houkanshan/copydiff
v0.1.3
Published
`copydiff` is a Bun + TypeScript helper that augments `git diff` output with copy/clone awareness using `jscpd` while preserving Git's moved-line coloring.
Readme
copydiff
copydiff is a Bun + TypeScript helper that augments git diff output with copy/clone awareness using jscpd while preserving Git's moved-line coloring.
- Detect moved code (across files, using git color-moved)
- Detect similar code (across files, using
jscpd)
code from bluesky-social/social-app
Install
bun i -g @houkanshan/copydiffUsage
Filter mode:
copydiff abc123...efg456Generate HTML output:
copydiff base...head --html out.htmlHTML output includes syntax highlighting, diff-style background blocks, and copy highlights with expandable source details.
Wrapper mode:
Options
--stdinread diff from stdin.--html <path>write a light-mode HTML diff with copy highlights and expandable source details.--no-fold-puredisable folding for pure copies.--copy-color <spec>set copy highlight color using git color syntax (defaults tocolor.diff.newMoved).--no-copy-colordisable copy highlighting.--pure-threshold <0..1>similarity threshold for pure copies (default0.98).--min-fold-lines <n>minimum lines to fold (default12).--min-lines <n>minimum lines forjscpd(default8).--min-tokens <n>minimum tokens forjscpd(defaultmin-lines * 2).--ignore <glob,glob>ignored globs forjscpd.--cache <on|off>enable clone cache (defaulton).--verboselogjscpdoutput.--diff-config <force|respect>set git diff config mode for wrapper mode (defaultforce).--scan-scope <all|changed-types>scan the whole repo (all, default) or only files with extensions present in the diff (changed-types). Note:.gitignoreis always honored for clone scanning.
Exit codes
0success2invalid args3jscpdfailure
Local Development
bun install
bun link