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

feat(breakage): supercharge for agents — -j alias, exit_code, duration_ms in JSON

- Add -j alias for --json (matches all other supercharged commands) - Add _BreakageOutputJson TypedDict covering all 11 existing keys plus exit_code + duration_ms - Add start_timer() → elapsed() wired to duration_ms in JSON envelope - exit_code in JSON mirrors computed process exit (0=clean, 1=errors/strict-warnings) — NOT hardcoded 0 - Update run() docstring with JSON envelope section documenting exit_code and duration_ms - Add tests/test_breakage_supercharge.py (38 tests): TestJsonAlias, TestDurationMs, TestExitCode, TestTypedDicts, TestDocstrings, TestAnsiSanitization, TestPerformance

sha256:62d4abbeadfbdc06aff93b4ad8aa39622aaff6dcc6f6881848d6efb32e3d36bb sha
+58 ~2 symbols
sha256:5226a2cd3cfda21a46c97dfd85eb0ba000f51f6067671bd578c9a0246074289d snapshot
+58
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 60 symbols
~ tests/test_breakage_supercharge.py .py 56 symbols added
+ TestAnsiSanitization class class TestAnsiSanitization L324–337
+ test_broken_repo_json_output_no_ansi method method test_broken_repo_json_output_no_ansi L335–337
+ test_j_alias_output_no_ansi method method test_j_alias_output_no_ansi L331–333
+ test_json_output_no_ansi method method test_json_output_no_ansi L327–329
+ TestDocstrings class class TestDocstrings L305–316
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L313–316
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L308–311
+ TestDurationMs class class TestDurationMs L167–200
+ test_duration_ms_present_on_broken_repo method method test_duration_ms_present_on_broken_repo L190–194
+ test_duration_ms_with_strict_flag method method test_duration_ms_with_strict_flag L196–200
+ test_j_alias_duration_ms_present method method test_j_alias_duration_ms_present L185–188
+ test_json_duration_ms_is_float method method test_json_duration_ms_is_float L180–183
+ test_json_duration_ms_nonnegative method method test_json_duration_ms_nonnegative L175–178
+ test_json_has_duration_ms method method test_json_has_duration_ms L170–173
+ TestExitCode class class TestExitCode L208–254
+ test_exit_code_in_json_is_not_hardcoded_zero method method test_exit_code_in_json_is_not_hardcoded_zero L249–254
+ test_exit_code_mirrors_process_exit_on_broken method method test_exit_code_mirrors_process_exit_on_broken L244–247
+ test_exit_code_mirrors_process_exit_on_clean method method test_exit_code_mirrors_process_exit_on_clean L232–235
+ test_exit_code_one_on_broken_repo method method test_exit_code_one_on_broken_repo L237–242
+ test_j_alias_exit_code_present method method test_j_alias_exit_code_present L227–230
+ test_json_exit_code_is_int method method test_json_exit_code_is_int L222–225
+ test_json_exit_code_zero_on_clean_repo method method test_json_exit_code_zero_on_clean_repo L216–220
+ test_json_has_exit_code method method test_json_has_exit_code L211–214
+ TestJsonAlias class class TestJsonAlias L126–159
+ test_j_alias_exits_zero_on_clean_repo method method test_j_alias_exits_zero_on_clean_repo L129–131
+ test_j_alias_has_errors_key method method test_j_alias_has_errors_key L142–145
+ test_j_alias_has_issues_key method method test_j_alias_has_issues_key L137–140
+ test_j_alias_same_exit_code_as_json_flag method method test_j_alias_same_exit_code_as_json_flag L156–159
+ test_j_alias_same_top_level_keys_as_json_flag method method test_j_alias_same_top_level_keys_as_json_flag L147–154
+ test_j_alias_valid_json method method test_j_alias_valid_json L133–135
+ TestPerformance class class TestPerformance L345–366
+ test_broken_repo_duration_under_2000ms method method test_broken_repo_duration_under_2000ms L358–361
+ test_duration_ms_is_float_not_int method method test_duration_ms_is_float_not_int L363–366
+ test_j_alias_duration_under_2000ms method method test_j_alias_duration_under_2000ms L353–356
+ test_json_duration_under_2000ms method method test_json_duration_under_2000ms L348–351
+ TestTypedDicts class class TestTypedDicts L262–297
+ test_breakage_issue_exists method method test_breakage_issue_exists L292–293
+ test_breakage_issue_has_severity method method test_breakage_issue_has_severity L295–297
+ test_breakage_output_json_exists method method test_breakage_output_json_exists L265–266
+ test_breakage_output_json_has_duration_ms_annotation method method test_breakage_output_json_has_duration_ms_annotation L272–274
+ test_breakage_output_json_has_exit_code_annotation method method test_breakage_output_json_has_exit_code_annotation L268–270
+ test_breakage_output_json_retains_errors_annotation method method test_breakage_output_json_retains_errors_annotation L280–282
+ test_breakage_output_json_retains_issues_annotation method method test_breakage_output_json_retains_issues_annotation L276–278
+ test_breakage_output_json_retains_schema_version_annotation method method test_breakage_output_json_retains_schema_version_annotation L288–290
+ test_breakage_output_json_retains_warnings_annotation method method test_breakage_output_json_retains_warnings_annotation L284–286
+ _env function function _env L40–41
+ _run function function _run L44–45
+ broken_repo function function broken_repo L86–118
+ clean_repo function function clean_repo L54–77
+ CliRunner import import CliRunner L30–30
+ annotations import import annotations L22–22
+ json import import json L24–24
+ pathlib import import pathlib L25–25
+ pytest import import pytest L28–28
+ textwrap import import textwrap L26–26
+ runner variable variable runner L32–32
~ muse/cli/commands/breakage.py .py 2 symbols added, 2 symbols modified
+ _BreakageOutputJson class class _BreakageOutputJson L95–127
+ start_timer import import start_timer L61–61
~ 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:62d4abbeadfbdc06aff93b4ad8aa39622aaff6dcc6f6881848d6efb32e3d36bb --body "your comment"