gabriel / muse public
feat patch ergonomics task/ergonomics-merge-autostash-grep-files #1 / 1
gabriel · 162 days ago · Apr 15, 2026 · Diff

feat(ergonomics): muse merge --autostash + muse code grep --files

- merge --autostash: stash dirty working tree before merge, pop in finally block regardless of outcome (clean/conflict/error). Mirrors muse checkout --autostash using the same _stash_push_programmatic / _apply_autostash primitives. Mutually exclusive with --force. Extracted merge body into _run_merge() to enable clean try/finally.

- code grep --files: print unique matching file paths one per line, sorted. Mirrors grep -l / rg -l. Trivially pipeable without JSON parsing or key-name knowledge.

Tests: 13 merge-autostash cases + 10 grep-files cases; 163 existing merge+grep tests all passing.

sha256:40c2a9d7a0ed1fe019cc06cb5e1b8b7a2468b1398279bed823bfb3e122a46115 sha
+46 ~4 symbols
sha256:dc75cb5018fff8320d083cfb3e0cd3c3ec67a279a8716d108d2075a60a16db36 snapshot
+46
symbols added
~4
symbols modified
0
dead code introduced
Semantic Changes 50 symbols
~ tests/test_cmd_merge_autostash.py .py 32 symbols added
+ TestCleanTree class class TestCleanTree L147–159
+ test_clean_tree_merge_succeeds method method test_clean_tree_merge_succeeds L155–159
+ test_clean_tree_no_stash_created method method test_clean_tree_no_stash_created L150–153
+ TestDataIntegrity class class TestDataIntegrity L242–258
+ test_no_changes_lost_on_clean_merge method method test_no_changes_lost_on_clean_merge L245–252
+ test_no_changes_lost_on_conflict method method test_no_changes_lost_on_conflict L254–258
+ TestDirtyTreeConflict class class TestDirtyTreeConflict L223–234
+ test_conflict_stash_popped method method test_conflict_stash_popped L226–229
+ test_conflict_wip_file_restored method method test_conflict_wip_file_restored L231–234
+ TestDirtyTreeSuccessfulMerge class class TestDirtyTreeSuccessfulMerge L167–215
+ test_dirty_modified_file_restored_after_merge method method test_dirty_modified_file_restored_after_merge L208–215
+ test_dirty_tree_json_output_is_valid method method test_dirty_tree_json_output_is_valid L194–206
+ test_dirty_tree_merge_result_present method method test_dirty_tree_merge_result_present L186–192
+ test_dirty_tree_stash_popped_after_merge method method test_dirty_tree_stash_popped_after_merge L170–177
+ test_dirty_tree_wip_file_restored_after_merge method method test_dirty_tree_wip_file_restored_after_merge L179–184
+ TestFlagValidation class class TestFlagValidation L121–139
+ test_autostash_and_force_are_mutually_exclusive method method test_autostash_and_force_are_mutually_exclusive L124–129
+ test_autostash_dry_run_does_not_create_stash method method test_autostash_dry_run_does_not_create_stash L131–139
+ _commit function function _commit L56–59
+ _invoke function function _invoke L47–53
+ _stash_size function function _stash_size L62–63
+ conflict_repo function function conflict_repo L94–113
+ CliRunner import import CliRunner L36–36
+ InvokeResult import import InvokeResult L36–36
+ _load_stash import import _load_stash L37–37
+ annotations import import annotations L28–28
+ json import import json L30–30
+ os import import os L31–31
+ pathlib import import pathlib L32–32
+ pytest import import pytest L34–34
+ runner variable variable runner L39–39
+ two_branch_repo function function two_branch_repo L72–90
~ muse/cli/commands/grep.py .py 2 symbols modified
~ muse/cli/commands/merge.py .py 3 symbols added, 2 symbols modified
+ _run_merge function function _run_merge L233–769
+ _apply_autostash import import _apply_autostash L80–80
+ _stash_push_programmatic import import _stash_push_programmatic L81–81
~ run
~ tests/test_cmd_grep.py .py 11 symbols added
+ TestGrepFiles class class TestGrepFiles L525–595
+ test_files_compatible_with_file_filter method method test_files_compatible_with_file_filter L589–595
+ test_files_compatible_with_kind_filter method method test_files_compatible_with_kind_filter L580–587
+ test_files_excludes_non_matching_files method method test_files_excludes_non_matching_files L556–563
+ test_files_lists_matching_file method method test_files_lists_matching_file L532–536
+ test_files_long_flag_only method method test_files_long_flag_only L573–578
+ test_files_mutually_exclusive_with_count method method test_files_mutually_exclusive_with_count L569–571
+ test_files_mutually_exclusive_with_json method method test_files_mutually_exclusive_with_json L565–567
+ test_files_no_match_empty_output method method test_files_no_match_empty_output L551–554
+ test_files_output_is_sorted method method test_files_output_is_sorted L545–549
+ test_files_output_is_unique_paths method method test_files_output_is_unique_paths L538–543
← Older Oldest on task/ergonomics-merge-autostash-grep-files
All commits
Newer → Latest on task/ergonomics-merge-autostash-grep-files

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:40c2a9d7a0ed1fe019cc06cb5e1b8b7a2468b1398279bed823bfb3e122a46115 --body "your comment"