Skip to content

Add dispatch config export and import to back up and move settings #274

Description

@jongio

Description

Add dispatch config export and dispatch config import so a user can back up their configuration and move it between machines. Export writes the current config as JSON; import validates a config file and applies it, keeping a backup of the previous one.

Use Case

All of a user's curation lives in config.json: aliases, tags, notes, favorites, named views, themes, keybindings, and launch settings. There is no supported way to back it up or carry it to another machine short of locating and copying the file by hand, and a hand-copied file gets no validation. Shell history tools like atuin made "your data follows you" a headline feature; dispatch users deserve the same for their session curation.

Proposed Solution

Extend the existing config subcommand in cmd/dispatch/config.go:

  • dispatch config export [--out <file>] writes the current config as pretty JSON to stdout, or to a file when --out is given.
  • dispatch config import <file> loads the file, runs the same migrate, sanitize, and validate path used at startup, writes a timestamped backup of the existing config, then saves the imported config.
  • --merge merges the incoming per-session maps and named views into the current config instead of replacing everything, so settings from two machines can be combined.
  • Import refuses malformed JSON or invalid values and leaves the current config untouched.

Acceptance criteria

  • dispatch config export produces JSON that dispatch config import accepts round-trip.
  • dispatch config export --out file.json writes the file; import reads it back.
  • dispatch config import validates input and refuses malformed or invalid configs without changing the live config.
  • Import writes a backup of the previous config before overwriting.
  • --merge combines per-session maps and named views without dropping existing entries.
  • Tests cover export to stdout and file, round-trip import, invalid input rejection, backup creation, and merge behavior.

Alternatives Considered

Telling users to copy config.json with dispatch config path, rejected because it offers no validation and no merge. A cloud sync service, rejected as far heavier than the local backup and migrate need.

Complexity

M

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestideaFeature idea from the idea pipeline

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions