Repository navigation
irspec edit move --to and remove (roadmap 1a, third part) - #5
Merged
Merged
Conversation
…d file its spectrum in removed/ move puts the entry at POSITION (1, last, past the end = last, below 1 exits 2) and keeps the order of the others. remove writes the manifest without the entry, then moves the spectrum to DIR/removed/ (never overwritten; manifest restored if the move fails). session does not scan removed/, so the spectrum does not come back. Third part of roadmap 1a. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WkkvyTJhY9v6rrMJ4A4Wsb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two more subcommands of
irspec edit(manifest only,src/irspec/edit.py):irspec edit DIR FILE move --to POSITION: puts the entry at POSITION (1 = first,last, a number past the end means last, below 1 or a non-number is exit 2). Every other entry keeps its order and bytes; moving to where it already is changes nothing (file untouched, says so).--json:{"file", "changes": [{"key": "position", "old", "new"}]}.irspec edit DIR FILE remove: writes the manifest without the entry, then moves the spectrum toDIR/removed/(same name, folder created). Nothing is deleted or overwritten: ifremoved/NAMEexists, exit 2 and nothing changes; if the move fails, the manifest is put back and exit 2.csv/andplain/files are left alone.--json:{"file", "removed": <whole entry>, "moved_to": "removed/NAME"}. A path that resolves outside DIR is never moved; an entry whose file is already gone is just taken out (moved_to: null).session.spectra_on_diskscans onlySPA/,jdx/,img/, andsession.organizeonly files at the top level, soremoved/is neither re-listed nor filed intoother/(tested).Not included, as specified:
rename(it isset name=),--no-build,restore, batch removal. No version bump, tag or release.README (
irspec editsection, roadmap list), CHANGELOG (## Unreleased),docs/roadmap.md1a and thecli.pydocstring are updated.Tests
tests/test_edit_move_remove.py, 23 tests on a session folder built from the sample.SPAand the.jdxfixtures: move first/middle/last/past the end/0 and other bad values/already there/twice/layout/--json; remove, thensessionagain (spectrum stays out,removed/not filed, a second run stable); name collision; failed move restores the manifest; manifest written before the move; unknown FILE; broken manifest; outside-folder path;--json.Mutation-checked: 14 deliberate breaks of
edit.py(off-by-one insert, no clamp, accepting 0, rewrite on no-op,lastignored, entry kept, overwrite on collision, no restore, file moved before the manifest, path escape, wrong folder name,--toon other verbs, extra args accepted,--jsondropping the entry), each failed at least one test; code restored.Full suite locally in a throwaway venv:
Ran 199 tests ... OK (skipped=18)(no lualatex/R/poppler here, so the tests needing them skipped).Generated by Claude Code