feat: add muse code add — selective staging with hunk-level patch mode
Implements a full Git-style staging index for the code domain. When `.muse/code/stage.json` exists, `muse commit` commits only what was explicitly staged; all other tracked files carry their committed state forward unchanged.
New commands: muse code add <file|dir|.> [-A|-u|-p|-n|-v] muse code reset [HEAD] [<file>]
Core changes: - muse/plugins/code/stage.py — StageIndex read/write/clear utilities - muse/domain.py — StagePlugin optional protocol + StagedEntry / StageStatus TypedDicts - muse/plugins/code/plugin.py — CodePlugin implements StagePlugin; snapshot() is now stage-aware - muse/cli/commands/code_stage.py — register_add / register_reset; interactive hunk staging via difflib - muse/cli/commands/commit.py — clears stage after successful commit - muse/cli/commands/status.py — renders three-bucket staged/unstaged/ untracked view when StagePlugin active - muse/cli/app.py — registers add + reset under code subparser - docs/reference/code-domain.md — full staging reference (section 1)
Tests: 53 new tests covering unit (pure functions), integration (CLI round-trips), stage-aware commit, three-bucket status, reset variants, resilience (corrupt index), and stress (100-file staging).
All checks: mypy zero errors · typing_audit 0 violations · 3255 passed
No comments yet. Be the first to start the discussion.