gabriel / muse public
feat patch task/core-cat #1 / 1
AI Agent gabriel · 161 days ago · Apr 16, 2026 · Diff

feat: add muse cat (file-level) and supercharge muse code cat

- core_cat.py: new file-level cat command (muse cat) — domain-agnostic, raw bytes, --at <branch|sha>, --json; rejects :: symbol addresses, control chars, ANSI, symlinks, path traversal - app.py: wire core_cat as 'cat' subcommand; code cat stays as 'code cat' - cat.py: fix fmt NameError (move assignment before early-exit guard); add --limit N for --all mode (truncated + total_symbols in JSON); add redirected_from field to global-fallback results - store.py: resolve_commit_ref now resolves branch names (refs/heads/<name>) before falling back to SHA prefix scan - test_cmd_core_cat.py: 41-test 7-tier suite for muse cat - test_cmd_cat_supercharged.py: clean up --raw tests (moved to core_cat), update all invocations to use ['code', 'cat', ...] - docs/agent-guide.md: document muse cat vs muse code cat distinction

sha256:250de614d0795e4b7cf7b4ea13b09b47f1f674ea5231164cde9e3e3924735a33 sha
+104 ~156 −23 symbols
sha256:7fc9d89ca66667db8c6e26be8e9a7c41d1e15cfb5fd94183d2f9a1f7a4e785f4 snapshot
+104
symbols added
~156
symbols modified
−23
symbols removed
0
dead code introduced
Semantic Changes 283 symbols
~ muse/cli/commands/core_cat.py .py 21 symbols added
+ _FileError class class _FileError L70–76
+ __init__ method method __init__ L73–76
+ _get_file_bytes function function _get_file_bytes L79–127
+ ExitCode import import ExitCode L52–52
+ Manifest import import Manifest L55–55
+ annotations import import annotations L44–44
+ argparse import import argparse L46–46
+ get_commit_snapshot_manifest import import get_commit_snapshot_manifest L55–55
+ get_head_snapshot_manifest import import get_head_snapshot_manifest L55–55
+ json import import json L47–47
+ pathlib import import pathlib L48–48
+ read_current_branch import import read_current_branch L55–55
+ read_object import import read_object L53–53
+ read_repo_id import import read_repo_id L54–54
+ require_repo import import require_repo L54–54
+ resolve_commit_ref import import resolve_commit_ref L55–55
+ sanitize_display import import sanitize_display L62–62
+ sys import import sys L49–49
+ time import import time L50–50
+ register function function register L135–166
+ run function function run L174–289
~ tests/test_cmd_core_cat.py .py 79 symbols added
+ TestArgumentValidation class class TestArgumentValidation L127–164
+ test_no_args_exits_nonzero method method test_no_args_exits_nonzero L128–130
+ test_no_args_json_is_valid_json_with_error method method test_no_args_json_is_valid_json_with_error L132–136
+ test_symbol_address_json_has_error_code method method test_symbol_address_json_has_error_code L143–149
+ test_symbol_address_rejected method method test_symbol_address_rejected L138–141
+ test_untracked_file_exits_nonzero method method test_untracked_file_exits_nonzero L151–153
+ test_untracked_file_json_has_error_code method method test_untracked_file_json_has_error_code L155–164
+ TestAtRef class class TestAtRef L262–306
+ test_at_bad_ref_exits_nonzero method method test_at_bad_ref_exits_nonzero L294–298
+ test_at_bad_ref_json_has_error method method test_at_bad_ref_json_has_error L300–306
+ test_at_branch_name method method test_at_branch_name L287–292
+ test_at_json_source_ref_contains_commit method method test_at_json_source_ref_contains_commit L275–285
+ test_at_old_commit_shows_old_content method method test_at_old_commit_shows_old_content L263–273
+ TestDataIntegrity class class TestDataIntegrity L386–437
+ test_at_content_differs_from_head method method test_at_content_differs_from_head L400–416
+ test_empty_file_handled method method test_empty_file_handled L428–437
+ test_json_content_equals_disk_bytes method method test_json_content_equals_disk_bytes L387–391
+ test_json_size_bytes_equals_len_of_content_utf8 method method test_json_size_bytes_equals_len_of_content_utf8 L393–398
+ test_multi_file_sizes_sum_correctly method method test_multi_file_sizes_sum_correctly L418–426
+ TestE2E class class TestE2E L314–344
+ test_head_shows_latest_content method method test_head_shows_latest_content L315–320
+ test_old_ref_shows_old_content method method test_old_ref_shows_old_content L322–329
+ test_requires_repo method method test_requires_repo L340–344
+ test_working_tree_edit_visible_without_at method method test_working_tree_edit_visible_without_at L331–338
+ TestMultiFile class class TestMultiFile L219–254
+ test_multi_file_json_each_has_schema method method test_multi_file_json_each_has_schema L229–237
+ test_multi_file_json_has_files_key method method test_multi_file_json_has_files_key L220–227
+ test_multi_file_one_missing_exits_nonzero method method test_multi_file_one_missing_exits_nonzero L247–254
+ test_multi_file_text_prints_all method method test_multi_file_text_prints_all L239–245
+ TestPerformance class class TestPerformance L470–499
+ test_10_files_under_1s method method test_10_files_under_1s L478–487
+ test_large_file_json_under_1s method method test_large_file_json_under_1s L489–499
+ test_single_file_under_300ms method method test_single_file_under_300ms L471–476
+ TestSecurity class class TestSecurity L352–378
+ test_ansi_in_path_not_in_output method method test_ansi_in_path_not_in_output L365–370
+ test_newline_in_path_rejected method method test_newline_in_path_rejected L372–374
+ test_null_byte_in_path_rejected method method test_null_byte_in_path_rejected L376–378
+ test_path_traversal_rejected method method test_path_traversal_rejected L359–363
+ test_symlink_rejected method method test_symlink_rejected L353–357
+ TestSingleFile class class TestSingleFile L172–211
+ test_json_file_path_correct method method test_json_file_path_correct L188–191
+ test_json_schema_single_file method method test_json_schema_single_file L178–186
+ test_json_shorthand_flag method method test_json_shorthand_flag L203–206
+ test_json_size_bytes_accurate method method test_json_size_bytes_accurate L198–201
+ test_json_source_ref_working_tree method method test_json_source_ref_working_tree L193–196
+ test_prints_file_content method method test_prints_file_content L173–176
+ test_subdirectory_file method method test_subdirectory_file L208–211
+ TestStress class class TestStress L445–462
+ test_10_files_json method method test_10_files_json L454–462
+ test_large_file_1mib method method test_large_file_1mib L446–452
+ _CONTENT_V1 variable variable _CONTENT_V1 L103–103
+ _CONTENT_V2 variable variable _CONTENT_V2 L104–104
+ _REPO_ID variable variable _REPO_ID L38–38
+ _add_file function function _add_file L66–72
+ _commit function function _commit L75–95
+ _counter variable variable _counter L39–39
+ _env function function _env L62–63
+ _init_repo function function _init_repo L51–59
+ _sha function function _sha L47–48
+ cli variable variable cli L35–35
+ CliRunner import import CliRunner L30–30
+ CommitRecord import import CommitRecord L33–33
+ SnapshotRecord import import SnapshotRecord L33–33
+ annotations import import annotations L19–19
+ compute_commit_id import import compute_commit_id L32–32
+ compute_snapshot_id import import compute_snapshot_id L32–32
+ datetime import import datetime L26–26
+ hashlib import import hashlib L25–25
+ json import import json L21–21
+ pathlib import import pathlib L22–22
+ pytest import import pytest L28–28
+ textwrap import import textwrap L23–23
+ time import import time L24–24
+ write_commit import import write_commit L33–33
+ write_object import import write_object L31–31
+ write_snapshot import import write_snapshot L33–33
+ repo function function repo L108–111
+ runner variable variable runner L36–36
+ two_commit_repo function function two_commit_repo L115–119
~ docs/agent-guide.md .md 3 symbols added, 1 symbol removed, 9 symbols modified
− code[bash]@L468 variable variable code[bash]@L468 L468–474
+ code[bash]@L479 variable variable code[bash]@L479 L479–486
+ muse cat vs muse code cat — two different commands section muse cat vs muse code cat — two different commands L467–477
+ table@L469 section table@L469 L469–474
~ muse/cli/commands/cat.py .py 2 symbols modified
~ muse/core/store.py .py 1 symbol modified
~ tests/test_cmd_cat_supercharged.py .py 22 symbols removed, 27 symbols modified
− TestCatRawHistorical class class TestCatRawHistorical L279–318
− test_raw_at_bad_ref_exits_one method method test_raw_at_bad_ref_exits_one L314–318
− test_raw_at_first_commit method method test_raw_at_first_commit L280–293
− test_raw_at_json_source_ref_has_commit method method test_raw_at_json_source_ref_has_commit L302–312
− test_raw_head_has_updated_content method method test_raw_head_has_updated_content L295–300
− TestCatRawSecurity class class TestCatRawSecurity L511–537
− test_raw_ansi_injection_in_path_sanitized method method test_raw_ansi_injection_in_path_sanitized L524–531
− test_raw_path_traversal_rejected method method test_raw_path_traversal_rejected L533–537
− test_raw_symlink_rejected method method test_raw_symlink_rejected L512–522
− TestCatRawUnit class class TestCatRawUnit L192–271
− test_raw_and_symbol_address_are_mutually_exclusive method method test_raw_and_symbol_address_are_mutually_exclusive L264–271
− test_raw_full_file_not_just_symbols method method test_raw_full_file_not_just_symbols L198–203
− test_raw_json_content_matches_file method method test_raw_json_content_matches_file L222–228
− test_raw_json_schema method method test_raw_json_schema L211–220
− test_raw_json_size_bytes_correct method method test_raw_json_size_bytes_correct L230–236
− test_raw_json_source_ref_working_tree method method test_raw_json_source_ref_working_tree L238–243
− test_raw_multiple_files method method test_raw_multiple_files L245–262
− test_raw_outputs_file_content method method test_raw_outputs_file_content L193–196
− test_raw_untracked_file_exits_one method method test_raw_untracked_file_exits_one L205–209
− test_raw_content_equals_disk_bytes method method test_raw_content_equals_disk_bytes L576–582
− test_raw_json_200_symbols_file_under_1s method method test_raw_json_200_symbols_file_under_1s L648–655
− test_raw_large_file_under_1s method method test_raw_large_file_under_1s L626–633
← Older Oldest on task/core-cat
All commits
Newer → Latest on task/core-cat

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:250de614d0795e4b7cf7b4ea13b09b47f1f674ea5231164cde9e3e3924735a33 --body "your comment"