Skip to content

[P3][cli] Add an export command (JSON dump) as the import counterpart #60

Description

@cevheri

Summary

Roadmap item (named in the closed backup-docs issue #42 as a future step: "a small export <file.json> command mirroring import" — the docs half shipped in v0.2.0; the command did not). The CLI can bulk-load (import) but cannot dump, which reads as a one-way door.

Scope

  • libredb export <path> <file.json>: the kv layer as a JSON object of string values — the exact shape import consumes, so export -> import round-trips.
  • Opens through readonlyFileSystem() like every read command (no lock, no writes); pinned by the same never-mutates test.
  • Decide the story for non-kv namespaces honestly: v1 exports the kv layer only (documents/tables are reachable via their prefixes as raw entries — state this in the doc), or add per-lens export later.
  • Well-formedness: values are already validated on write since v0.2.0; export must not re-introduce lone surrogates (JSON.stringify handles escaping).

Acceptance criteria

  • export -> import round-trip test on a mixed-namespace fixture.
  • Read-only guarantee pinned (byte-identical file, no lock file created).
  • docs/CLI.md updated (command + backup section cross-link).
  • Changeset (new user-facing command); gate green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliPre-announcement auditenhancementNew feature or requestpriority/lowPre-announcement audit

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions