Pitch
Backlog item #12. The store is local files by design, but people have more than one machine. Add a dead-simple, dependency-free way to snapshot and restore the whole store as a single tarball.
Behavior
sp export [--out FILE] [--include-morgue] — write a .tar.gz containing the index + scratch files (and optionally the morgue). Defaults to scratchpatch-export-<timestamp>.tar.gz in cwd, or stdout with --out -.
sp import <FILE> [--merge|--replace] — restore from a tarball.
--merge (default): add incoming scratches; on id collision, keep existing and report skips (never clobber silently).
--replace: back up current store to the morgue-adjacent backup, then replace. Must be explicit; two-step/destructive-safe per the project's design rule.
- Use stdlib
archive/tar + compress/gzip only — no new deps.
Acceptance criteria
Pitch
Backlog item #12. The store is local files by design, but people have more than one machine. Add a dead-simple, dependency-free way to snapshot and restore the whole store as a single tarball.
Behavior
sp export [--out FILE] [--include-morgue]— write a.tar.gzcontaining the index + scratch files (and optionally the morgue). Defaults toscratchpatch-export-<timestamp>.tar.gzin cwd, or stdout with--out -.sp import <FILE> [--merge|--replace]— restore from a tarball.--merge(default): add incoming scratches; on id collision, keep existing and report skips (never clobber silently).--replace: back up current store to the morgue-adjacent backup, then replace. Must be explicit; two-step/destructive-safe per the project's design rule.archive/tar+compress/gziponly — no new deps.Acceptance criteria
sp exportandsp importcommands registered on root.--mergenever overwrites existing ids; reports collisions/skips.--replaceis explicit and non-destructive by default (backs up before replacing).--out -streams the tarball to stdout; import reads from a path (and-for stdin if easy).