cgcardona / muse public

Wire MuseDomainPlugin into all CLI commands via plugin registry

All CLI state operations (commit, status, diff, merge, cherry-pick, stash) now dispatch through the MuseDomainPlugin protocol rather than calling core utilities directly. MusicPlugin is the live execution path, not just an isolated artifact.

Changes: - muse/plugins/registry.py (new): _REGISTRY dict mapping domain names to plugin instances; resolve_plugin(root) reads domain from repo.json and returns the correct plugin; read_domain() exposed as public helper - muse/cli/commands/init.py: writes "domain": "music" to repo.json; adds --domain flag for future extensibility - muse/cli/commands/commit.py: plugin.snapshot(workdir)["files"] replaces build_snapshot_manifest() - muse/cli/commands/status.py: plugin.drift(committed_snap, workdir) replaces diff_workdir_vs_snapshot() - muse/cli/commands/diff.py: plugin.snapshot() + plugin.diff() replace build_snapshot_manifest() and the inline _print_diff() helper - muse/cli/commands/merge.py: plugin.merge(base, ours, theirs) replaces diff_snapshots() + detect_conflicts() + apply_merge(); conflict paths flow from MergeResult.conflicts directly into write_merge_state() - muse/cli/commands/cherry_pick.py: same plugin.merge() pattern - muse/cli/commands/stash.py: plugin.snapshot(workdir)["files"] replaces build_snapshot_manifest() - muse/domain.py: MergeResult.conflicts is now a list of file paths (not prose); CLI formats its own messages - muse/plugins/music/plugin.py: merge() returns sorted(real_conflicts) as paths - tests/test_plugin_registry.py (new): 12 unit tests for registry lookup, unknown-domain error, and default fallback behaviour - tests/test_cli_plugin_dispatch.py (new): 21 integration tests verifying plugin methods are called through each CLI command using mock.patch; confirms plugin results drive command output - tests/test_music_plugin.py: updated conflict assertion to match path semantics (result.conflicts == ["a.mid"])

G Gabriel Cardona <gabriel@tellurstori.com> · 3d ago Mar 16, 2026 · a82406f1 · parent ac0b459d
← Older Oldest commit on main
All commits
Newer → Latest commit on main

Comments

0

No comments yet. Be the first to start the discussion.