Introduction¶
The DSH ecosystem emphasizes plugin extensibility, but in real-world use, keeping context, session logs, and workspace files consistent across multiple devices is often difficult. The dsh-git-sync plugin solves the bidirectional synchronization problem for workspace conversations and files through Git. It supports two modes: session-only synchronization and full synchronization, and reserves central-repository binding for preset/plugin manifest synchronization.
Plugin Overview¶
This plugin is maintained by community developer dHR-P and is released under the MIT license. It uses a Git repository as central storage to synchronize DSH workspace data (conversations and files) across multiple devices, and is compatible with the official DSH plugin specification.
Core Features¶
- Settings and Configuration: Provides a settings card in “Settings → Plugin Configuration,” supports binding a central repository, and allows configuring a separate synchronization scheme for each workspace.
- Dual-mode Sync:
- Session-only Mode: Synchronizes only session logs under
~/.dsh/sessions/to a dedicated directory in the repository without touching local workspace files. - All-files Mode: Performs repository-wide synchronization using
git add -A, which is suitable for resuming development workspaces across devices. - Cross-device Path Independence: In session-only mode, logical names are used to map session directories, so synchronization does not depend on local absolute paths. After a new device pulls the data, path information in session headers is automatically rewritten to match the local environment.
- New-device Onboarding: Supports one-click onboarding for new devices via the “Clone Workspace” feature, automatically completing repository cloning, session registration, and path rewriting.
- Credential Security: Reuses system Git credentials (SSH key / PAT, etc.); the plugin itself does not store any secrets.
Installation and Enablement¶
Run the following command in your terminal to install the plugin:
dsh plugin --profile web add "github:dHR-P/dsh-git-sync"
After installation, restart the dsh web process. You can then find the “Git Sync” card in the “Plugin Configuration” section of the “Settings” page.
Typical Usage¶
- Go to “Settings → Plugin Configuration → Git Sync.”
- Configure a synchronization scheme for each workspace:
- Select the sync mode (session-only or all-files).
- Enter the remote repository URL.
- (Optional) Enter a logical name to customize the cross-device mirror directory. - Perform synchronization operations:
- Click “Push” to upload local sessions or files.
- Click “Pull” to download remote contents. - Note: In session-only mode, you must restart DSH after pulling for newly pulled sessions to appear in the sidebar.
New Device Onboarding¶
To use it on a new device:
- Install the plugin and log in to GitHub.
- Go to “Settings → Git Sync.”
- Click “New Device: Clone Workspace.”
- Enter the local target path (it must be empty or non-existent) and select the corresponding remote repository.
- The plugin will automatically clone the repository, register the workspace, pull sessions, and rewrite paths.
- After restarting DSH, the sessions will appear in the sidebar.
Notes¶
- Private Repositories: Because sessions may contain sensitive information, it is recommended to set the remote repository as private.
- Concurrency Control: Only one device should resume the same workspace at a time to avoid session-file conflicts.
- Path Dependency:
- Session-only mode: fully path-independent and relies on logical names.
- All-files mode: synchronizes according to Git relative paths.
- Session Storage: Session files are stored by default in the
~/.dsh/sessions/<projectKey(cwd)>/directory and are automatically scanned and discovered when DSH starts.
Summary¶
The dsh-git-sync plugin provides DSH with a standard Git-based synchronization solution. It is suitable for developers who need to keep their work context consistent across multiple devices. For more details, see the GitHub repository.