dsh-selfupdater 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -151,7 +151,7 @@ const lockFile = join(dshStateDir, 'pluginupdate.lock');
151
151
  const stagingDir = join(dshStateDir, 'pluginupdate-staging');
152
152
  const profileDir = join(dshStateDir, 'profiles', PROFILE);
153
153
  /** 升级前的 profile 完整备份目录(失败回滚用;成功后保留一次供排查)。 */
154
- const bakProfileDir = join(dshStateDir, `profiles.${PROFILE}.pluginupdate-bak`);
154
+ const bakProfileDir = profileDir + '.pluginupdate-bak';
155
155
 
156
156
  /** 国内镜像优先的 registry 候选列表(与 index.js 的策略一致)。 */
157
157
  function registryCandidates() {
@@ -369,7 +369,9 @@ async function main() {
369
369
  setState('downloading', '正在备份当前插件目录 …');
370
370
  rmSync(bakProfileDir, { recursive: true, force: true });
371
371
  renameSync(profileDir, bakProfileDir);
372
- renameSync(bakProfileDir, profileDir); // 立刻放回原位:备份改用复制,避免长时间缺位
372
+ // 注意:不再立即还原备份!备份目录需要保留到更新成功完成,
373
+ // 这样如果更新失败,rollback() 函数才能从备份恢复。
374
+ mkdirSync(profileDir, { recursive: true });
373
375
  mkdirSync(stagingDir, { recursive: true });
374
376
 
375
377
  // 阶段三:逐个下载 tgz 并离线安装;任一失败立即整体回滚。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-selfupdater",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Self-update plugin for DeepSeek Harness: check npm for newer @deepseek-ai/dsh, swap node_modules atomically, restart, health-check and roll back on failure; also supports one-click online update of installed DSH plugins. DSH 主程序与已装插件的一站式在线更新插件。",
5
5
  "license": "MIT",
6
6
  "type": "module",