gabriel / muse public
patch dev
AI Agent gabriel · 159 days ago · Apr 19, 2026 · Diff

supercharge(grep): -j alias, exit_code, duration_ms, TypedDict, docstring

- Add from typing import Any, TypedDict - Add from muse.core.timing import start_timer - Add _GrepOutputJson TypedDict with source_ref, working_tree, pattern, total_matches, results, exit_code, duration_ms annotations - Add -j alias for --json (mutually exclusive group preserved) - Add elapsed = start_timer() at top of run() - Emit exit_code=0 and duration_ms=elapsed() in JSON output - Expand run() docstring with JSON envelope section - Add 41-test supercharge suite covering all agent-usability gaps

sha256:fba9cdc0fc3fdb4612115eb9ef03e75a08ef59a34f405051aa841114d5c73218 sha
+62 ~2 symbols
sha256:ffbd4d881d2b85198c6c5b4de09c0af6bc9d758898e3f2df89c08ee43769d560 snapshot
+62
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 64 symbols
~ tests/test_grep_supercharge.py .py 58 symbols added
+ TestAnsiSanitization class class TestAnsiSanitization L313–326
+ test_j_alias_output_no_ansi method method test_j_alias_output_no_ansi L320–322
+ test_json_no_ansi_with_results method method test_json_no_ansi_with_results L324–326
+ test_json_output_no_ansi method method test_json_output_no_ansi L316–318
+ TestDocstrings class class TestDocstrings L294–305
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L302–305
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L297–300
+ TestDurationMs class class TestDurationMs L162–198
+ test_duration_ms_no_results method method test_duration_ms_no_results L181–186
+ test_duration_ms_with_kind_filter method method test_duration_ms_with_kind_filter L188–192
+ test_duration_ms_with_regex method method test_duration_ms_with_regex L194–198
+ 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 L206–246
+ test_exit_code_mirrors_process_exit method method test_exit_code_mirrors_process_exit L226–228
+ test_exit_code_zero_empty_results method method test_exit_code_zero_empty_results L230–236
+ test_exit_code_zero_with_kind_filter method method test_exit_code_zero_with_kind_filter L238–241
+ test_exit_code_zero_with_regex method method test_exit_code_zero_with_regex L243–246
+ test_j_alias_exit_code_present method method test_j_alias_exit_code_present L222–224
+ test_json_exit_code_is_int method method test_json_exit_code_is_int L218–220
+ test_json_exit_code_zero method method test_json_exit_code_zero L213–216
+ test_json_has_exit_code method method test_json_has_exit_code L209–211
+ TestJsonAlias class class TestJsonAlias L97–154
+ test_j_alias_exits_zero method method test_j_alias_exits_zero L100–102
+ test_j_alias_has_pattern_key method method test_j_alias_has_pattern_key L116–118
+ test_j_alias_has_results_key method method test_j_alias_has_results_key L108–110
+ test_j_alias_has_total_matches_key method method test_j_alias_has_total_matches_key L112–114
+ test_j_alias_match_count_matches_json_flag method method test_j_alias_match_count_matches_json_flag L131–136
+ test_j_alias_no_match_empty_results method method test_j_alias_no_match_empty_results L142–147
+ test_j_alias_pattern_echoed method method test_j_alias_pattern_echoed L138–140
+ test_j_alias_same_top_level_keys_as_json_flag method method test_j_alias_same_top_level_keys_as_json_flag L120–129
+ test_j_alias_valid_json method method test_j_alias_valid_json L104–106
+ test_j_alias_with_kind_filter method method test_j_alias_with_kind_filter L149–154
+ TestPerformance class class TestPerformance L334–347
+ test_duration_ms_is_float_not_int method method test_duration_ms_is_float_not_int L345–347
+ test_j_alias_duration_under_2000ms method method test_j_alias_duration_under_2000ms L341–343
+ test_json_duration_under_2000ms method method test_json_duration_under_2000ms L337–339
+ TestTypedDicts class class TestTypedDicts L254–286
+ test_grep_output_json_typeddict_exists method method test_grep_output_json_typeddict_exists L257–258
+ test_has_duration_ms_annotation method method test_has_duration_ms_annotation L264–266
+ test_has_exit_code_annotation method method test_has_exit_code_annotation L260–262
+ test_retains_pattern_annotation method method test_retains_pattern_annotation L276–278
+ test_retains_results_annotation method method test_retains_results_annotation L268–270
+ test_retains_source_ref_annotation method method test_retains_source_ref_annotation L280–282
+ test_retains_total_matches_annotation method method test_retains_total_matches_annotation L272–274
+ test_retains_working_tree_annotation method method test_retains_working_tree_annotation L284–286
+ _env function function _env L39–40
+ _run function function _run L43–44
+ grep_repo function function grep_repo L53–89
+ 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
+ runner variable variable runner L31–31
~ muse/cli/commands/grep.py .py 4 symbols added, 2 symbols modified
+ _GrepOutputJson class class _GrepOutputJson L91–114
+ Any import import Any L48–48
+ TypedDict import import TypedDict L48–48
+ start_timer import import start_timer L53–53
~ 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:fba9cdc0fc3fdb4612115eb9ef03e75a08ef59a34f405051aa841114d5c73218 --body "your comment"