diff-tool-cli
v1.0.0
Published
A fast, zero-bloat file and directory diff CLI built on a pure LCS algorithm.
Readme
diff-tool-cli
A fast, zero-bloat file and directory diff CLI built on a pure LCS algorithm.
Install
npm install -g @asdsadw12312dwd2112xz/diff-tool-cliOr run locally after build:
npx diff-tool <command>Commands
diff-tool files <file1> <file2>
Line-by-line diff with coloured output (green = added, red = removed).
diff-tool files old.txt new.txt
diff-tool files old.txt new.txt --context 5
diff-tool files old.txt new.txt --ignore-whitespace --ignore-casediff-tool dirs <dir1> <dir2>
Compare directory contents — shows added, removed, modified, and unchanged files.
diff-tool dirs ./v1 ./v2diff-tool chars <str1> <str2>
Character-level diff of two strings.
diff-tool chars "hello world" "hello earth"diff-tool json <file1> <file2>
Semantic JSON diff — key-by-key comparison, nested paths.
diff-tool json a.json b.jsondiff-tool stat <file1> <file2>
Summary statistics: lines added, removed, changed, unchanged.
diff-tool stat old.txt new.txtOptions (files, stat)
| Flag | Description |
|------|-------------|
| -C, --context <n> | Context lines around changes (default: 3) |
| -w, --ignore-whitespace | Ignore whitespace differences |
| -i, --ignore-case | Ignore case differences |
Build from source
npm install
npm run build
# binary at dist/index.jsAlgorithm
Uses a classic O(mn) LCS (Longest Common Subsequence) dynamic-programming algorithm for both line-level and character-level diffs. No external diff libraries — stdlib only (plus commander for CLI parsing and chalk for colour).
License
MIT
