gabriel / muse public
feat patch for-each-ref task/supercharge-for-each-ref #1 / 1
AI Agent gabriel · 140 days ago · Apr 17, 2026 · Diff

feat(for-each-ref): add elapsed_seconds, exit_code, current_branch to JSON output

All JSON output now carries the agent-output contract fields: - elapsed_seconds: round(monotonic, 6) — timing visible on every call - exit_code: 0 on all success paths - current_branch: HEAD branch name — agents know active branch without a separate muse status call

_ForEachRefResult TypedDict updated to declare all three new fields. Module docstring updated with sha256: prefix notation and new fields. read_current_branch imported from muse.core.store.

34 hardening tests: elapsed_seconds (8), exit_code (5), current_branch (6), compact JSON (3), sha256: prefix (4), data integrity (5), performance (3).

sha256:2165fa973571e622f87eb27fb1fd86fa46a1782792ad4e21509556e41f83cc95 sha
+62 ~3 symbols
sha256:d911b6c36011c728d4587bc368e9802517d761a1436a6e37cc4cf18a2b6a9f3a snapshot
+62
symbols added
~3
symbols modified
0
dead code introduced
Semantic Changes 65 symbols
+ TestCompactJson class class TestCompactJson L197–213
+ test_empty_repo_is_single_line method method test_empty_repo_is_single_line L210–213
+ test_no_commits_is_single_line method method test_no_commits_is_single_line L204–208
+ test_output_is_single_line method method test_output_is_single_line L198–202
+ TestCurrentBranch class class TestCurrentBranch L161–190
+ test_feature_branch_reflected method method test_feature_branch_reflected L187–190
+ test_main_by_default method method test_main_by_default L172–175
+ test_matches_head_branch method method test_matches_head_branch L167–170
+ test_present_in_output method method test_present_in_output L162–165
+ test_present_on_empty_repo method method test_present_on_empty_repo L182–185
+ test_present_with_no_commits_flag method method test_present_with_no_commits_flag L177–180
+ TestDataIntegrity class class TestDataIntegrity L251–290
+ test_all_refs_have_branch_and_ref_fields method method test_all_refs_have_branch_and_ref_fields L274–282
+ test_committed_at_is_iso8601 method method test_committed_at_is_iso8601 L284–290
+ test_count_equals_len_refs method method test_count_equals_len_refs L252–257
+ test_count_equals_len_refs_after_count_limit method method test_count_equals_len_refs_after_count_limit L266–272
+ test_count_equals_len_refs_after_pattern method method test_count_equals_len_refs_after_pattern L259–264
+ TestElapsedSeconds class class TestElapsedSeconds L83–124
+ test_is_float method method test_is_float L98–101
+ test_non_negative method method test_non_negative L103–106
+ test_present_in_full_output method method test_present_in_full_output L84–87
+ test_present_on_empty_repo method method test_present_on_empty_repo L94–96
+ test_present_with_count_limit method method test_present_with_count_limit L120–124
+ test_present_with_no_commits method method test_present_with_no_commits L89–92
+ test_present_with_pattern_filter method method test_present_with_pattern_filter L114–118
+ test_six_decimal_places method method test_six_decimal_places L108–112
+ TestExitCode class class TestExitCode L131–154
+ test_is_int_not_bool method method test_is_int_not_bool L151–154
+ test_present_in_full_output method method test_present_in_full_output L132–135
+ test_zero_on_empty_repo method method test_zero_on_empty_repo L142–144
+ test_zero_on_success method method test_zero_on_success L137–140
+ test_zero_with_no_commits method method test_zero_with_no_commits L146–149
+ TestPerformance class class TestPerformance L297–321
+ test_100_branch_repo_under_5s method method test_100_branch_repo_under_5s L303–311
+ test_elapsed_seconds_plausible method method test_elapsed_seconds_plausible L298–301
+ test_no_commits_faster_than_full method method test_no_commits_faster_than_full L313–321
+ TestSha256Prefix class class TestSha256Prefix L220–244
+ test_commit_id_full_length method method test_commit_id_full_length L227–232
+ test_commit_id_has_sha256_prefix method method test_commit_id_has_sha256_prefix L221–225
+ test_no_commits_commit_id_has_sha256_prefix method method test_no_commits_commit_id_has_sha256_prefix L240–244
+ test_snapshot_id_has_sha256_prefix method method test_snapshot_id_has_sha256_prefix L234–238
+ _commit function function _commit L46–67
+ _fer function function _fer L70–72
+ _init_repo function function _init_repo L35–43
+ _json function function _json L75–76
+ CliRunner import import CliRunner L24–24
+ CommitRecord import import CommitRecord L26–26
+ InvokeResult import import InvokeResult L24–24
+ SnapshotRecord import import SnapshotRecord L26–26
+ annotations import import annotations L15–15
+ compute_commit_id import import compute_commit_id L25–25
+ compute_snapshot_id import import compute_snapshot_id L25–25
+ datetime import import datetime L17–17
+ json import import json L18–18
+ pathlib import import pathlib L19–19
+ pytest import import pytest L22–22
+ time import import time L20–20
+ write_commit import import write_commit L26–26
+ write_snapshot import import write_snapshot L26–26
+ runner variable variable runner L28–28
~ muse/cli/commands/for_each_ref.py .py 2 symbols added, 3 symbols modified
+ read_current_branch import import read_current_branch L94–94
+ time import import time L89–89
~ run
← Older Oldest on task/supercharge-for-each-ref
All commits
Newer → Latest on task/supercharge-for-each-ref

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:2165fa973571e622f87eb27fb1fd86fa46a1782792ad4e21509556e41f83cc95 --body "your comment"