Metadata-Version: 2.4
Name: docx-trackdiff
Version: 1.0.0
Summary: Compare two Word documents (.docx) and get a native Track Changes redline, with a self-verifying harness.
Author: Big Stephen
License: MIT
Project-URL: Homepage, https://github.com/stephenlzc/docx-trackdiff
Project-URL: Repository, https://github.com/stephenlzc/docx-trackdiff
Project-URL: Issues, https://github.com/stephenlzc/docx-trackdiff/issues
Keywords: docx,track-changes,redline,word-diff,document-comparison,ooxml
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing
Classifier: Topic :: Office/Business :: Office Suites
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: lxml>=4.6
Dynamic: license-file

# docx-trackdiff

**Compare two Word documents (.docx) and get a native Track Changes redline** — as if a human editor had revised the old draft into the new one with "Track Changes" switched on. One command in, one verified tracked-changes `.docx` out.

- ✍️ **A working document, not a report** — real `<w:ins>` / `<w:del>` revisions with unique IDs, author, and date; accept or reject each change individually in Word, WPS, or LibreOffice
- 🔍 **Word-level precision** — modified paragraphs get fine-grained inline diffs (`12%` → ~~12~~`18%`), not crude whole-paragraph replace
- 🖼️ **Lossless in both directions, images included** — a replaced figure keeps the old image's original bytes inside its deletion mark, so "reject change" truly restores the old picture
- ✅ **Every output machine-verified** — the bundled verifier runs 7 automated checks: simulated *accept all* must equal the new file, simulated *reject all* must equal the old file, plus structural checks
- 🪶 **Radically lightweight** — pure Python + `lxml`; no runtimes, no SDKs, no prebuilt binaries
- 🔒 **Private by default** — 100% local, no upload, no network call

## Install

```bash
pip install docx-trackdiff
```

## Usage

```bash
# 1. Generate the tracked-changes document
docx-trackdiff OLD.docx NEW.docx OUTPUT.docx --author "Your Name"

# 2. Verify (7 automated checks)
docx-trackdiff-verify OUTPUT.docx OLD.docx NEW.docx
```

Open `OUTPUT.docx` in Word → Review tab → **All Markup**. Accept or reject each change individually.

### Options

| Flag | Default | Meaning |
|---|---|---|
| `--author` | `Editor` | Revision author shown in Word's markup panel |
| `--date` | today | Revision timestamp |
| `--threshold` | `0.45` | Paragraph similarity cutoff: above → inline word-level diff; below → whole-paragraph delete+insert |

## Links

- GitHub: https://github.com/stephenlzc/docx-trackdiff
- Evaluation report: https://github.com/stephenlzc/docx-trackdiff/blob/main/EVALUATION.md

MIT licensed. Built with Kimi K3 Agent Swarm by Moonshot AI.
