lire1131/dsh-undo-savepoint 预览 preview

lire1131/dsh-undo-savepoint

插件Plugin ⭐ 105 MIT web-ui

DSH crash-rescue plugin: undo config & plugin-code changes, secret-safe snapshots, one-click SAFE MODE, plus offline CLI/GUI that work even when DSH won't boot.

编辑导读Editor's Brief

## 核心特性
- 该插件会记录 DSH 启动关键配置文件和用户插件代码树的快照,支持通过 WebUI、聊天或离线 CLI 入口撤销、重做以及恢复到任意已保存版本。
- 快照创建可在配置或插件变更后自动触发,也可从面板或 CLI 手动触发;当包清单或锁文件受到影响时,恢复的版本可选择使用 pnpm install 重建依赖。
- .env 和凭据文件中的敏感值会在快照导出中被遮蔽,而真实值仍保留在本地 vault 中,使本地回滚能够恢复完整数据,同时不在导出的 ZIP 文件中暴露密钥。
- 当 DSH 无法启动时,安全模式会禁用除 undo 系统外的所有插件,创建自动快照和配置备份,并支持一键退出,同时处理 profile 和 home 级别的 patch 备份。
- 离线恢复工具包括 GUI 窗口、PowerShell CLI 命令和桌面快捷方式创建脚本,在 DSH 未运行时提供撤销、恢复、安全模式、崩溃横幅和回滚日志的访问能力。

## 使用场景
- 当配置变更或插件修改导致 DSH 无法启动时,安全模式入口或离线管理器可以恢复到先前状态并重新启动环境。
- 当用户插件代码树因编辑而损坏(包括 yield* 代码意外)时,快照可以恢复受影响文件,而无需手动重新安装或丢失会话。
- 在机器之间迁移快照时,导出和导入 ZIP 工作流以及恢复前的缺失插件检查会在恢复继续前识别依赖。

## 技术细节
- 宿主插件通过 createRequire 从 DSH 安装根目录加载 @deepseek-ai/dsh-tools,并可使用 DSH_ROOT 进行覆盖,避免在仓库本地安装依赖。
- 快照存储在可配置的根目录下区分手动库和自动库,保留最近 20 条自动条目,并在启动时将旧版扁平布局迁移到新版结构。
- 多 profile 支持从 DSH 启动参数推导当前激活的 profile,按 profile 隔离快照仓库,并允许离线工具使用 DSH_UNDO_PROFILE 或基于设置的 profile 名称。
- REST API 为 WebUI 暴露 status、list、settings、undo、redo、restore、remove、snapshot 和 directory-picker 端点,并为恢复操作提供可选的依赖同步标志。

## 注意事项
- 该插件需要已安装的 DSH 环境和 Node.js 20 或更高版本;本地安装说明包括通过 GitHub 添加插件,或手动克隆并使用 junction 和 patch-file 挂载。
- 快照包含可能含有密钥的配置副本,因此即使导出会遮蔽敏感值,也不应将快照目录和导出内容对外分享。
- 每个被引用快照的大小限制为 5 MB,超大的插件代码树会被标记为截断清单,并带有

## Core Features
- The plugin records snapshots of DSH startup-critical configuration files and user plugin code trees, supporting undo, redo, and restoration to any saved version through WebUI, chat, or offline CLI entry points.
- Snapshot creation can be triggered automatically after configuration or plugin changes, manually from the panel or CLI, and restored versions can optionally rebuild dependencies using pnpm install when package manifests or lockfiles are affected.
- Sensitive values in .env and credential files are masked in snapshot exports while real values remain in a local vault, allowing local rollback to restore complete data without exposing secrets in exported ZIP files.
- A safe mode disables all plugins except the undo system when DSH cannot start, creates an automatic snapshot and configuration backup, and supports one-click exit with profile and home-level patch backup handling.
- Offline recovery tools include a GUI window, PowerShell CLI commands, and a desktop shortcut creation script, providing access to undo, restore, safe mode, crash banners, and rollback logs when DSH is not running.

## Use Cases
- When a configuration change or plugin modification prevents DSH from starting, the safe mode entry or offline manager can restore a previous state and restart the environment.
- When a user plugin code tree is broken by edits, including yield* code accidents, a snapshot can restore the affected files without requiring manual reinstallation or session loss.
- When moving snapshots between machines, the export and import ZIP workflow and pre-restore missing-plugin checks identify dependencies before restoration proceeds.

## Technical Details
- The host plugin loads @deepseek-ai/dsh-tools through createRequire from the DSH installation root, with DSH_ROOT available as an override, avoiding repository-local dependency installation.
- Snapshot storage separates manual and automatic libraries under a configurable root, retains the most recent 20 automatic entries, and migrates legacy flat layouts into the newer structure at startup.
- Multi-profile support derives the active profile from DSH startup arguments, isolates snapshot repositories by profile, and allows offline tools to use DSH_UNDO_PROFILE or settings-based profile names.
- A REST API exposes status, list, settings, undo, redo, restore, remove, snapshot, and directory-picker endpoints for the WebUI, with optional dependency synchronization flags for restore operations.

## Notes
- The plugin requires an installed DSH environment and Node.js 20 or later, and local installation instructions include GitHub plugin addition or manual cloning with a junction and patch-file mount.
- Snapshots include configuration copies that may contain secrets, so snapshot directories and exports should not be shared externally even though exports mask sensitive values.
- Snapshot size is limited to 5 MB per referenced snapshot, and oversized plugin code trees are marked as truncated manifests, with

安装Install

dsh plugin --profile web add github:lire1131/dsh-undo-savepoint#master

lire1131/dsh-undo-savepoint 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

上一个 Prev dsh-agent-team-gui 下一个 Next dsh-undo-plugin