Add a site type or a destination kind.

Site types and destination kinds are JSON next to the program. Copy a shipped example, keep the fields core already understands, and prove capture or URL mapping with a test. Do not give an extension arbitrary shell.

Where the files go

Put addon JSON in an addons/ directory next to the module or the binary. Put destination JSON in destinations/ the same way. The same id replaces a shipped definition. A new id adds one. Ids are lowercase letters, digits, and hyphens.

WordPress ships as internal/addon/wordpress.json. Destination kinds ship under internal/destination/ (sftp, disk, s3, b2, gdrive). The primary local restic repository is not an extension.

Site type (addon)

Start from wordpress.json. An addon names:

  • detect — marker files, search depth, and directories to skip while looking for a root
  • excludes — paths left out of the file capture
  • database (optional) — how to read connection fields from a config file, and which dump methods to try
  • versions (optional) — how to read an app version and component headers
  • dumps — named dump methods the database block can call

Dump engines the program understands are argv (a fixed argument list, with placeholders such as {root} and {output}) and mysqldump. Remote dumps use remote_argv when the site is read over SFTP. The password is never a field on the site contract: it stays in the config file the addon names, or under var/secrets/ when saved there.

A directory that matches no addon is files only. On an existing site, set_adapter re-reads the tree; --adapter files forces files only.

Destination kind

Start from an existing kind that matches the shape you need (SFTP for host/user/path, S3 or B2 for bucket and keys, disk for a local path, gdrive for rclone). A kind names:

  • label and note — what people and agents see
  • fields — inputs with a pattern (hostname, username, abs_path, bucket, endpoint, drive_path, rel_path) and optional setup flag mapping
  • credentials (optional) — which env names hold access and secret keys; values are stored under var/secrets/ and are not printed back
  • url — restic URL template; optional empty-path / empty-prefix variants
  • require_tools (optional) — helper binaries that must exist (for example rclone)
  • hooks (optional) — only the named checks core already knows: disk_safety, mkdir_before_copy, rclone_remote

Do not invent a new Go hook unless JSON cannot express a hard safety or URL requirement. New hooks need a core change and a review.

Prove it

  1. Copy a shipped JSON file and change only what you must.
  2. Load it from addons/ or destinations/ next to a built binary.
  3. Run a real capture and check / scratch restore for a site type, or save and enable the destination and confirm the URL and credential mapping.
  4. If setup needs a new flag name, update the shared agent catalog so CLI and MCP stay aligned. Architecture notes live in AGENTS.md at the repo root.

An extension that “succeeds” while silently skipping files or the database is a failed design. Prefer a smaller JSON surface over a plugin that can run anything.