muse shelf read — files list bug and help UX fixes
muse shelf read — UX fixes and files list bug
Background
muse shelf read has two problems discovered during normal development use:
Bug:
files_countandfilesare semantically inconsistent.files_countcounts files that differ from HEAD (the actual change set), butfilesdumps the entire snapshot manifest — every tracked file in the repo. On a large repo this meansfiles_count: 6with a 1000+ entryfileslist, which is actively misleading.UX: The JSON schema in the
--helpoutput for all shelf subcommands is a single dense line. It is hard to read at a glance — you have to actively parse it rather than letting your eyes scan line-by-line.Docs gap: It is not documented that
muse shelf(bare, no subcommand) is identical tomuse shelf save, or that custom names are supported (muse shelf save my-auth-refactor).
Goal
filesinmuse shelf read --jsoncontains only the files that differ from HEAD — the same set thatfiles_countcounts.- The human-readable
muse shelf readoutput shows only changed files. - JSON schema blocks in all shelf
--helpdescriptions break each key onto its own line. muse shelf --helpandmuse shelf save --helpdocument the bare-command alias and custom name support.
Phases
Phase 1 — Fix files list bug
The invariant that must hold after this phase:
len(output["files"]) + len(output["deleted"]) == output["files_count"]
SF_01—run_read: computechanged_filesas paths whereentry["snapshot"][p] != head_manifest.get(p)(covers new files and modifications)SF_02—run_readJSON: emitfiles=changed_filesinstead of all snapshot keysSF_03—run_readhuman output: iteratechanged_filesinstead of all snapshot keysSF_04— Test:files_count == len(files) + len(deleted)invariant holds when HEAD has a mix of changed, unchanged, and new filesSF_05— Test:fileslist is empty when shelf snapshot matches HEAD exactly
Phase 2 — Pretty-print help JSON schemas
SF_06—muse shelf save --help: break JSON schema across lines (one key per line)SF_07—muse shelf read --help: sameSF_08—muse shelf list --help: sameSF_09—muse shelf apply --help: sameSF_10—muse shelf pop --help: sameSF_11—muse shelf drop --help: sameSF_12—muse shelf diff --help: same
Phase 3 — Document bare muse shelf and custom names
SF_13—muse shelf --help(top-level): note thatmuse shelfwith no subcommand is equivalent tomuse shelf saveSF_14—muse shelf save --help: add example showing custom name (muse shelf save my-auth-refactor -m "intent text")SF_15—muse shelf save --help: clarify auto-name format (branch/NNN) and that custom names are looked up by exact string or integer index
Acceptance criteria
muse shelf read 0 --json | jq '.files | length'returns 6 (not 1000+) on the test shelf entrymuse shelf read --helpJSON schema block has one key per linemuse shelf --helpmentions the bare-command alias- All SF_0x tests pass
Out of scope
created_byenrichment (read username from~/.muse/identity.toml) — tracked separately; requires identity config integration- Shelf entry expiry and GC — separate concern
Resolved in sha256:28c67dd3c92d
All three phases landed in a single commit on dev.
Phase 1 — files list bug (SF_01–03)
run_readnow computeschanged_filesas paths whereentry["snapshot"][p] != head_manifest.get(p). Both the JSONfilesfield and the human-readable output now iterate only those paths.files_countis recalculated aslen(changed_files) + len(deleted), so the invariantfiles_count == len(files) + len(deleted)always holds. A shelf with 6 actual changes now shows 6 files instead of 1000+.Phase 2 — pretty-print help schemas (SF_06–12) All 7 shelf subcommand JSON schema blocks reformatted to one key per line.
Phase 3 — bare alias and name format docs (SF_13–15) Module docstring and
muse shelf save --helpnow document:muse shelf(no subcommand) =muse shelf savebranch/NNN(e.g.dev/000,main/000)muse shelf save my-auth-refactor173/173 tests green.