feat: supercharge sparse-checkout — stats, --json everywhere, security, mode switching
New features: - --json flag added to init, set, add, and disable (list already had it) - elapsed_ms and exit_code in every JSON output, consistent with snapshot/show - stats subcommand: reads HEAD snapshot, reports total_files, matching_files, excluded_files, efficiency ratio; exits 0 with zeros when no commits yet - Mode switching: init --no-cone on existing cone config now switches mode (preserving patterns) and reports switched=true/previous_mode in JSON; same-mode reinit is a no-op (switched=false)
Security hardening: - Pattern validation extended beyond ANSI: now also rejects null bytes, whitespace-only patterns, and path traversal via '..' components - _read_config_safe distinguishes absent config (None) from corrupt config (exit 1 with clear error) — load_json_file silently returned None for both
Bug fixes: - test_cmd_sparse_checkout.py: _write_files and TestApplyManifestSparse used bare hex object IDs (_sha → blob_id); TestStress same fix
Tests (56 new in test_cmd_sparse_checkout_supercharge.py): - JSON envelope on all subcommands (elapsed_ms, exit_code) - init schema: fresh/idempotent/switch cone→pattern/pattern→cone - set/add/disable schema with counts - stats: cone/pattern mode, disabled, no commits, efficiency ratio - Security: path traversal, null bytes, ANSI, whitespace-only patterns - Config corruption: malformed JSON, missing mode key, missing patterns key - Mode switching: updates config file, preserves patterns count - Stress: 1 000-file manifest, 500-pattern list
0 comments
muse hub commit comment sha256:5a93032adcfb072657ab962f1743ccd88ec4fbd458dcfbbee1e083d4f91d8192 --body "your comment"
No comments yet. Be the first to start the discussion.