gabriel / muse public
feat patch task/sparse-checkout #1 / 1
gabriel · 166 days ago · Apr 14, 2026 · Diff

feat: muse sparse-checkout — partial working-tree materialization

Implements muse sparse-checkout with five subcommands (init, set, add, list, disable) and auto-integration with apply_manifest.

- muse/core/sparse.py: read_sparse_config, write_sparse_config, remove_sparse_config, matches_sparse (cone + pattern modes), filter_manifest_sparse - muse/cli/commands/sparse_checkout.py: full subcommand tree; ANSI injection guard on all pattern input; JSON output for list - muse/core/workdir.py: apply_manifest auto-reads .muse/sparse-checkout and filters the target manifest before any I/O; full manifest stays intact in the object store - muse/cli/app.py: sparse_checkout registered as sparse-checkout - tests/test_cmd_sparse_checkout.py: 27 tests (init/set/add/list/disable, cone + pattern matching, apply_manifest integration, 200-file stress)

Closes #16

sha256:760168196439c7580727690447099706475c744faf5de952ecbcdfd96e3cc46c sha
+92 ~35 symbols
sha256:da993aaf1ae186a39cae5d34edac4e8df4fb6daed093e52c9dcd0b4112dd8079 snapshot
+92
symbols added
~35
symbols modified
0
dead code introduced
Semantic Changes 127 symbols
~ muse/cli/commands/sparse_checkout.py .py 20 symbols added
+ _ANSI_RE variable variable _ANSI_RE L56–56
+ _check_pattern function function _check_pattern L59–61
+ _cmd_add function function _cmd_add L99–123
+ _cmd_disable function function _cmd_disable L149–155
+ _cmd_init function function _cmd_init L69–76
+ _cmd_list function function _cmd_list L126–146
+ _cmd_set function function _cmd_set L79–96
+ ExitCode import import ExitCode L48–48
+ _json import import _json L45–45
+ annotations import import annotations L42–42
+ argparse import import argparse L44–44
+ re import import re L54–54
+ read_sparse_config import import read_sparse_config L50–50
+ remove_sparse_config import import remove_sparse_config L50–50
+ require_repo import import require_repo L49–49
+ sanitize_display import import sanitize_display L51–51
+ sys import import sys L46–46
+ write_sparse_config import import write_sparse_config L50–50
+ register function function register L163–205
+ run function function run L213–216
~ muse/core/sparse.py .py 11 symbols added
+ filter_manifest_sparse function function filter_manifest_sparse L107–127
+ Any import import Any L29–29
+ Manifest import import Manifest L31–31
+ annotations import import annotations L24–24
+ fnmatch import import fnmatch L26–26
+ json import import json L27–27
+ pathlib import import pathlib L28–28
+ matches_sparse function function matches_sparse L71–99
+ read_sparse_config function function read_sparse_config L39–50
+ remove_sparse_config function function remove_sparse_config L59–63
+ write_sparse_config function function write_sparse_config L53–56
~ tests/test_cmd_sparse_checkout.py .py 58 symbols added
+ TestAdd class class TestAdd L153–175
+ test_add_appends_patterns method method test_add_appends_patterns L154–162
+ test_add_deduplicates method method test_add_deduplicates L164–170
+ test_add_without_init_fails method method test_add_without_init_fails L172–175
+ TestApplyManifestSparse class class TestApplyManifestSparse L299–339
+ test_apply_manifest_no_sparse_config_writes_all method method test_apply_manifest_no_sparse_config_writes_all L322–339
+ test_apply_manifest_respects_sparse_config method method test_apply_manifest_respects_sparse_config L300–320
+ TestDisable class class TestDisable L215–227
+ test_disable_removes_config method method test_disable_removes_config L216–222
+ test_disable_when_not_active_is_noop method method test_disable_when_not_active_is_noop L224–227
+ TestFilterLogic class class TestFilterLogic L235–291
+ test_cone_excludes_other_dirs method method test_cone_excludes_other_dirs L246–249
+ test_cone_includes_files_in_pattern_dir method method test_cone_includes_files_in_pattern_dir L241–244
+ test_cone_includes_root_files method method test_cone_includes_root_files L236–239
+ test_cone_multiple_dirs method method test_cone_multiple_dirs L251–255
+ test_filter_manifest_sparse_cone method method test_filter_manifest_sparse_cone L267–279
+ test_filter_manifest_sparse_pattern method method test_filter_manifest_sparse_pattern L281–291
+ test_pattern_mode_extension method method test_pattern_mode_extension L262–265
+ test_pattern_mode_glob method method test_pattern_mode_glob L257–260
+ TestInit class class TestInit L85–111
+ test_init_creates_config_file method method test_init_creates_config_file L86–90
+ test_init_default_mode_is_cone method method test_init_default_mode_is_cone L92–96
+ test_init_idempotent method method test_init_idempotent L105–111
+ test_init_no_cone_sets_pattern_mode method method test_init_no_cone_sets_pattern_mode L98–103
+ TestList class class TestList L183–207
+ test_list_json method method test_list_json L193–201
+ test_list_shows_patterns_text method method test_list_shows_patterns_text L184–191
+ test_list_when_disabled method method test_list_when_disabled L203–207
+ TestSet class class TestSet L119–145
+ test_set_ansi_injection_rejected method method test_set_ansi_injection_rejected L141–145
+ test_set_replaces_existing method method test_set_replaces_existing L128–134
+ test_set_without_init_fails method method test_set_without_init_fails L136–139
+ test_set_writes_patterns method method test_set_writes_patterns L120–126
+ TestStress class class TestStress L347–362
+ test_200_file_manifest_cone_filter method method test_200_file_manifest_cone_filter L348–362
+ _REPO_ID variable variable _REPO_ID L31–31
+ _env function function _env L54–55
+ _init_repo function function _init_repo L43–51
+ _invoke function function _invoke L70–73
+ _sha function function _sha L39–40
+ _sparse_config function function _sparse_config L76–77
+ _write_files function function _write_files L58–67
+ CliRunner import import CliRunner L23–23
+ CommitRecord import import CommitRecord L26–26
+ Manifest import import Manifest L27–27
+ SnapshotRecord import import SnapshotRecord L26–26
+ annotations import import annotations L14–14
+ compute_commit_id import import compute_commit_id L25–25
+ compute_snapshot_id import import compute_snapshot_id L25–25
+ datetime import import datetime L16–16
+ hashlib import import hashlib L17–17
+ json import import json L18–18
+ pathlib import import pathlib L19–19
+ pytest import import pytest L21–21
+ write_commit import import write_commit L26–26
+ write_object import import write_object L24–24
+ write_snapshot import import write_snapshot L26–26
+ runner variable variable runner L29–29
~ muse/core/workdir.py .py 2 symbols added, 1 symbol modified
+ filter_manifest_sparse import import filter_manifest_sparse L17–17
+ read_sparse_config import import read_sparse_config L17–17
← Older Oldest on task/sparse-checkout
All commits
Newer → Latest on task/sparse-checkout

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:760168196439c7580727690447099706475c744faf5de952ecbcdfd96e3cc46c --body "your comment"