gabriel / muse public
feat BREAKING rm task/rm-supercharge #1 / 1
AI Agent gabriel · 161 days ago · Apr 18, 2026 · Diff

feat(rm): supercharge with elapsed_ms, exit_code, JSON-on-error, security hardening

- Add elapsed_ms and exit_code to _RmResultJson and all JSON output paths - Emit structured JSON on error paths (untracked, dir-without-r, modified) so agents can parse failure reasons without inspecting shell exit status - Add import time + start_time = time.monotonic() for wall-clock timing - Remove unused write_object_from_path import - Document elapsed_ms/exit_code semantics in module + run() docstrings - Improve _collect_targets docstring: path-traversal guard now documented - Improve _check_safety docstring: graceful skip when file absent from disk - Fix test _sha helper: blob_id() instead of bare hashlib.sha256 hex - 39 tests total: +17 new (elapsed_ms, exit_code, JSON-on-error, path traversal, outside-repo path, file-already-gone, dry-run safety, dry-run+force, unicode filenames, data integrity, idempotent+JSON, stress timing)

sha256:6ecc0510945a87fc6b3c7fa6af1bf8a2cbad5b6a088cf98c8fda9f9a4356171d sha
+19 ~8 −3 symbols
sha256:8e1927a8b80d5c5990406cfcd3d8186789e8fc3b62a8143de523351a1be3ec5d snapshot
+19
symbols added
~8
symbols modified
−3
symbols removed
0
dead code introduced
Semantic Changes 30 symbols
~ muse/cli/commands/rm.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
− write_object_from_path import import write_object_from_path L67–67
+ time import import time L72–72
~ run
~ tests/test_cmd_rm.py .py 18 symbols added, 2 symbols removed, 4 symbols modified
− _sha function function _sha L48–49
− hashlib import import hashlib L21–21
+ blob_id import import blob_id L39–39
+ test_rm_absolute_path_outside_repo_rejected function function test_rm_absolute_path_outside_repo_rejected L587–597
+ test_rm_disk_missing_no_cached_succeeds function function test_rm_disk_missing_no_cached_succeeds L617–625
+ test_rm_dry_run_force_bypasses_safety function function test_rm_dry_run_force_bypasses_safety L435–450
+ test_rm_dry_run_still_checks_safety function function test_rm_dry_run_still_checks_safety L422–432
+ test_rm_error_json_directory_without_r function function test_rm_error_json_directory_without_r L249–258
+ test_rm_error_json_modified_without_force function function test_rm_error_json_modified_without_force L300–311
+ test_rm_error_json_untracked function function test_rm_error_json_untracked L218–232
+ test_rm_file_already_deleted_from_disk function function test_rm_file_already_deleted_from_disk L605–614
+ test_rm_idempotent_json_still_valid function function test_rm_idempotent_json_still_valid L498–509
+ test_rm_json_dry_run_has_elapsed_ms_and_exit_code function function test_rm_json_dry_run_has_elapsed_ms_and_exit_code L542–551
+ test_rm_json_has_elapsed_ms function function test_rm_json_has_elapsed_ms L517–527
+ test_rm_json_has_exit_code_zero_on_success function function test_rm_json_has_exit_code_zero_on_success L530–539
+ test_rm_path_traversal_rejected function function test_rm_path_traversal_rejected L578–584
+ test_rm_stage_cleared_when_last_staged_entry_removed function function test_rm_stage_cleared_when_last_staged_entry_ L700–711
+ test_rm_stage_integrity_after_removal function function test_rm_stage_integrity_after_removal L683–697
+ test_rm_stress_timing function function test_rm_stress_timing L750–765
+ test_rm_unicode_filename function function test_rm_unicode_filename L666–675
← Older Oldest on task/rm-supercharge
All commits
Newer → Latest on task/rm-supercharge

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:6ecc0510945a87fc6b3c7fa6af1bf8a2cbad5b6a088cf98c8fda9f9a4356171d --body "your comment"