gabriel / muse public
feat patch query-history task/supercharge-query-history #1 / 1
AI Agent gabriel · 158 days ago · Apr 19, 2026 · Diff

feat(query-history): supercharge for agents — -j alias, exit_code, duration_ms, truncated, TypedDicts, sanitized pred display, expanded docstrings

- Add _QueryHistoryJson, _IntroducedJson, _RemovedJson TypedDicts - Add -j alias for --json in register() - Inject elapsed = start_timer() at top of run() - Add exit_code=0 + duration_ms=elapsed() to all 3 JSON envelopes - Add truncated field to introduced-only and removed-only JSON - Sanitize pred_display with sanitize_display() in all human output paths - Expand register() docstring to list all 12 arguments - Expand run() docstring to document exit_code + duration_ms in JSON envelope - 76 tests pass

sha256:3afbde6bc7c10d6fd5654da7021f0475a83caad4f103c43d48d8cb3f5d2978a1 sha
+107 ~2 symbols
sha256:fd7223326bb6456f929ed0b8f1cfb32609179b25256b260ec5f4c019d34417fc snapshot
+107
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 109 symbols
~ tests/test_query_history_supercharge.py .py 102 symbols added
+ TestCLIFilters class class TestCLIFilters L555–609
+ test_changed_only_plus_min_changes_interaction method method test_changed_only_plus_min_changes_interaction L581–588
+ test_compute_total_is_not_stable method method test_compute_total_is_not_stable L565–572
+ test_introduced_finds_format_total method method test_introduced_finds_format_total L590–594
+ test_limit_applied_to_introduced method method test_limit_applied_to_introduced L605–609
+ test_removed_empty_when_nothing_removed method method test_removed_empty_when_nothing_ L596–603
+ test_sort_last method method test_sort_last L574–579
+ test_validate_amount_is_stable method method test_validate_amount_is_stable L556–563
+ TestCLISecurity class class TestCLISecurity L617–629
+ test_ansi_not_in_introduced_json method method test_ansi_not_in_introduced_json L626–629
+ test_ansi_not_in_json_output method method test_ansi_not_in_json_output L622–624
+ test_null_byte_in_predicate_not_in_output method method test_null_byte_in_predicate_not_in_output L618–620
+ TestDefaultModeJson class class TestDefaultModeJson L152–212
+ test_duration_ms_positive method method test_duration_ms_positive L168–172
+ test_exit_code_is_zero method method test_exit_code_is_zero L158–161
+ test_has_commits_scanned method method test_has_commits_scanned L179–183
+ test_has_duration_ms method method test_has_duration_ms L163–166
+ test_has_exit_code method method test_has_exit_code L153–156
+ test_has_schema_version method method test_has_schema_version L174–177
+ test_has_truncated method method test_has_truncated L185–188
+ test_no_match_exit_code_zero method method test_no_match_exit_code_zero L202–207
+ test_no_match_has_duration_ms method method test_no_match_has_duration_ms L209–212
+ test_result_record_schema method method test_result_record_schema L190–200
+ TestDocstrings class class TestDocstrings L637–666
+ test_register_docstring_exists method method test_register_docstring_exists L655–658
+ test_run_docstring_exists method method test_run_docstring_exists L638–641
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L651–653
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L647–649
+ test_run_docstring_mentions_json method method test_run_docstring_mentions_json L643–645
+ test_sort_key_fn_docstring_exists method method test_sort_key_fn_docstring_exists L664–666
+ test_symbol_history_docstring_exists method method test_symbol_history_docstring_exists L660–662
+ TestIntroducedJson class class TestIntroducedJson L220–269
+ test_duration_ms_positive method method test_duration_ms_positive L236–240
+ test_exit_code_is_zero method method test_exit_code_is_zero L226–229
+ test_finds_format_total method method test_finds_format_total L264–269
+ test_has_duration_ms method method test_has_duration_ms L231–234
+ test_has_exit_code method method test_has_exit_code L221–224
+ test_has_truncated method method test_has_truncated L242–245
+ test_truncated_false_without_limit method method test_truncated_false_without_limit L247–250
+ test_truncated_true_when_limited method method test_truncated_true_when_limited L252–262
+ TestJsonAlias class class TestJsonAlias L104–144
+ test_j_alias_emits_valid_json method method test_j_alias_emits_valid_json L109–113
+ test_j_alias_exits_zero method method test_j_alias_exits_zero L105–107
+ test_j_alias_has_results method method test_j_alias_has_results L115–118
+ test_j_alias_introduced_mode method method test_j_alias_introduced_mode L134–138
+ test_j_alias_removed_mode method method test_j_alias_removed_mode L140–144
+ test_j_alias_result_count_matches method method test_j_alias_result_count_matches L129–132
+ test_j_alias_same_keys_as_json_flag method method test_j_alias_same_keys_as_json_flag L120–127
+ TestRemovedJson class class TestRemovedJson L277–307
+ test_duration_ms_positive method method test_duration_ms_positive L293–297
+ test_exit_code_is_zero method method test_exit_code_is_zero L283–286
+ test_has_duration_ms method method test_has_duration_ms L288–291
+ test_has_exit_code method method test_has_exit_code L278–281
+ test_has_truncated method method test_has_truncated L299–302
+ test_truncated_false_without_limit method method test_truncated_false_without_limit L304–307
+ TestTypedDicts class class TestTypedDicts L315–371
+ test_introduced_json_has_exit_code method method test_introduced_json_has_exit_code L349–352
+ test_introduced_json_has_truncated method method test_introduced_json_has_truncated L354–357
+ test_introduced_json_importable method method test_introduced_json_importable L345–347
+ test_query_history_json_has_duration_ms method method test_query_history_json_has_duration_ms L325–328
+ test_query_history_json_has_exit_code method method test_query_history_json_has_exit_code L320–323
+ test_query_history_json_has_results method method test_query_history_json_has_results L340–343
+ test_query_history_json_has_schema_version method method test_query_history_json_has_schema_version L330–333
+ test_query_history_json_has_truncated method method test_query_history_json_has_truncated L335–338
+ test_query_history_json_importable method method test_query_history_json_importable L316–318
+ test_removed_json_has_exit_code method method test_removed_json_has_exit_code L363–366
+ test_removed_json_has_truncated method method test_removed_json_has_truncated L368–371
+ test_removed_json_importable method method test_removed_json_importable L359–361
+ TestUnitDiffSymbols class class TestUnitDiffSymbols L518–547
+ _make_rec method method _make_rec L519–529
+ test_introduced_to_dict_schema method method test_introduced_to_dict_schema L540–547
+ test_removed_to_dict_schema method method test_removed_to_dict_schema L531–538
+ TestUnitSortKeyFn class class TestUnitSortKeyFn L456–510
+ _make_history method method _make_history L457–469
+ test_sort_by_address method method test_sort_by_address L471–476
+ test_sort_by_changes_descending method method test_sort_by_changes_descending L485–490
+ test_sort_by_commits_descending method method test_sort_by_commits_descending L478–483
+ test_sort_by_first method method test_sort_by_first L492–497
+ test_sort_by_last method method test_sort_by_last L499–504
+ test_unknown_sort_falls_back_to_address method method test_unknown_sort_falls_back_to_address L506–510
+ TestUnitSymbolHistory class class TestUnitSymbolHistory L379–448
+ test_change_count_different_bodies method method test_change_count_different_bodies L409–414
+ test_change_count_same_body method method test_change_count_same_body L401–407
+ test_first_committed_at_truncated_to_date method method test_first_committed_at_truncated_to_date L443–448
+ test_initial_state method method test_initial_state L380–385
+ test_record_increments_commit_count method method test_record_increments_commit_count L387–391
+ test_record_tracks_first_and_last method method test_record_tracks_first_and_last L393–399
+ test_stable_false_when_multiple_versions method method test_stable_false_when_multiple_versions L423–429
+ test_stable_true_when_one_version method method test_stable_true_when_one_version L416–421
+ test_to_dict_schema method method test_to_dict_schema L431–441
+ _commit function function _commit L55–59
+ _run function function _run L51–52
+ cli variable variable cli L42–42
+ CliRunner import import CliRunner L40–40
+ annotations import import annotations L31–31
+ json import import json L33–33
+ pathlib import import pathlib L34–34
+ pytest import import pytest L38–38
+ textwrap import import textwrap L35–35
+ typing import import typing L36–36
+ repo function function repo L68–96
+ runner variable variable runner L43–43
~ muse/cli/commands/query_history.py .py 5 symbols added, 2 symbols modified
+ _IntroducedJson class class _IntroducedJson L124–135
+ _QueryHistoryJson class class _QueryHistoryJson L109–121
+ _RemovedJson class class _RemovedJson L138–149
+ TypedDict import import TypedDict L81–81
+ start_timer import import start_timer L87–87
~ run
← Older Oldest on task/supercharge-query-history
All commits
Newer → Latest on task/supercharge-query-history

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:3afbde6bc7c10d6fd5654da7021f0475a83caad4f103c43d48d8cb3f5d2978a1 --body "your comment"