DeepSeek Harness (DSH) uses a plugin-based architecture, but when migrating environments or switching devices, developers often encounter issues with missing local plugins (such as link: or file: sources) and system-level helper scripts. The zhengjy01/dsh-backup-migrator plugin aims to solve this pain point. It enables full backup and migration of the DSH plugin environment through a GitHub repository, with a mechanism similar to VSCode settings sync.

Core Features

This plugin mainly provides the following capabilities:

  1. One-click backup and restore: Supports scanning the environment, packaging plugins and configuration files, and committing them to a Git repository with a single command; it also supports one-click pulling and restoration from the repository.
  2. Git history tracing: Backup content is stored as a Git repository, allowing you to view history and roll back to any point in time.
  3. Built-in scheduler: Provides automatic backup without configuring external launchd tasks, and supports automatically making up missed backup windows caused by sleep or shutdown.
  4. Local plugin processing: Automatically detects and packages local plugins of link: and file: types into a tarball, ensuring they can be correctly restored on a new machine.
  5. System-level script sync: In addition to plugins, it also backs up scripts under ~/.dsh/scripts and the corresponding launchd scheduled tasks (plist files), preventing scheduled tasks from failing due to missing scripts.

Installation and Activation

Before use, ensure your DeepSeek Harness version meets the requirements (>= 0.1.5-rc.1, compatible with 0.2.0-rc.2).

  1. Run the following command to install the plugin:
    dsh plugin --profile web add github:zhengjy01/dsh-backup-migrator
*After installation, restart the `dsh web` process to load the plugin.*

Configuration and Usage

Initial Configuration

Before using the plugin, complete a one-time setup by specifying the backup repository URL and local directory.

  1. Create an empty repository on GitHub (recommended to make it private if it contains sensitive configuration).
  2. Run the configuration commands and fill in the information:
    dshbackup_config backupDir: ~/Documents/DSH-Backup
    dshbackup_config repoUrl: git@github.com:username/dsh-backup.git

Core Operation Commands

The plugin provides a set of commands for managing the backup workflow:

  • dshbackup_backup: Scans the current environment, builds a manifest, packages local plugins, processes helper scripts, performs a git commit, and pushes.
  • dshbackup_restore: Pulls/clones the backup repository, reinstalls all plugins, and restores configuration files and scripts.
  • dshbackup_verify: Performs a pre-check before backup or restore, checking source reachability, Git remote repository status, keys, and whether helper files exist.
  • dshbackup_list: Views the backup history (Git Log) and the latest manifest summary.
  • dshbackup_config: Views or modifies configuration items, or reports scheduler status when no arguments are provided.

Automatic Scheduling Configuration

The plugin has a built-in scheduler that supports automatically running backups at specified intervals. Configure it as follows:

dshbackup_config autoBackup: true                 # 开启自动备份
dshbackup_config backupIntervalMinutes: 1440      # 备份间隔,默认为 1440 分钟(每日)
dshbackup_config backupRetryMinutes: 30           # 失败重试间隔,默认 30 分钟
dshbackup_config autoBackupPush: false            # 是否自动推送,默认 false(仅本地提交)

Note: The scheduler will automatically catch up missed backup windows on the next startup or wake.

HTTP Endpoints

The plugin provides a local-only HTTP interface for external tools or validation scripts to call:

  • GET /api/dsh-backup-migrator/probe: Liveness probe; returns the plugin status.
  • GET /api/dsh-backup-migrator/status: Read-only status endpoint; returns the current configuration and backup summary.

Use Cases and Notes

  • Environment migration: When you need to migrate your current DSH development environment to a new machine, this plugin is the best choice.
  • Version rollback: If plugin configuration conflicts or data corruption occurs, you can use Git history to quickly roll back to a previous state.
  • Security: If includeSecrets is enabled in the configuration, the backup repository must be private; otherwise, sensitive information will be exposed in a public repository.
  • File permissions: The configuration file is stored at ~/.dsh/dsh-backup-migrator.json; the runtime state is stored at ~/.dsh/dsh-backup-migrator-state.json (this file is not backed up).