๐ฟ appendlog v1.0.0 ยท MIT
Append timestamped entries under a stable marker in long shared files โ append-only, dedupe, zero dependencies.
The problem
Long shared files (plans, journals, state docs) edited by multiple actors break targeted edits: prose anchors get duplicated ("found 6 occurrences"), drift ("text not found"), and one bad edit can rewrite history. The fix is to make those files append-only: never touch existing content โ only insert a new entry right after a stable marker comment such as <!-- LOG -->.
Guarantees
- Append-only โ existing lines are never modified or reordered; a single line is inserted after the first marker occurrence.
- Dedupe โ an identical entry already present โ no-op (exit 0), not a second entry.
- Marker missing โ clear error (exit 1), file untouched.
- Atomic-ish write โ temp file +
os.replace. - Custom
--templateand--stamp-format,--json,--dry-run, reproducible--nowfor tests. - Zero dependencies, Python โฅ 3.9.
Install (pip)
pip install appendlog @ git+https://mandrilly.com/git/appendlog.git
Usage
# insert "- **๐๏ธ 22/09 01:30 โ done thing**" after <!-- LOG --> in plan.md
appendlog plan.md "done thing"
# custom marker / template / stamp
appendlog state.md "check ran clean" --marker '<!-- AUDIT -->' \
--template '* [{stamp}] {text}' --stamp-format '%Y-%m-%d %H:%M'
appendlog plan.md "hello" --dry-run
appendlog plan.md "hello" --json
Python API: from appendlog.core import append_entry.
Exit codes
| Code | Meaning |
|---|---|
0 | inserted, duplicate (no-op), or dry-run |
1 | error (file missing, marker missing, empty text) |
2 | usage / invalid --now |
Tests
python -m unittest tests -v # 9 tests