feat: muse#54 item 10 — muse reflog watch live-tail
Adds `muse reflog watch [--branch <name>] [--once] [--timeout SECONDS] [--max-events N] [--poll-interval SECONDS] [--json]`: streams reflog events as NDJSON, mirroring `muse coord watch`'s conventions (snapshot + incremental events, SIGTERM -> clean exit, --once for a deterministic one-shot read).
On start, emits a "snapshot" event for every pre-existing entry (oldest first), then polls the log file at --poll-interval and emits an "appended" event for each newly written entry, until --timeout or --max-events is reached or the process is interrupted (SIGINT/SIGTERM both exit cleanly, matching `muse coord watch`). --once prints just the snapshot and exits immediately — useful for scripting a deterministic baseline read without waiting on real-time activity.
@{N} index fields on emitted events reflect the log's state at the moment of emission (0 = newest), the same convention `muse reflog --json` already uses.
Covered by tests/test_reflog_watch.py (7 cases: snapshot-only via --once with correct chronological ordering and indices, empty reflog, --branch targeting, invalid branch name, invalid --poll-interval, --max-events capping the snapshot, and a real appended-event detected mid-poll via a monkeypatched time.sleep that writes a new raw reflog line on its first call). Confirmed genuine RED by reverting the fix file and re-running (all 7 failed, exit 2, unrecognized subcommand), then GREEN with the fix restored plus the full reflog regression suite (127 passed, zero regressions). Live-verified via muse-dev: --once against a disposable /tmp sandbox, plus a real background `reflog watch --timeout 5` process that correctly detected and emitted a commit made by a separate `muse-dev commit` call while it was running.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Semantic Changes
36 symbols
Files Changed
+1
~2
1229 in snapshot
0 comments
muse hub commit comment sha256:799dc6f15b7dba389fdf5f088cd5e210da5fb66ec4b1ec9db7b16cde0e8fe734 --body "your comment"
No comments yet. Be the first to start the discussion.