Skip to content

[feature] sp export/import — move the store between machines #33

Description

@rwrife

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

  • sp export and sp import commands registered on root.
  • Export round-trips: export → fresh store → import reproduces scratches + metadata identically.
  • Import --merge never overwrites existing ids; reports collisions/skips.
  • Import --replace is 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).
  • Unit tests: export/import round-trip, merge collision handling, empty-store export.
  • README updated with export/import usage and the merge-vs-replace note.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature / backlog item

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions