gabriel / muse public
feat patch detect-refactor dev
AI Agent gabriel · 161 days ago · Apr 19, 2026 · Diff

feat(detect-refactor): supercharge for agent usability

- Add from typing import Any, TypedDict + from muse.core.timing import start_timer - Add _RefactorOutputJson TypedDict documenting all JSON envelope fields - Add -j alias for --json in register() - Add elapsed = start_timer() at top of run() - Add exit_code=0 and duration_ms=elapsed() to the JSON emit - Expand run() docstring with JSON envelope section (exit_code, duration_ms) - Add tests/test_detect_refactor_supercharge.py: 38 tests across 7 classes (TestJsonAlias, TestDurationMs, TestExitCode, TestTypedDicts, TestDocstrings, TestAnsiSanitization, TestPerformance)

sha256:0dc6504f25fe9216fb2e0425462cc87a63651776e915bf2020d96bff6c1e1a73 sha
+59 ~2 symbols
sha256:c265ff6879f8da499628c1f557300503f5b7e97c9182ed9e046d827760d832d0 snapshot
+59
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 61 symbols
+ TestAnsiSanitization class class TestAnsiSanitization L300–315
+ test_j_alias_output_no_ansi method method test_j_alias_output_no_ansi L307–309
+ test_json_output_no_ansi method method test_json_output_no_ansi L303–305
+ test_json_output_no_ansi_with_kind_filter method method test_json_output_no_ansi_with_kind_filter L311–315
+ TestDocstrings class class TestDocstrings L281–292
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L289–292
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L284–287
+ TestDurationMs class class TestDurationMs L162–191
+ test_duration_ms_with_kind_filter method method test_duration_ms_with_kind_filter L181–185
+ test_duration_ms_with_max_filter method method test_duration_ms_with_max_filter L187–191
+ test_j_alias_duration_ms_present method method test_j_alias_duration_ms_present L177–179
+ test_json_duration_ms_is_float method method test_json_duration_ms_is_float L173–175
+ test_json_duration_ms_nonnegative method method test_json_duration_ms_nonnegative L169–171
+ test_json_has_duration_ms method method test_json_has_duration_ms L165–167
+ TestExitCode class class TestExitCode L199–237
+ test_exit_code_mirrors_process_exit method method test_exit_code_mirrors_process_exit L219–221
+ test_exit_code_zero_with_from_to method method test_exit_code_zero_with_from_to L233–237
+ test_exit_code_zero_with_kind_filter method method test_exit_code_zero_with_kind_filter L223–226
+ test_exit_code_zero_with_max_filter method method test_exit_code_zero_with_max_filter L228–231
+ test_j_alias_exit_code_present method method test_j_alias_exit_code_present L215–217
+ test_json_exit_code_is_int method method test_json_exit_code_is_int L211–213
+ test_json_exit_code_zero method method test_json_exit_code_zero L206–209
+ test_json_has_exit_code method method test_json_has_exit_code L202–204
+ TestJsonAlias class class TestJsonAlias L103–154
+ test_j_alias_event_count_matches_json_flag method method test_j_alias_event_count_matches_json_flag L137–142
+ test_j_alias_exits_zero method method test_j_alias_exits_zero L106–108
+ test_j_alias_has_commits_scanned_key method method test_j_alias_has_commits_scanned_key L118–120
+ test_j_alias_has_events_key method method test_j_alias_has_events_key L114–116
+ test_j_alias_has_total_key method method test_j_alias_has_total_key L122–124
+ test_j_alias_same_top_level_keys_as_json_flag method method test_j_alias_same_top_level_keys_as_json_flag L126–135
+ test_j_alias_valid_json method method test_j_alias_valid_json L110–112
+ test_j_alias_with_kind_filter method method test_j_alias_with_kind_filter L144–149
+ test_j_alias_with_max_filter method method test_j_alias_with_max_filter L151–154
+ TestPerformance class class TestPerformance L323–336
+ test_duration_ms_is_float_not_int method method test_duration_ms_is_float_not_int L334–336
+ test_j_alias_duration_under_2000ms method method test_j_alias_duration_under_2000ms L330–332
+ test_json_duration_under_2000ms method method test_json_duration_under_2000ms L326–328
+ TestTypedDicts class class TestTypedDicts L245–273
+ test_has_duration_ms_annotation method method test_has_duration_ms_annotation L255–257
+ test_has_exit_code_annotation method method test_has_exit_code_annotation L251–253
+ test_refactor_output_json_typeddict_exists method method test_refactor_output_json_typeddict_exists L248–249
+ test_retains_commits_scanned_annotation method method test_retains_commits_scanned_annotation L267–269
+ test_retains_events_annotation method method test_retains_events_annotation L263–265
+ test_retains_schema_version_annotation method method test_retains_schema_version_annotation L259–261
+ test_retains_truncated_annotation method method test_retains_truncated_annotation L271–273
+ _env function function _env L39–40
+ _run function function _run L43–44
+ CliRunner import import CliRunner L29–29
+ annotations import import annotations L21–21
+ json import import json L23–23
+ pathlib import import pathlib L24–24
+ pytest import import pytest L27–27
+ textwrap import import textwrap L25–25
+ refactor_repo function function refactor_repo L53–95
+ runner variable variable runner L31–31
~ muse/cli/commands/detect_refactor.py .py 4 symbols added, 2 symbols modified
+ _RefactorOutputJson class class _RefactorOutputJson L124–148
+ Any import import Any L100–100
+ TypedDict import import TypedDict L100–100
+ start_timer import import start_timer L107–107
~ run
← Older Oldest on dev
All commits
Newer → Latest on dev

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:0dc6504f25fe9216fb2e0425462cc87a63651776e915bf2020d96bff6c1e1a73 --body "your comment"