gabriel / muse public
feat BREAKING status task/status-directory-tracking #1 / 1
AI Agent gabriel · 108 days ago · May 26, 2026 · Diff

feat(status): first-class empty directory tracking

Directories are first-class symbols in Muse — no .musekeep marker required. Empty directories are staged as sentinel entries (object_id="dir:") and persisted in SnapshotManifest.directories so they survive commits.

Changes: - DirStatus TypedDict added to domain.py (added, deleted, staged_added) - StageStatus gains a directories field populated by stage_status() - stage_status() in code plugin detects empty dirs on disk vs committed, applies the same nested-repo and ignore-pattern filtering as file walks - snapshot() skips sentinel entries when building the files manifest so they don't pollute SnapshotRecord.manifest - code add (explicit paths and add .) both detect and stage empty dirs via sentinel entries written to the stage index - status.py surfaces directories in JSON output; total_changes counts dir changes; clean/dirty account for dir adds and deletes - 8 TDD tests D1-D8 covering untracked new dir, dirty flag, staging, staged not in untracked, deleted committed dir, non-empty dir excluded, files visible through dir, and clean repo directories key

sha256:f992d46a7868ce37bb35c4e727736500bc7be91247f60e63833e0ab34f06b9a5 sha
+27 ~24 symbols
sha256:dc24ac360f2eddf486986017e7e7650a19022e902315c3d62dfc2037679069ad snapshot
+27
symbols added
~24
symbols modified
0
dead code introduced
Semantic Changes 51 symbols
+ TestDirectoryTracking class class TestDirectoryTracking L83–195
+ test_D1_new_empty_dir_appears_in_directories_added method method test_D1_new_empty_dir_appears_in_directories_ L84–96
+ test_D2_dirty_and_total_changes_after_mkdir method method test_D2_dirty_and_total_changes_after_mkdir L98–109
+ test_D3_staged_dir_moves_from_untracked_to_staged method method test_D3_staged_dir_moves_from_untracked_to_staged L111–123
+ test_D4_staged_dir_not_in_untracked method method test_D4_staged_dir_not_in_untracked L125–135
+ test_D5_deleted_committed_dir_in_directories_deleted method method test_D5_deleted_committed_dir_in_directories_deleted L137–149
+ test_D6_non_empty_dir_files_not_double_counted method method test_D6_non_empty_dir_files_not_double_counted L151–168
+ test_D7_non_empty_dir_changes_visible_through_files method method test_D7_non_empty_dir_changes_visible_through_files L170–180
+ test_D8_directories_key_always_present method method test_D8_directories_key_always_present L182–195
+ _env function function _env L39–40
+ _run function function _run L43–46
+ _status function function _status L49–50
+ cli variable variable cli L30–30
+ code_repo function function code_repo L54–61
+ CliRunner import import CliRunner L28–28
+ Mapping import import Mapping L24–24
+ annotations import import annotations L20–20
+ json import import json L22–22
+ pathlib import import pathlib L23–23
+ pytest import import pytest L26–26
+ repo_with_committed_dir function function repo_with_committed_dir L65–75
+ runner variable variable runner L31–31
~ muse/cli/commands/code_stage.py .py 1 symbol modified
~ muse/cli/commands/status.py .py 1 symbol added, 3 symbols modified
+ _DirStatusJson class class _DirStatusJson L154–164
~ run
~ muse/domain.py .py 1 symbol added, 2 symbols modified
+ DirStatus class class DirStatus L904–926
~ muse/plugins/code/plugin.py .py 3 symbols added, 18 symbols modified
+ _DIR_SENTINEL variable variable _DIR_SENTINEL L235–235
+ _head_snapshot_dirs_for function function _head_snapshot_dirs_for L207–231
+ DirStatus import import DirStatus L110–110
← Older Oldest on task/status-directory-tracking
All commits
Newer → Latest on task/status-directory-tracking

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