Preface¶
The DSH philosophy is “Everything is a Plugin.” When developing agents, developers often rely on local plugins to extend functionality, and these plugins frequently contain custom dependencies and link configurations. When switching computers or reinstalling the system, simply copying settings files often fails to restore a complete development environment because local plugins and their dependency relationships are easily lost.
This plugin solves the aforementioned pain points. It provides a complete backup and restoration mechanism capable of packaging settings, credentials, skills, presets, and local plugins into a ZIP file. When needed, the environment can be restored to its original directory structure.
Features and Characteristics¶
The plugin’s main functions revolve around “Discovery,” “Packaging,” and “Restoration”:
- Discover Local Plugins: The plugin not only reads the
package.jsondependencies of the profile but also scansnode_modulessymlinks/junctions, as well as local bundles pointed to bydsh.profile.bundles, to generate a complete manifest. - Selective Packaging: After discovering plugins, a manifest is listed, supporting checkbox selection and “Select All” operations. The interface displays the discovered count, packable count, and selected count in real-time.
- Plugins as First-Class Citizens: Each local plugin, along with its production runtime dependencies, is packaged into the archive, and the manifest records the complete link topology.
- Restore to Original Location: During restoration, priority is given to restoring to the original absolute directory recorded in the backup; if the original directory does not exist, it automatically falls back to
$DSH_HOME/plugins/<plugin-name>and synchronously rewrites the profile’s declarations and links. - Supplement Declarations: For plugins that exist only in
node_modulesbut are not declared,link:dependencies are automatically appended during restoration to prevent them from being deleted during the next installation. - Item-by-Item Verification: After restoration is complete, verification is performed on directories, entry files, and profile links, with results directly reflected on the settings page.
- Reversible Restoration: A snapshot is automatically taken before any restoration operation, making the restoration process itself reversible.
- Do Not Overwrite Updated Content: The system judges based on file system time; if a target file is newer than the archive and the content differs, it is skipped and the original file is preserved.
- Reliable Download for Large Backups: A 4MB chunked download mechanism is adopted to avoid download failures caused by excessively large single response bodies.
- Backup Record List: All backup files are listed on the settings page, supporting direct restoration or deletion.
Installation and Activation¶
Install via command line:
dsh plugin --profile desktop add github:hello-heyongping/dsh-helloai-bak
After installation is complete, enter the Settings page to see the “Backup and Restoration” option.
Usage¶
Backup
- Open Settings → Backup and Restoration;
- Check the plugins to be packaged in the “Local Plugins” list (packable items are checked by default);
- Click “Backup All Configurations” to generate and download a ZIP file;
- Backup files are saved by default in the
$DSH_HOME/backupsdirectory and also appear in the “Backup Records” below.
Restore
- Find the corresponding backup point in “Backup Records” and click “Restore”; or click “Restore from ZIP” to manually select a file when switching computers;
- The system will automatically take a snapshot before restoration to ensure reversibility;
- After restoration is complete, the interface will list the results for each plugin item by item (e.g., Restored, Preserved, Not Backup, Failed, etc.).
Notes¶
- Sensitive Information: Backup files contain sensitive credentials such as
.credentials.yaml. Please store and transmit them only via trusted channels. - Overwrite Rules: Restoration is an overall overwrite, but files newer than the backup are prioritized for preservation. If a forced overwrite is required, a corresponding button is provided on the interface.
- No Scope Selection: There is no scope selection for restoration operations; settings, credentials, skills, presets, and plugins will be restored together. If you only wish to restore partial content, you must manually revert after restoration.
- Directory Location: The backup directory is fixed at
$DSH_HOME/backupsand is currently not configurable. - ZIP Limitations: The classic ZIP format is used, with a maximum entry limit of 65535.
- Dangling Links: If a link in
node_modulespoints to a directory that has already been deleted, it cannot be packaged and can only be reported in the manifest.
Summary¶
By treating local plugins as first-class citizens, this plugin solves the configuration loss problem during DSH environment migration. Combined with snapshot mechanisms and a no-overwrite-updated strategy, it provides a reliable and secure backup experience.