Skip to main content

dsh-undo-plugin

103Stars4Forks3Issues1Watchers

Provides undo/rollback system for DSH: automatic snapshots of configuration and plugin code; one-click undo via WebUI, chat interface, and offline tool; safe mode and GUI fallback when DSH fails to start.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
License
MIT
Branch
master
backupcrash-recoverydeepseek-harnessdshdsh-pluginpowershellrollbacksnapshot

Install

cmdweb profile
$ dsh plugin --profile web add github:lire1131/dsh-undo-plugin

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin lire1131/dsh-undo-plugin for me: review the repository at https://github.com/lire1131/dsh-undo-plugin first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Description

DSH's undo/rollback system that automatically archives configuration or plugin code changes, allowing one-click restoration after overwrite — covering three typical incidents: "accidentally modified a config", "plugin code broken", and "DSH won't start".

Core Features

  • Auto-archive config and plugin code: Debounced automatic snapshot generation after monitored config files or plugin code changes, no manual operation needed
  • Three-entry one-click undo/redo/rollback: WebUI header button, global shortcuts (Ctrl+Alt+Z / Ctrl+Alt+Y), tell AI to "undo last step", CLI/offline tool all available
  • Plugin code can also be rolled back: Even incidents like breaking plugin source code (e.g., a plugin throwing yield* is not async iterable) can be restored with one click, no reinstallation needed
  • Key redaction and local restore: .env / .credentials.yaml in snapshots automatically have values replaced with placeholders, real values stored in local vault; exported ZIP won't leak keys; complete restore during local rollback
  • One-click safe mode: When DSH won't start, disable all user plugins except the undo plugin, guaranteed to start; switchable via panel or CLI
  • Crash attribution: Last abnormal exit shows "last normal snapshot" id and one-click rollback button directly in WebUI/GUI banner, no guessing needed
  • Cross-machine migration: Snapshots can be exported/imported as ZIP; auto pre-check missing plugins before restore with clear "may not start" warnings
  • Offline rescue tool: PowerShell CLI + GUI window in plugin directory, usable even when DSH is completely down

Technical Implementation

  • Language: JavaScript (ESM, Node 20+) + client-side React (bundled into client.js) + offline PowerShell
  • Key Dependencies: @deepseek-ai/dsh-tools (provides defineTool, multi-anchor resolution via createRequire), node:fs (snapshots and watching), node:child_process (pnpm dependency sync, PowerShell file picker, ZIP export), react/react/jsx-runtime (WebUI header button + panel)
  • Architecture Pattern: Cordis dual-sided plugin — host side registers 8 defineTool and /api/undo/* REST routes and starts fs.watch debounced archiving; client side injects session header button slot, settings slot, and global keyboard events; offline PowerShell tools share lib/spec.json and snapshot repository with Node
  • Entry Files: lib/index.js (host apply / tool registration / REST), lib/client.js (React components and slot injection), cordis.patch.yml (plugin mount declaration)

Use Cases

  • User changed plugin code or config and worries about breaking it — default auto-archive on, undo is just one sentence
  • After installing/updating/uninstalling a plugin, DSH throws errors or behaves abnormally — rollback to pre-change state using snapshot, no need to manually find config files to rollback
  • A plugin caused DSH to not start at all — use GUI/CLI tool to enter safe mode to guarantee startup, then decide to restore or debug

Prerequisites and Compatibility

DependencyMinimum VersionNotes
DSHNo explicit lower bound (package.json engines.dsh: >=0.0.1)Runtime needs @deepseek-ai/dsh-tools to be resolvable
Node.js>=20.0.0Both host and client rely on ESM, Node built-in modules, and PowerShell 5.1/7
PlatformWindows / macOS / LinuxCore snapshot logic is cross-platform; offline CLI/GUI tools and one-click desktop shortcuts mainly target Windows (runPnative uses cmd.exe, .ps1/.bat tools)
Native ModulesNoneOnly depends on Node built-in modules and pnpm (for dependency sync)

Installation

dsh plugin --profile web add github:lire1131/dsh-undo-plugin

Configuration Options

ConfigTypeDescriptionDefault
Auto-save toggleBooleanWhen off, plugin changes no longer trigger auto-snapshot; manual save and undo still availableOn
Debounce windowMillisecondsHow long to wait after change before writing snapshot once; too small causes frequent archiving, too large loses granularity1500
Auto snapshot retention countIntegerMaximum number of auto-archived snapshots to keep; auto-cleanup when exceeded20
Undo snapshot retention countIntegerHow many "current state" snapshots (pre-restore) to keep10
Auto cleanupBooleanWhether to auto-delete old auto/undo snapshots when exceeding limit; when off, keep allOn
Manual snapshot directoryPathWhere manually saved snapshots are stored; separate from default path for external drives$DSH_HOME/undo-snapshots/manual
Auto snapshot directoryPathWhere auto-archives and undo snapshots are stored$DSH_HOME/undo-snapshots/auto
Sensitive moderedacted / plaintextIn redacted (default), .env / .credentials.yaml values are replaced with placeholders in snapshots; plaintext mode matches old version behaviorredacted
Plugin directory whitelistListIf empty, auto-discover junctions under node_modules; if explicitly filled, only snapshot specified directoriesEmpty

Configuration can be modified in WebUI settings page under "Snapshots" section, or directly edit $DSH_HOME/undo/settings.json; also supports programmatic injection via config block in cordis.patch.yml.

FAQ

Q: Don't see header button after installing plugin?

A: Need to restart DSH after installation to enter steady state. Installs to web profile by default, please confirm the command includes dsh plugin --profile web add .... On multi-profile machines, if using other profiles, need to change --profile to the corresponding name, otherwise the plugin will write to the web profile's snapshot repository.

Q: Will undo lose current changes?

A: No. Before each undo/rollback, the current state is first saved as an "undo snapshot" (pre-restore), so even if undo was wrong, you can use redo to restore; only after redo is consumed by new real changes will it be auto-cleaned.

Q: Will snapshots contain keys? Is exporting ZIP safe?

A: Default sensitive mode is "redacted": .env / .credentials.yaml values are replaced with placeholders in snapshots, real values stored in local vault (only restored during local rollback). Exported ZIP in redaction mode contains no real keys; if switched to "plaintext" mode or exporting old snapshots, exported files will contain real values with prominent warnings.

Q: Can it still be used when DSH won't start at all?

A: Yes. The installation directory's tools\ has offline CLI (dsh-undo-savepoint.ps1) and GUI window (dsh-undo-savepoint-gui.ps1), usable even when DSH process is not running. In the most extreme case, you can first enable "safe mode" to keep only the undo plugin, then restart DSH and it will definitely start.

Q: What to do for cross-machine migration of snapshots?

A: Click "Export" in snapshot panel on machine A to get ZIP; first install all plugins used by A on machine B, then import ZIP. Cross-machine pre-check is done during restore, missing plugins will be clearly warned, unmounted plugin directories won't be written.

Q: Does undo involving plugin code changes require restart?

A: Yes. When undo/rollback involves cordis.patch.yml, profile/package.json or plugin code, the report will show "effective after DSH restart" prompt; pure .env or config value changes generally don't need restart.

Q: Will auto-snapshots pile up infinitely?

A: No. Settings allow configuring auto snapshot retention count (default 20) and undo snapshot retention count (default 10), auto-cleanup when exceeding limit; manually saved snapshots are never auto-cleared.

Q: Should I include #master in the install command?

A: The current install command is dsh plugin --profile web add github:lire1131/dsh-undo-plugin, DSH will fetch the default branch. If you want to lock version, explicitly add #master or a tag.

Difficulty Level

Beginner — install and use immediately, default config covers common scenarios; only enter settings page or offline tools when DSH won't start or you want to fine-tune retention counts.

Known Issues and Limitations

  • Single snapshot reference volume limit 5MB; when exceeded, plugin code tree only records list with truncated marker, no data loss (manual snapshot/export can still backup) — lib/index.js:170 / lib/index.js:392-394
  • When undo/rollback involves package.json / pnpm-lock.yaml, default only reports node_modules out of sync, won't auto-run pnpm install; need to explicitly pass sync_deps: true (use -SyncDeps in CLI), and dependency sync failure won't rollback already restored config files — lib/index.js:932-959 / CHANGELOG.md:33
  • Offline CLI/GUI tools mainly target Windows PowerShell 5.1/7; macOS/Linux host part available, but one-click desktop shortcuts and GUI windows need manual adaptation to use local terminal — .github/workflows/ci.yml:7-9 / CHANGELOG.md:45
  • During cross-machine restore, if target snapshot references plugins not installed on the target machine, MODULE_NOT_FOUND startup error will occur; plugin does pre-check warnings but won't auto-skip missing mounts — docs/migration.md:23-49 / lib/index.js:560-589
  • On Windows, fs.watch asynchronously throws EPERM when watched directory is deleted/renamed; plugin has error handler mounted to avoid crashing process, but that watcher will be silently removed — lib/index.js:2093-2101
  • DSH service API calls wrap each item in try/catch degradation (rc8 compatibility cap): single service failure won't interrupt apply, but corresponding capability will be missing — lib/index.js:1700-1714

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/lire1131/dsh-undo-plugin)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory