A command-line tool for patching, auditing, and managing LevelDB content, designed for the RestoredCDC project.
✅ Supports add, replace, and remove operations
✅ Handles both text and binary content
✅ Automatic audit logging (JSON Lines)
✅ Exports audit log as a simple HTML report
✅ Tracks MD5 checksums for every patch
✅ Patch reason and optional MIME type tracking
✅ Includes unit tests via pytest
| Package | Purpose |
|---|---|
plyvel |
LevelDB bindings |
pytest |
Testing |
flake8 |
Linting |
black |
Code formatting |
isort |
Import sorting |
flask + waitress |
Optional: serve patched content |
pip install -r requirements.txtOr manually:
pip install plyvel flask waitress pytest flake8 black isortpython cli.py apply-text --db path/to/patchdb --key mykey \
--reason "Updated disclaimer text" --file disclaimer.txt \
--mimetype text/plainpython cli.py add-binary --db path/to/patchdb --key logo \
--reason "Updated logo" --file logo.png \
--mimetype image/pngpython cli.py remove-patch --db path/to/patchdb --key oldfile --reason "Obsolete"python cli.py list-patchespython cli.py export-audit-html --output audit.htmlpytest tests/flake8
black patchlib.py cli.py tests/
isort patchlib.py cli.py tests/- The default audit log is located at
audit/patch_log.jsonl. remove-patchautomatically detects whether the content is text or binary.- This tool is meant to manage content patches, not full database snapshots.
- For serving content from patched databases, see
serve.py.
If you're using this tool in production:
- Consider setting up a
Makefile - Enable
pre-commithooks for linting - Auto-export audits during CI/CD