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

feat(contract): supercharge for agent usability

- Add -j alias for --json - Add exit_code (always 0) and duration_ms (non-negative float) to JSON output - Extend _ContractJson TypedDict with exit_code and duration_ms annotations - Update run() docstring with JSON envelope section - Add start_timer() for wall-clock measurement - 35 new TDD tests in test_contract_supercharge.py covering alias, duration_ms, exit_code, TypedDict, docstrings, ANSI sanitization, and performance

sha256:30caff41aacdede679b88f0a6710d5f7a92c6b829c51a466d9d3ce6ed361ce25 sha
+55 ~3 symbols
sha256:cbb46e24eb776343ff52159d60b1553c3f3ffb64b20894da7d35138bbf43b4a1 snapshot
+55
symbols added
~3
symbols modified
0
dead code introduced
Semantic Changes 58 symbols
~ tests/test_contract_supercharge.py .py 54 symbols added
+ TestAnsiSanitization class class TestAnsiSanitization L343–361
+ test_j_alias_output_no_ansi method method test_j_alias_output_no_ansi L350–352
+ test_json_output_no_ansi method method test_json_output_no_ansi L346–348
+ test_json_output_no_ansi_with_max_commits method method test_json_output_no_ansi_with_max_commits L354–361
+ TestDocstrings class class TestDocstrings L324–335
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L332–335
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L327–330
+ TestDurationMs class class TestDurationMs L208–238
+ test_duration_ms_not_zero_for_real_work method method test_duration_ms_not_zero_for_real_work L234–238
+ test_duration_ms_with_max_commits_1 method method test_duration_ms_with_max_commits_1 L227–232
+ test_j_alias_duration_ms_present method method test_j_alias_duration_ms_present L223–225
+ test_json_duration_ms_is_float method method test_json_duration_ms_is_float L219–221
+ test_json_duration_ms_nonnegative method method test_json_duration_ms_nonnegative L215–217
+ test_json_has_duration_ms method method test_json_has_duration_ms L211–213
+ TestExitCode class class TestExitCode L246–280
+ test_exit_code_mirrors_process_exit method method test_exit_code_mirrors_process_exit L266–268
+ test_exit_code_not_present_in_error_path method method test_exit_code_not_present_in_error_path L275–280
+ test_exit_code_zero_with_max_commits method method test_exit_code_zero_with_max_commits L270–273
+ test_j_alias_exit_code_present method method test_j_alias_exit_code_present L262–264
+ test_json_exit_code_is_int method method test_json_exit_code_is_int L258–260
+ test_json_exit_code_zero method method test_json_exit_code_zero L253–256
+ test_json_has_exit_code method method test_json_has_exit_code L249–251
+ TestJsonAlias class class TestJsonAlias L163–200
+ test_j_alias_address_matches method method test_j_alias_address_matches L194–196
+ test_j_alias_exits_zero method method test_j_alias_exits_zero L166–168
+ test_j_alias_has_address_key method method test_j_alias_has_address_key L174–176
+ test_j_alias_has_history_key method method test_j_alias_has_history_key L198–200
+ test_j_alias_has_ops_key method method test_j_alias_has_ops_key L178–181
+ test_j_alias_same_top_level_keys_as_json_flag method method test_j_alias_same_top_level_keys_as_json_flag L183–192
+ test_j_alias_valid_json method method test_j_alias_valid_json L170–172
+ TestPerformance class class TestPerformance L369–382
+ test_duration_ms_is_float_not_int method method test_duration_ms_is_float_not_int L380–382
+ test_j_alias_duration_under_2000ms method method test_j_alias_duration_under_2000ms L376–378
+ test_json_duration_under_2000ms method method test_json_duration_under_2000ms L372–374
+ TestTypedDicts class class TestTypedDicts L288–316
+ test_contract_json_typeddict_exists method method test_contract_json_typeddict_exists L291–292
+ test_has_duration_ms_annotation method method test_has_duration_ms_annotation L298–300
+ test_has_exit_code_annotation method method test_has_exit_code_annotation L294–296
+ test_retains_address_annotation method method test_retains_address_annotation L302–304
+ test_retains_history_annotation method method test_retains_history_annotation L306–308
+ test_retains_stability_annotation method method test_retains_stability_annotation L310–312
+ test_retains_warnings_annotation method method test_retains_warnings_annotation L314–316
+ _ADDR variable variable _ADDR L32–32
+ _env function function _env L40–41
+ _run function function _run L44–45
+ contract_repo function function contract_repo L54–155
+ CliRunner import import CliRunner L28–28
+ annotations import import annotations L19–19
+ json import import json L21–21
+ os import import os L22–22
+ pathlib import import pathlib L23–23
+ pytest import import pytest L26–26
+ textwrap import import textwrap L24–24
+ runner variable variable runner L30–30
~ muse/cli/commands/contract.py .py 1 symbol added, 3 symbols modified
+ start_timer import import start_timer L162–162
~ 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:30caff41aacdede679b88f0a6710d5f7a92c6b829c51a466d9d3ce6ed361ce25 --body "your comment"