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

feat(code age): 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; add elapsed = start_timer() at top of run() - Emit exit_code=0 and duration_ms=elapsed() on all three JSON paths: no-symbols early return, --explain JSON, and main list output - Add _NoSymbolsJson, _AgeListJson, _ExplainJson TypedDicts for type-safe construction of every JSON envelope shape - Update run() docstring to document exit_code and duration_ms fields - Add tests/test_age_supercharge.py (31 tests across 7 classes): TestJsonAlias, TestDurationMs, TestExitCode, TestTypedDicts, TestDocstrings, TestAnsiSanitization, TestPerformance

sha256:799eeabe70ac33b0d2f10cd7c20bc37cd461b10ee656519977ef4e11462ec388 sha
+63 ~2 symbols
sha256:e05647336280b8f024c5c18f1b187379776e4ce3e9903c19377920b40067dcae snapshot
+63
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 65 symbols
~ tests/test_age_supercharge.py .py 59 symbols added
+ TestAnsiSanitization class class TestAnsiSanitization L338–360
+ test_explain_json_address_no_ansi method method test_explain_json_address_no_ansi L356–360
+ test_explain_json_no_ansi_in_output method method test_explain_json_no_ansi_in_output L345–348
+ test_main_json_addresses_no_ansi method method test_main_json_addresses_no_ansi L350–354
+ test_main_json_no_ansi_in_output method method test_main_json_no_ansi_in_output L341–343
+ TestDocstrings class class TestDocstrings L319–330
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L327–330
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L322–325
+ TestDurationMs class class TestDurationMs L172–211
+ test_explain_json_duration_ms_is_float method method test_explain_json_duration_ms_is_float L202–206
+ test_explain_json_duration_ms_nonnegative method method test_explain_json_duration_ms_nonnegative L196–200
+ test_explain_json_has_duration_ms method method test_explain_json_has_duration_ms L190–194
+ test_j_alias_duration_ms_present method method test_j_alias_duration_ms_present L208–211
+ test_main_json_duration_ms_is_float method method test_main_json_duration_ms_is_float L185–188
+ test_main_json_duration_ms_nonnegative method method test_main_json_duration_ms_nonnegative L180–183
+ test_main_json_has_duration_ms method method test_main_json_has_duration_ms L175–178
+ TestExitCode class class TestExitCode L219–265
+ test_exit_code_mirrors_process_exit method method test_exit_code_mirrors_process_exit L262–265
+ test_explain_json_exit_code_is_int method method test_explain_json_exit_code_is_int L251–255
+ test_explain_json_exit_code_zero_on_success method method test_explain_json_exit_code_zero_on_success L244–249
+ test_explain_json_has_exit_code method method test_explain_json_has_exit_code L238–242
+ test_j_alias_exit_code_present method method test_j_alias_exit_code_present L257–260
+ test_main_json_exit_code_is_int method method test_main_json_exit_code_is_int L233–236
+ test_main_json_exit_code_zero_on_success method method test_main_json_exit_code_zero_on_success L227–231
+ test_main_json_has_exit_code method method test_main_json_has_exit_code L222–225
+ TestJsonAlias class class TestJsonAlias L119–164
+ test_j_alias_explain_exits_zero method method test_j_alias_explain_exits_zero L136–139
+ test_j_alias_explain_same_keys_as_json_flag method method test_j_alias_explain_same_keys_as_json_flag L156–164
+ test_j_alias_explain_valid_json method method test_j_alias_explain_valid_json L141–145
+ test_j_alias_main_exits_zero method method test_j_alias_main_exits_zero L122–124
+ test_j_alias_main_has_symbols_key method method test_j_alias_main_has_symbols_key L131–134
+ test_j_alias_main_valid_json method method test_j_alias_main_valid_json L126–129
+ test_j_alias_same_top_level_keys_as_json_flag method method test_j_alias_same_top_level_keys_as_json_flag L147–154
+ TestPerformance class class TestPerformance L368–391
+ test_duration_ms_type_is_float_not_int method method test_duration_ms_type_is_float_not_int L382–391
+ test_explain_json_duration_under_1000ms method method test_explain_json_duration_under_1000ms L376–380
+ test_main_json_duration_under_1000ms method method test_main_json_duration_under_1000ms L371–374
+ TestTypedDicts class class TestTypedDicts L273–311
+ test_age_list_json_has_duration_ms_annotation method method test_age_list_json_has_duration_ms_annotation L283–285
+ test_age_list_json_has_exit_code_annotation method method test_age_list_json_has_exit_code_annotation L279–281
+ test_age_list_json_has_symbols_annotation method method test_age_list_json_has_symbols_annotation L287–289
+ test_age_list_json_typed_dict_exists method method test_age_list_json_typed_dict_exists L276–277
+ test_age_record_has_est_survival_pct method method test_age_record_has_est_survival_pct L309–311
+ test_age_record_typed_dict_exists method method test_age_record_typed_dict_exists L306–307
+ test_explain_json_has_duration_ms_annotation method method test_explain_json_has_duration_ms_annotation L298–300
+ test_explain_json_has_events_annotation method method test_explain_json_has_events_annotation L302–304
+ test_explain_json_has_exit_code_annotation method method test_explain_json_has_exit_code_annotation L294–296
+ test_explain_json_typed_dict_exists method method test_explain_json_typed_dict_exists L291–292
+ _env function function _env L32–33
+ _first_symbol_address function function _first_symbol_address L40–47
+ _run function function _run L36–37
+ age_repo function function age_repo L56–111
+ CliRunner import import CliRunner L22–22
+ annotations import import annotations L14–14
+ json import import json L16–16
+ pathlib import import pathlib L17–17
+ pytest import import pytest L20–20
+ textwrap import import textwrap L18–18
+ runner variable variable runner L24–24
~ muse/cli/commands/age.py .py 4 symbols added, 2 symbols modified
+ _AgeListJson class class _AgeListJson L298–306
+ _ExplainJson class class _ExplainJson L309–326
+ _NoSymbolsJson class class _NoSymbolsJson L289–295
+ start_timer import import start_timer L144–144
~ 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:799eeabe70ac33b0d2f10cd7c20bc37cd461b10ee656519977ef4e11462ec388 --body "your comment"