説明
以下はプラグイン作者による原文です。
dsh-home-sync
English | 简体中文
Keeps a DSH home directory — its configuration files and Mnemon memory data — in a Git repository you control, so several machines can share one setup; the web panel pulls, commits and pushes, and initialization backs up the local state before anything is replaced.
Status and support
- Status: maintained.
- Supported: DSH web profiles that provide the
webServer,timerandconnection.requestRejectionhost services, on Node.js 20 or newer with Git, with a Git remote you can reach. - Not supported: hosts or profiles that do not expose those services; the ACP, headless and SDK profiles are untested.
- Local verification used DSH 0.1.2-rc.1, Node.js 24.20.0 and Git 2.55.0.windows.4. Other DSH releases have not been verified.
- Current version: see the tags or the npm badge above; this file does not pin a version.
- Earlier review reports are local internal material and are not distributed with this repository.
test/andnpm testare the public verification entry points.
Requirements
- Node.js 20 or newer.
- Git on
PATH. - A DSH host providing
webServer,timer, andconnection.requestRejection.
Installation
npm (recommended)
sole plugin --profile web add dsh-home-sync
Restart DSH web and refresh the browser. The published package needs no build step and has no third-party runtime dependencies.
Success signal: after the restart the sync button is visible in the web UI, and opening it shows the panel with the current branch and status.
From GitHub
sole plugin --profile web add github:OverDustD7/dsh-home-sync
From a local checkout
sole plugin --profile web add link:{{CHECKOUT_PATH}}
{{CHECKOUT_PATH}} is the source directory on your own machine. A link: install reads that directory directly: restart DSH web after backend changes and refresh the browser after UI changes.
Offline devices
npm pack --pack-destination dist
Copy the archive to the target machine and run this from the directory that holds it:
sole plugin --profile web add ./dsh-home-sync-{{VERSION}}.tgz
If the package manager cannot install a local tarball, extract the archive into a permanent directory and install its package subdirectory with link:. Do not use a temporary extraction directory as a permanent link target.
Quick start
- Open the panel from the sync button. It shows the current branch, uncommitted files, commits to push or pull, and the last operation result. The web interface currently uses Chinese labels.
- Set the branch, the automatic-sync switches and the interval, then save. Settings live at
<DSH_HOME>/dsh-home-sync.json. - Run the pull action to fast-forward the local repository to the remote.
- Run the sync action to commit the allowed local changes, integrate remote changes, and push.
Seeing the operation toast report success and the status row settle to no pending commit, push or pull means the round completed. A non-zero count that comes back after a successful round means new local files appeared or the remote moved again.
Configuration, data and permissions
Data and permission summary:
- Read: only the files on the allowlist below, from the DSH home directory.
- Written: commits in the home Git repository,
<DSH_HOME>/dsh-home-sync.json,<DSH_HOME>.home-sync-history.json,<DSH_HOME>.home-sync-lock, and initialization backups under<DSH_HOME>.home-sync-backups/. - Collected: nothing. No telemetry, no service calls; the only network traffic is the Git operations against the remotes you configure.
- Permissions: read and write inside the DSH home and the paths beside it, and the ability to run
gitas a subprocess. Every HTTP endpoint uses the host's authentication plus Host/Origin validation; withoutconnection.requestRejectionthe plugin does not activate. POST accepts JSON only, and the UI script carries no user data. - Excluded from commits: credentials, sessions, attachments,
node_modules. A forbidden file that is already staged or tracked blocks synchronization.
Settings
| Setting | Purpose or constraint |
|---|---|
branch | Synchronization branch |
autoPullOnStartup | Pull when the plugin starts |
autoSync | Run periodic full synchronization |
syncIntervalSeconds | Integer from 15 to 86,400 |
commitMessage | Commit message, 1–1,000 characters |
sshBatch | Use SSH batch mode |
The legacy autoSyncOnStartup setting migrates to autoSync; when both exist, autoSync wins.
A damaged configuration does not fall back to defaults and does not switch automatic tasks on. Repair or restore the JSON file and restart DSH. Configuration writes flush a temporary file before replacing the original, and initialization keeps a separate configuration backup.
Files included in synchronization
.gitignore,settings.yaml, and the rootcordis.patch.yml.- Under
profiles/web/:package.json,pnpm-lock.yaml,pnpm-workspace.yaml,cordis.yml,cordis.patch.yml, and.dsh-market/state.json. - Non-hidden files under
mnemon/, excluding path components nameddata,state,credential,credentials,secret, orsecrets, and files ending in.log,.wal, or.shm.
Publish audit
Before pushing, the plugin audits the commits it is about to publish and their trees, up to 1,000 commits. When the only push destination is also the fetch remote, it audits just the range from that remote's tracking ref to HEAD, because the earlier ancestors already live in that repository. As soon as an extra push destination is configured — one that may never have received that history — it falls back to auditing the full history reachable from HEAD, and it also falls back when no tracking ref exists yet. A forbidden file anywhere in the audited set blocks the push even if it was deleted later. A set beyond the limit must first be organized into a clean history by hand.
Pushes update only the selected branch; tags and other references are not followed automatically. Pushes to several repositories are not one transaction, so a partial network failure needs a retry. The plugin does not redact fields inside allowed files, so do not put content you do not want uploaded into synchronized configuration or memory files.
Operation lock
The cross-process lock directory is <DSH_HOME>.home-sync-lock. Its owner.json records the owner pid and start time and doubles as the heartbeat. A lock left behind by a killed process or an abrupt shutdown is taken over automatically: when the owner information is missing or corrupt, the owning process no longer exists, or the heartbeat has not refreshed for 15 minutes, the old lock is renamed to <DSH_HOME>.home-sync-lock.stale-<timestamp> and the operation proceeds, reporting the takeover in its message. A fresh lock held by a live process still returns busy. Recover an unfinished initialization from its backup first.
Device initialization and backups
Both initialization modes back up first. merge means back up, reset, then merge manually; it does not combine two sets of memories for you.
- Fetch the remote into an independent temporary repository and validate target paths and file types.
- Check local path collisions and back up every file that may be overwritten or removed, the original Git metadata, and the plugin configuration.
- Verify that local files did not change during the backup, apply the allowed files, and configure the target branch, origin and upstream.
- Pause automatic sync and startup pull after success, so you can inspect the result, merge anything you need by hand, and switch automation back on.
Initialization supports a new directory, an independent repository initialized with git init but without a first commit, and switching an existing setup to a remote with unrelated history. A successful response returns the actual configuration and the UI refreshes the automatic switches immediately. Initialization is an explicit reset of the settings, so the current form is replaced with the server-side configuration.
Backups are stored beside the DSH home at <DSH_HOME>.home-sync-backups/init-*, outside the synchronized working tree. With the default home directory this looks like ~/.dsh.home-sync-backups/init-*.
| Backup entry | Contents |
|---|---|
files/ | Original files |
repository/ | Original .git, including local history, index and remote configuration |
config.json | Original plugin configuration, when it existed |
manifest.json | Target, operation state, original file existence and checksums |
MERGE.md | Recovery instructions |
A caught execution error triggers an attempt to restore the original state. Recovery cannot be guaranteed after a power failure or a forced termination: stop DSH, restore the files according to the manifest, put repository/ back as .git, restore the original configuration, and remove the files the manifest marks as originally absent. Do not restore while DSH is writing memory data. Initialization explicitly rejects Git worktrees and linked .git entries. Other programs must also stay away from the synchronized files during initialization: the plugin lock coordinates its own instances only, not other plugins or manual Git commands.
Upgrade and uninstall
Upgrade: run the npm install command again, then restart DSH web. Settings, operation history, backups and the synchronized Git repository are preserved.
Uninstall: remove dsh-home-sync from the web profile's dependencies — for example sole plugin --profile web remove dsh-home-sync — and restart DSH web. Nothing else is removed automatically: <DSH_HOME>/dsh-home-sync.json, <DSH_HOME>.home-sync-history.json, <DSH_HOME>.home-sync-lock and <DSH_HOME>.home-sync-backups/ stay until you delete them, and the home Git repository is left as it is.
Limitations and troubleshooting
- A content conflict stops the operation before pushing, aborts the unfinished merge and keeps local commits. Resolve the conflict manually and retry; the plugin never force-pushes.
- A tracking ref (
refs/dsh-home-sync/branches/<branch>) left corrupt by a killed host is repaired on the next sync: the broken ref file is deleted and the remote fetched again, with the takeover reported in the operation message. - A damaged configuration pauses the automatic tasks instead of falling back to defaults: while it stays unreadable no schedule is registered, and an operation that reads it fails with
config-corrupt. Repair or restore the JSON file, then restart DSH. - A lock held by a dead process is taken over after at most 15 minutes without a heartbeat. A live holder still answers busy — wait for that operation to finish.
- Only ordinary files are accepted: symbolic links, hard links, submodules, paths outside the home directory, Windows reserved names and case collisions are rejected. Git hooks and commit signing still follow your Git configuration, and Git subprocesses use timeouts and non-interactive credential settings.
- A push history deeper than 1,000 audited commits blocks publishing until it is organized by hand.
- The audited set covers files, not field-level content; a value you committed is published as committed.
Common errors:
| Symptom | Cause | Fix |
|---|---|---|
| No sync button after installation | DSH web was not restarted, or the host does not provide the required services | Check the host services, restart DSH web, refresh the browser |
| Status reports a read failure | The home directory is not a Git repository with a remote yet | Run device initialization and choose the target branch |
| An operation returns busy | Another synchronization or a configuration write is running | Wait for it to finish; stale locks are taken over automatically |
| HTTP endpoints return 401 | The request carries no authenticated host session | Open the panel from the DSH web UI instead of calling the endpoints directly |
Development
npm run check
npm test
npm run check validates the syntax of the three library modules and the README text and language links (scripts/check-docs.mjs); the same documentation check runs in the npm packaging lifecycle, so do not use --ignore-scripts when packing. Save documentation as UTF-8; scripts that edit it must specify UTF-8 for both reading and writing instead of relying on a system code page.
Tests use system temporary directories, synthetic files and local Git remotes; they do not touch a real DSH home or real accounts. Test repositories stay in the temporary directory for diagnosis. Browser tests use a separate temporary Chrome or Edge profile and are skipped when no supported browser is found; set CHROME_PATH to pick one. Host compatibility tests run only when DSH_HOST_MODULES names an installed DSH node_modules/@deepseek-ai directory, and are skipped otherwise. They build a stubbed host instance and a synthetic identity cookie, and were written against DSH 0.1.2-rc.1; a newer host may not match that stub.
Feedback and security
- Issues: https://github.com/OverDustD7/dsh-home-sync/issues
- Security: no private security channel is currently offered. Do not put credentials, tokens or personal data in a public issue; describe the affected version and file without reproducing the secret.
License and third-party notices
License: MIT, see LICENSE.
Third-party components: none. The package has no runtime dependencies.
バージョン履歴
- 0.2.102026/11/29 · 49 KB