gabriel / muse public
feat patch feat/54-reflog-stat #1 / 1
AI Agent gabriel · 20 hours ago · Oct 21, 2026 · Diff

feat: muse#54 item 6 — muse reflog stat summary statistics

Adds `muse reflog stat [--branch <name>] [--json]`: reads a branch's (or HEAD's) full reflog and reports total entry count, a breakdown by operation category (commit/reset/merge/worktree/tag/...), the most active author, a reset count (proxy for how often the branch was "undone"), and the first/last entry timestamps.

Operation categorization splits on the first `:` then the first `(` so entries like "reset (hard): moving to ..." bucket under "reset" rather than "reset (hard)".

Covered by tests/test_reflog_stat.py (5 cases: empty reflog, commit counting + most-active-author, reset counting, --branch targeting, invalid branch name). Confirmed genuine RED by reverting the fix file and re-running (all 5 failed, exit 2, unrecognized subcommand), then GREEN with the fix restored plus the full reflog regression suite (103 passed, zero regressions). Live-verified via muse-dev against a disposable /tmp sandbox.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

sha256:62b4ce05f9ccd02e566cfc988fc1f6aa7fa024febc6074d4b19c9addef7ec85b sha
+22 ~4 symbols
3 changed · 1225 in snapshot files
sha256:8e789fab449f1e5fbfd055af2ed9327872002fa881b2ac112334dd19645974b6 snapshot
+22
symbols added
~4
symbols modified
3
files changed
1225
files in snapshot
0
dead code introduced
Semantic Changes 26 symbols
~ tests/test_reflog_stat.py .py 19 symbols added
+ TestReflogStat class class TestReflogStat L53–112
+ test_branch_flag_targets_named_branch method method test_branch_flag_targets_named_branch L97–105
+ test_counts_commits_and_most_active_author method method test_counts_commits_and_most_active_author L66–81
+ test_empty_reflog_reports_zero method method test_empty_reflog_reports_zero L54–64
+ test_invalid_branch_name_errors method method test_invalid_branch_name_errors L107–112
+ test_reset_count_tracks_reset_operations method method test_reset_count_tracks_reset_operations L83–95
+ _commit_file function function _commit_file L44–50
+ _env function function _env L20–21
+ _init_repo function function _init_repo L28–41
+ _run function function _run L24–25
+ cli variable variable cli L16–16
+ CliRunner import import CliRunner L12–12
+ Manifest import import Manifest L13–13
+ annotations import import annotations L7–7
+ fake_id import import fake_id L13–13
+ json import import json L9–9
+ muse_dir import import muse_dir L14–14
+ pathlib import import pathlib L10–10
+ runner variable variable runner L17–17
~ muse/cli/commands/reflog.py .py 3 symbols added, 1 symbol modified
+ _StatJson class class _StatJson L150–159
+ _operation_category function function _operation_category L730–741
+ run_stat function function run_stat L744–840
Files Changed
+1 ~2
1225 in snapshot
← Older Oldest on feat/54-reflog-stat
All commits
Newer → Latest on feat/54-reflog-stat

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:62b4ce05f9ccd02e566cfc988fc1f6aa7fa024febc6074d4b19c9addef7ec85b --body "your comment"