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

feat(rename): supercharge for agents — -j alias, exit_code, duration_ms, sanitized errors, expanded docstrings

- Add -j alias for --json in register() - Add exit_code: int and duration_ms: float to _RenameResult TypedDict - Add start_timer() + elapsed() wired into run(); inject into JSON output - Sanitize new_name in _validate_identifier error messages (null-byte safety) - Expand register() docstring to list all 8 arguments - Expand run() docstring to document JSON envelope, exit_code, duration_ms - 99 new tests: TestJsonAlias, TestJsonEnvelope, TestUnitValidateIdentifier, TestUnitParseAddress, TestUnitLine, TestUnitDedup, TestUnitApplyEdits, TestUnitFindDefinitionSite, TestUnitFindReferenceSites, TestCLIScopeCallsites, TestCLIScopeAll, TestCLIAliases, TestCLIAsyncDef, TestCLIAttributeRename, TestCLIMultipleOccurrences, TestCLIWarnings, TestCLINoSites, TestCLISecurity, TestDocstrings

sha256:5054e4739d4a05413c3a5c6a75f2b395c45f84f0f3e268211184daf468eeaa1f sha
+136 ~4 symbols
sha256:e90f15b2845517ed76ca38719a686425a43aa6e9eab3f20ffab04fca6316cbad snapshot
+136
symbols added
~4
symbols modified
0
dead code introduced
Semantic Changes 140 symbols
~ tests/test_rename_supercharge.py .py 135 symbols added
+ TestCLIAliases class class TestCLIAliases L612–637
+ test_n_alias_does_not_write method method test_n_alias_does_not_write L620–624
+ test_n_alias_is_dry_run method method test_n_alias_is_dry_run L613–618
+ test_y_alias_applies_changes method method test_y_alias_applies_changes L626–631
+ test_y_alias_dry_run_is_false method method test_y_alias_dry_run_is_false L633–637
+ TestCLIAsyncDef class class TestCLIAsyncDef L645–662
+ test_async_rename_applies_correctly method method test_async_rename_applies_correctly L657–662
+ test_async_rename_exits_zero method method test_async_rename_exits_zero L646–649
+ test_async_rename_finds_definition method method test_async_rename_finds_definition L651–655
+ TestCLIAttributeRename class class TestCLIAttributeRename L670–690
+ test_attribute_applied_correctly method method test_attribute_applied_correctly L686–690
+ test_attribute_site_kind_is_reference method method test_attribute_site_kind_is_reference L679–684
+ test_finds_attribute_reference method method test_finds_attribute_reference L671–677
+ TestCLIMultipleOccurrences class class TestCLIMultipleOccurrences L698–714
+ test_multiple_applied_correctly method method test_multiple_applied_correctly L708–714
+ test_multiple_sites_found_on_same_line method method test_multiple_sites_found_on_same_line L699–706
+ TestCLINoSites class class TestCLINoSites L744–756
+ test_no_sites_exits_zero method method test_no_sites_exits_zero L745–749
+ test_no_sites_total_edit_sites_zero_or_more method method test_no_sites_total_edit_sites_zero_or_more L751–756
+ TestCLIScopeAll class class TestCLIScopeAll L587–604
+ test_scope_all_finds_definition method method test_scope_all_finds_definition L588–592
+ test_scope_all_finds_import method method test_scope_all_finds_import L594–598
+ test_scope_all_finds_reference method method test_scope_all_finds_reference L600–604
+ TestCLIScopeCallsites class class TestCLIScopeCallsites L550–579
+ test_callsites_exits_zero method method test_callsites_exits_zero L551–554
+ test_callsites_no_definition_kind method method test_callsites_no_definition_kind L563–567
+ test_callsites_no_import_kind method method test_callsites_no_import_kind L569–573
+ test_callsites_only_reference_kind method method test_callsites_only_reference_kind L556–561
+ test_callsites_scope_reflected_in_json method method test_callsites_scope_reflected_in_json L575–579
+ TestCLISecurity class class TestCLISecurity L764–783
+ test_ansi_not_in_json_output method method test_ansi_not_in_json_output L773–775
+ test_null_byte_in_new_name_rejected method method test_null_byte_in_new_name_rejected L765–767
+ test_null_byte_not_in_stdout method method test_null_byte_not_in_stdout L769–771
+ test_path_traversal_rejected method method test_path_traversal_rejected L777–779
+ test_space_in_new_name_rejected method method test_space_in_new_name_rejected L781–783
+ TestCLIWarnings class class TestCLIWarnings L722–736
+ test_max_files_warning_in_json method method test_max_files_warning_in_json L723–730
+ test_no_warning_when_files_within_limit method method test_no_warning_when_files_within_limit L732–736
+ TestDocstrings class class TestDocstrings L791–820
+ test_register_docstring_exists method method test_register_docstring_exists L809–812
+ test_register_docstring_mentions_scope method method test_register_docstring_mentions_scope L814–816
+ test_register_docstring_mentions_yes method method test_register_docstring_mentions_yes L818–820
+ test_run_docstring_exists method method test_run_docstring_exists L792–795
+ test_run_docstring_mentions_duration_ms method method test_run_docstring_mentions_duration_ms L805–807
+ test_run_docstring_mentions_exit_code method method test_run_docstring_mentions_exit_code L801–803
+ test_run_docstring_mentions_json method method test_run_docstring_mentions_json L797–799
+ TestJsonAlias class class TestJsonAlias L128–155
+ test_j_alias_edit_sites_match method method test_j_alias_edit_sites_match L152–155
+ test_j_alias_emits_valid_json method method test_j_alias_emits_valid_json L133–136
+ test_j_alias_exits_zero method method test_j_alias_exits_zero L129–131
+ test_j_alias_has_from_address method method test_j_alias_has_from_address L138–141
+ test_j_alias_same_keys_as_json_flag method method test_j_alias_same_keys_as_json_flag L143–150
+ TestJsonEnvelope class class TestJsonEnvelope L163–209
+ test_duration_ms_is_float method method test_duration_ms_is_float L179–182
+ test_duration_ms_positive method method test_duration_ms_positive L184–187
+ test_exit_code_is_zero method method test_exit_code_is_zero L169–172
+ test_has_duration_ms method method test_has_duration_ms L174–177
+ test_has_exit_code method method test_has_exit_code L164–167
+ test_json_applied_also_has_exit_code method method test_json_applied_also_has_exit_code L199–203
+ test_json_applied_has_duration_ms method method test_json_applied_has_duration_ms L205–209
+ test_typed_dict_has_duration_ms_field method method test_typed_dict_has_duration_ms_field L194–197
+ test_typed_dict_has_exit_code_field method method test_typed_dict_has_exit_code_field L189–192
+ TestUnitApplyEdits class class TestUnitApplyEdits L365–413
+ _site method method _site L366–370
+ test_edit_preserves_trailing_newline method method test_edit_preserves_trailing_newline L393–398
+ test_empty_sites_unchanged method method test_empty_sites_unchanged L379–382
+ test_longer_replacement method method test_longer_replacement L400–405
+ test_shorter_replacement method method test_shorter_replacement L407–413
+ test_single_edit method method test_single_edit L372–377
+ test_two_edits_same_line_right_to_left method method test_two_edits_same_line_right_to_left L384–391
+ TestUnitDedup class class TestUnitDedup L326–357
+ _site method method _site L327–331
+ test_empty_list method method test_empty_list L355–357
+ test_exact_duplicate_removed method method test_exact_duplicate_ L338–341
+ test_no_duplicates_unchanged method method test_no_duplicates_unchanged L333–336
+ test_preserves_order method method test_preserves_order L348–353
+ test_same_line_different_col_kept method method test_same_line_different_col_kept L343–346
+ TestUnitFindDefinitionSite class class TestUnitFindDefinitionSite L421–482
+ test_async_col_start_points_at_name method method test_async_col_start_points_at_name L475–482
+ test_col_start_points_at_name method method test_col_start_points_at_name L466–473
+ test_finds_async_function method method test_finds_async_function L430–436
+ test_finds_class class method test_finds_class L438–443
+ test_finds_function method method test_finds_function L422–428
+ test_finds_method_scoped_to_class class method test_finds_method_scoped_to_class L445–454
+ test_returns_none_for_syntax_error method method test_returns_none_for_syntax_error L461–464
+ test_returns_none_when_not_found method method test_returns_none_when_not_found L456–459
+ TestUnitFindReferenceSites class class TestUnitFindReferenceSites L490–542
+ test_callsites_disabled method method test_callsites_disabled L519–524
+ test_does_not_match_partial_name method method test_does_not_match_partial_name L533–542
+ test_finds_attribute_access method method test_finds_attribute_access L512–517
+ test_finds_call_site method method test_finds_call_site L505–510
+ test_finds_import_site method method test_finds_import_site L491–496
+ test_import_disabled method method test_import_disabled L498–503
+ test_returns_empty_on_syntax_error method method test_returns_empty_on_syntax_error L526–531
+ TestUnitLine class class TestUnitLine L297–318
+ _line method method _line L298–300
+ test_empty_list method method test_empty_list L317–318
+ test_first_line method method test_first_line L302–303
+ test_last_line method method test_last_line L305–306
+ test_out_of_range_high method method test_out_of_range_high L308–309
+ test_out_of_range_negative method method test_out_of_range_negative L314–315
+ test_out_of_range_zero method method test_out_of_range_zero L311–312
+ TestUnitParseAddress class class TestUnitParseAddress L262–289
+ _p method method _p L263–265
+ test_empty_file_returns_none method method test_empty_file_returns_none L278–279
+ test_empty_part_in_dotted_returns_none method method test_empty_part_in_dotted_returns_none L284–285
+ test_empty_symbol_returns_none method method test_empty_symbol_returns_none L281–282
+ test_method_address method method test_method_address L271–273
+ test_nested_path method method test_nested_path L287–289
+ test_no_double_colon_returns_none method method test_no_double_colon_returns_none L275–276
+ test_simple_address method method test_simple_address L267–269
+ TestUnitValidateIdentifier class class TestUnitValidateIdentifier L217–254
+ _v method method _v L218–220
+ test_all_caps_is_valid method method test_all_caps_is_valid L246–247
+ test_dunder_with_force_returns_none method method test_dunder_with_force_returns_none L240–241
+ test_dunder_without_force_returns_error method method test_dunder_without_force_returns_error L237–238
+ test_empty_name_returns_error method method test_empty_name_returns_error L225–226
+ test_hyphen_is_invalid method method test_hyphen_is_invalid L234–235
+ test_invalid_identifier_returns_error method method test_invalid_identifier_returns_error L231–232
+ test_leading_underscore_is_valid method method test_leading_underscore_is_valid L243–244
+ test_name_too_long_returns_error method method test_name_too_long_returns_error L228–229
+ test_unicode_letter_start_is_invalid method method test_unicode_letter_start_is_invalid L249–254
+ test_valid_name_returns_none method method test_valid_name_returns_none L222–223
+ _commit function function _commit L65–69
+ _run function function _run L61–62
+ cli variable variable cli L52–52
+ CliRunner import import CliRunner L50–50
+ annotations import import annotations L41–41
+ json import import json L43–43
+ pathlib import import pathlib L44–44
+ pytest import import pytest L48–48
+ textwrap import import textwrap L45–45
+ typing import import typing L46–46
+ repo function function repo L78–120
+ runner variable variable runner L53–53
~ muse/cli/commands/rename.py .py 1 symbol added, 4 symbols modified
+ start_timer import import start_timer L81–81
~ run
← Older Oldest on task/supercharge-rename
All commits
Newer → Latest on task/supercharge-rename

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:5054e4739d4a05413c3a5c6a75f2b395c45f84f0f3e268211184daf468eeaa1f --body "your comment"