gabriel / muse public
feat patch code api-surface dev
AI Agent gabriel · 161 days ago · Apr 19, 2026 · Diff

feat(code api-surface): supercharge for agents — -j alias, exit_code, duration_ms, envelope TypedDicts

- Add `-j` as shorthand alias for `--json` (store_true, dest=as_json) - Import start_timer and Callable; add elapsed = start_timer() in run() - Pass elapsed callable to _run_list_mode and _run_diff_mode - Emit exit_code=0 and duration_ms=elapsed() on both JSON paths: list mode and diff mode - Add _ListJson, _DiffJson TypedDicts for type-safe envelope construction - Update run() docstring to document exit_code and duration_ms fields - Add tests/test_api_surface_supercharge.py (45 tests across 7 classes): TestJsonAlias, TestDurationMs, TestExitCode, TestTypedDicts, TestDocstrings, TestSchema, TestAnsiSanitization, TestPerformance

sha256:e06fe5842705a76395766a71380dd07e4ef6ad5baf10bfbe157bd3ea868744ea sha
+72 ~6 symbols
sha256:d732eaca062926c993d0a50e4ac7984475cde2d9f53cc8cc3e38f4ed6833ab4f snapshot
+72
symbols added
~6
symbols modified
0
dead code introduced
Semantic Changes 78 symbols
~ tests/test_api_surface_supercharge.py .py 68 symbols added
+ TestAnsiSanitization class class TestAnsiSanitization L401–417
+ test_diff_json_no_ansi_in_output method method test_diff_json_no_ansi_in_output L408–411
+ test_list_json_addresses_no_ansi method method test_list_json_addresses_no_ansi L413–417
+ test_list_json_no_ansi_in_output method method test_list_json_no_ansi_in_output L404–406
+ TestDocstrings class class TestDocstrings L316–327
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L324–327
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L319–322
+ TestDurationMs class class TestDurationMs L168–207
+ test_diff_json_duration_ms_is_float method method test_diff_json_duration_ms_is_float L198–202
+ test_diff_json_duration_ms_nonnegative method method test_diff_json_duration_ms_nonnegative L192–196
+ test_diff_json_has_duration_ms method method test_diff_json_has_duration_ms L186–190
+ test_j_alias_duration_ms_present method method test_j_alias_duration_ms_present L204–207
+ test_list_json_duration_ms_is_float method method test_list_json_duration_ms_is_float L181–184
+ test_list_json_duration_ms_nonnegative method method test_list_json_duration_ms_nonnegative L176–179
+ test_list_json_has_duration_ms method method test_list_json_has_duration_ms L171–174
+ TestExitCode class class TestExitCode L215–262
+ test_diff_json_exit_code_is_int method method test_diff_json_exit_code_is_int L248–252
+ test_diff_json_exit_code_zero_on_success method method test_diff_json_exit_code_zero_on_success L240–246
+ test_diff_json_has_exit_code method method test_diff_json_has_exit_code L234–238
+ test_j_alias_exit_code_present method method test_j_alias_exit_code_present L259–262
+ test_list_exit_code_mirrors_process_exit method method test_list_exit_code_mirrors_process_exit L254–257
+ test_list_json_exit_code_is_int method method test_list_json_exit_code_is_int L229–232
+ test_list_json_exit_code_zero_on_success method method test_list_json_exit_code_zero_on_success L223–227
+ test_list_json_has_exit_code method method test_list_json_has_exit_code L218–221
+ TestJsonAlias class class TestJsonAlias L115–160
+ test_j_alias_diff_mode_exits_zero method method test_j_alias_diff_mode_exits_zero L132–136
+ test_j_alias_diff_mode_valid_json method method test_j_alias_diff_mode_valid_json L138–141
+ test_j_alias_diff_same_keys_as_json_flag method method test_j_alias_diff_same_keys_as_json_flag L152–160
+ test_j_alias_list_mode_exits_zero method method test_j_alias_list_mode_exits_zero L118–120
+ test_j_alias_list_mode_has_results_key method method test_j_alias_list_mode_has_results_key L127–130
+ test_j_alias_list_mode_valid_json method method test_j_alias_list_mode_valid_json L122–125
+ test_j_alias_list_same_keys_as_json_flag method method test_j_alias_list_same_keys_as_json_flag L143–150
+ TestPerformance class class TestPerformance L425–442
+ test_diff_json_duration_under_1000ms method method test_diff_json_duration_under_1000ms L433–437
+ test_duration_ms_is_float_not_int method method test_duration_ms_is_float_not_int L439–442
+ test_list_json_duration_under_1000ms method method test_list_json_duration_under_1000ms L428–431
+ TestSchema class class TestSchema L335–393
+ test_diff_json_added_is_list method method test_diff_json_added_is_list L357–361
+ test_diff_json_breaking_count_is_int method method test_diff_json_breaking_count_is_int L350–355
+ test_diff_json_changed_entries_have_breaking_flag method method test_diff_json_changed_entries_have_breaking_flag L375–381
+ test_diff_json_changed_is_list method method test_diff_json_changed_is_list L369–373
+ test_diff_json_removed_is_list method method test_diff_json_removed_is_list L363–367
+ test_diff_json_semver_impact_valid method method test_diff_json_semver_impact_valid L338–342
+ test_diff_json_stability_pct_in_range method method test_diff_json_stability_pct_in_range L344–348
+ test_list_json_results_have_address_and_kind method method test_list_json_results_have_address_and_kind L388–393
+ test_list_json_total_matches_results_len method method test_list_json_total_matches_results_len L383–386
+ TestTypedDicts class class TestTypedDicts L270–308
+ test_diff_json_has_breaking_count_annotation method method test_diff_json_has_breaking_count_annotation L303–305
+ test_diff_json_has_duration_ms_annotation method method test_diff_json_has_duration_ms_annotation L295–297
+ test_diff_json_has_exit_code_annotation method method test_diff_json_has_exit_code_annotation L291–293
+ test_diff_json_has_semver_impact_annotation method method test_diff_json_has_semver_impact_annotation L299–301
+ test_diff_json_typed_dict_exists method method test_diff_json_typed_dict_exists L288–289
+ test_list_json_has_duration_ms_annotation method method test_list_json_has_duration_ms_annotation L280–282
+ test_list_json_has_exit_code_annotation method method test_list_json_has_exit_code_annotation L276–278
+ test_list_json_has_results_annotation method method test_list_json_has_results_annotation L284–286
+ test_list_json_typed_dict_exists method method test_list_json_typed_dict_exists L273–274
+ test_public_symbol_dict_exists method method test_public_symbol_dict_exists L307–308
+ _commit_ids function function _commit_ids L41–46
+ _env function function _env L33–34
+ _run function function _run L37–38
+ api_repo function function api_repo L55–107
+ CliRunner import import CliRunner L23–23
+ annotations import import annotations L15–15
+ json import import json L17–17
+ pathlib import import pathlib L18–18
+ pytest import import pytest L21–21
+ textwrap import import textwrap L19–19
+ runner variable variable runner L25–25
~ muse/cli/commands/api_surface.py .py 4 symbols added, 6 symbols modified
+ _DiffJson class class _DiffJson L131–145
+ _ListJson class class _ListJson L119–128
+ Callable import import Callable L82–82
+ start_timer import import start_timer L95–95
~ 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:e06fe5842705a76395766a71380dd07e4ef6ad5baf10bfbe157bd3ea868744ea --body "your comment"