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

feat: supercharge muse code invariants — -j alias, exit_code, duration_ms

- Add -j alias for --json - Add _InvariantsOutputJson TypedDict with all JSON envelope fields - Add exit_code and duration_ms to JSON output - exit_code mirrors process exit: 0=pass, 1=error violations or strict+warnings - Expand run() docstring with JSON envelope section - Add test_invariants_supercharge.py — 29 tests

sha256:b9145d899eb97a646450ae34ba43fd0ac020261c5782d4678189cdbd0e39fc76 sha
+50 ~2 symbols
sha256:3653dc0787b71e48dd8ae14b7cc1cf0227fca02e72757ae611e8b5f1aa89c370 snapshot
+50
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 52 symbols
~ tests/test_invariants_supercharge.py .py 46 symbols added
+ TestAnsiSanitization class class TestAnsiSanitization L239–248
+ test_j_alias_output_no_ansi method method test_j_alias_output_no_ansi L246–248
+ test_json_output_no_ansi method method test_json_output_no_ansi L242–244
+ TestDocstrings class class TestDocstrings L220–231
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L228–231
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L223–226
+ TestDurationMs class class TestDurationMs L129–150
+ test_duration_ms_under_2000ms method method test_duration_ms_under_2000ms L148–150
+ test_j_alias_duration_ms_present method method test_j_alias_duration_ms_present L144–146
+ test_json_duration_ms_is_float method method test_json_duration_ms_is_float L140–142
+ test_json_duration_ms_nonnegative method method test_json_duration_ms_nonnegative L136–138
+ test_json_has_duration_ms method method test_json_has_duration_ms L132–134
+ TestExitCode class class TestExitCode L158–180
+ test_exit_code_mirrors_process_exit method method test_exit_code_mirrors_process_exit L178–180
+ test_j_alias_exit_code_present method method test_j_alias_exit_code_present L174–176
+ test_json_exit_code_is_int method method test_json_exit_code_is_int L170–172
+ test_json_exit_code_zero_clean_repo method method test_json_exit_code_zero_clean_repo L165–168
+ test_json_has_exit_code method method test_json_has_exit_code L161–163
+ TestJsonAlias class class TestJsonAlias L83–121
+ test_j_alias_exits_zero method method test_j_alias_exits_zero L86–88
+ test_j_alias_has_errors_key method method test_j_alias_has_errors_key L98–100
+ test_j_alias_has_violations_key method method test_j_alias_has_violations_key L94–96
+ test_j_alias_rules_checked_positive method method test_j_alias_rules_checked_positive L118–121
+ test_j_alias_same_top_level_keys_as_json_flag method method test_j_alias_same_top_level_keys_as_json_flag L102–111
+ test_j_alias_valid_json method method test_j_alias_valid_json L90–92
+ test_j_alias_violations_is_list method method test_j_alias_violations_is_list L113–116
+ TestPerformance class class TestPerformance L256–265
+ test_duration_ms_is_float_not_int method method test_duration_ms_is_float_not_int L263–265
+ test_json_duration_under_2000ms method method test_json_duration_under_2000ms L259–261
+ TestTypedDicts class class TestTypedDicts L188–212
+ test_has_duration_ms_annotation method method test_has_duration_ms_annotation L198–200
+ test_has_errors_annotation method method test_has_errors_annotation L206–208
+ test_has_exit_code_annotation method method test_has_exit_code_annotation L194–196
+ test_has_violations_annotation method method test_has_violations_annotation L202–204
+ test_has_warnings_annotation method method test_has_warnings_annotation L210–212
+ test_invariants_output_json_typeddict_exists method method test_invariants_output_json_typeddict_exists L191–192
+ _env function function _env L38–39
+ _run function function _run L42–43
+ CliRunner import import CliRunner L28–28
+ annotations import import annotations L20–20
+ json import import json L22–22
+ pathlib import import pathlib L23–23
+ pytest import import pytest L26–26
+ textwrap import import textwrap L24–24
+ inv_repo function function inv_repo L52–75
+ runner variable variable runner L30–30
~ muse/cli/commands/invariants.py .py 4 symbols added, 2 symbols modified
+ _InvariantsOutputJson class class _InvariantsOutputJson L138–176
+ Any import import Any L130–130
+ TypedDict import import TypedDict L130–130
+ start_timer import import start_timer L121–121
~ 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:b9145d899eb97a646450ae34ba43fd0ac020261c5782d4678189cdbd0e39fc76 --body "your comment"