@pandablessing/dsh-user-sync 1.0.3 → 1.0.5

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.
package/README.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  DeepSeek Harness(DSH)的**用户级配置同步插件**:把技能、插件清单、配置、记忆四类资产在设备间对齐。
4
4
 
5
- > 当前状态:**v1.0.3**(已发布 npm:`@pandablessing/dsh-user-sync`)。本机打包/应用、跨机上传/恢复、缺插件装回、自动检查均已实现并实测;服务端已部署(见 [部署文档](docs/deploy.md))。
5
+ > 当前状态:**v1.0.4**(已发布 npm:`@pandablessing/dsh-user-sync`)。本机打包/应用、跨机上传/恢复、缺插件装回、自动检查均已实现并实测;服务端已部署(见 [部署文档](docs/deploy.md))。
6
6
  > 设计依据:[docs/design.md](docs/design.md);测试用例:[docs/test-cases.md](docs/test-cases.md)。
7
7
 
8
8
  ## 功能
9
9
 
10
10
  - **四类用户级资产**:技能(`~/.agents/skills`)、插件清单(profile 声明)、配置(`cordis.patch.yml`)、用户记忆(`AGENTS.md` + `memories/` 根);项目记忆默认不选,会话不参与同步。
11
11
  - **新覆盖旧**:包级 `createdAt` 比较,不做合并;覆盖前必须确认,先快照再写盘,失败可整批还原。
12
+ - **上传前查远端**:远端已被别的设备更新时先拦下(`E_REMOTE_NEWER`),用户点「用本机覆盖远端」才覆盖。
12
13
  - **敏感数据硬拒绝**:文件名黑名单 + 内容模式,命中即拒绝打包并列出文件与行号。
13
14
  - **官方账号自动配对**:用 `deepseekAccount` 取账号 id 派生 `accountKey`,自动向服务端换 token,**没有运营方账号登录入口**。
14
15
  - **缺插件自动装回**:覆盖确认里列出缺失 bundle,一键 `installBundle`;`link:` 本地包列入手工清单。
@@ -23,6 +24,12 @@ cd ~/.dsh/profiles/desktop
23
24
  pnpm add @pandablessing/dsh-user-sync
24
25
  ```
25
26
 
27
+ macOS / Linux 用同一组命令(`cd ~/.dsh/profiles/desktop && pnpm add @pandablessing/dsh-user-sync`);profile 的 `package.json` 与 `cordis.patch.yml` 里必须写 npm 包名 `@pandablessing/dsh-user-sync`(见 [v1.0.2 修复](CHANGELOG.md))。
28
+
29
+ > **升级/安装前先清旧条目**:如果 profile 里还留着旧名 `dsh-user-sync` 的 junction、`dependencies` 或 bundles 条目,先删掉再装。旧名与新名会各自注册一次 client bundle,同一面板 id 冲突——1.0.4 遇到这种情况会直接把 `web boot` 打挂(`duplicate factory registration`),1.0.5 起只是多一条 warn,但画面上会出现两个「设置同步」。
30
+ >
31
+ > 建议顺序:① 备份 `~/.dsh/profiles/desktop/{package.json,cordis.patch.yml}`;② 移除旧名条目;③ `pnpm add @pandablessing/dsh-user-sync@1.0.5`;④ 在 profile 的 `dsh.profile.bundles` 里确认只出现一次 `@pandablessing/dsh-user-sync`;⑤ 重启 DSH。
32
+
26
33
  安装后在 DSH 设置页启用「设置同步」。
27
34
 
28
35
  ### 开发期(junction 到本仓库)
@@ -41,10 +48,10 @@ scripts\uninstall-dev.cmd # 双击即可
41
48
 
42
49
  1. 设置 → 设置同步 → 首次点「同意并启用上传」(说明上传范围与存储位置);
43
50
  2. 勾选同步范围(默认四类用户级);
44
- 3. 「上传用户配置」→ 打包并上传;
51
+ 3. 「上传用户配置」→ 打包并上传(远端更新时先确认再用本机覆盖);
45
52
  4. 「从远端同步」→ 检查远端,覆盖前确认。
46
53
 
47
- 服务地址默认内置(`https://dsh-user-sync-test.wenzhi.info`),传输固定走运营方 API,面板不再暴露这两项配置。
54
+ 服务地址默认内置(`https://dsh-user-sync-test.wenzhi.info`),传输固定走运营方 API;面板只读显示当前地址(`(内置)` / `(自定义)`),不提供输入框。需要改用自建服务时,在 `state.json` 写 `baseUrl` 即可覆盖。
48
55
 
49
56
  ## 服务端
50
57
 
@@ -71,13 +78,27 @@ pnpm install # 仅开发:安装 typescript 与 @types/node
71
78
  pnpm run build # 插件:src/*.ts → lib/*.js
72
79
  pnpm run build:server # 服务端:server/src/*.ts → server/dist/*.js
73
80
 
74
- node --test test/*.test.js # 137 条:单元 / 组件 / 时序(直接跑源码)
75
- node scripts/audit-cases.mjs # 用例清单与结果记录一致性审计(129/129)
81
+ node --test test/*.test.js # 154 条:单元 / 组件 / 时序(直接跑源码,macOS 全绿)
82
+ node scripts/audit-cases.mjs # 用例清单与结果记录一致性审计(149/149)
76
83
  node scripts/e2e-clone.mjs # 替代换机演练(默认本地模式,临时起服务端,不写真实 WebDAV)
77
84
  # node scripts/e2e-clone.mjs --remote https://dsh-user-sync-test.wenzhi.info # 真实服务端(会留测试目录)
78
85
  powershell -File scripts/smoke.ps1 # 真实 DSH 路由冒烟
79
86
  ```
80
87
 
88
+ ## 发布
89
+
90
+ token 只放本地文件,绝不进仓库(`.env.local` 已在 `.gitignore`):
91
+
92
+ ```bash
93
+ cp .env.local.example .env.local && chmod 600 .env.local # 填 NPM_TOKEN=(发布 token)
94
+ node scripts/publish.mjs --dry-run # 先看打包内容(24 个文件)
95
+ node scripts/publish.mjs --otp=123456 # 账号开 2FA 时带当次验证码
96
+ ```
97
+
98
+ - 脚本把 token 写进 `0600` 的临时 npmrc,发布结束立即删除;token 不出现在命令行参数、日志与 git 历史里。
99
+ - CI 用 secret 注入 `NPM_TOKEN` 环境变量即可,优先级高于 `.env.local`。
100
+ - 发布前记得先 `pnpm run build && pnpm run build:server`,产物与源码不一致时 tarball 里会是旧代码。
101
+
81
102
  ## 仓库结构
82
103
 
83
104
  ```text
@@ -86,17 +107,17 @@ docs/test-cases.md 测试用例清单(结果单独放 docs/test-results/
86
107
  docs/deploy.md 服务端部署与验证
87
108
  lib/ 插件(宿主 + client + 传输 + 同步编排)
88
109
  server/ 运营方 API(纯 node:http)
89
- scripts/ 开发安装 / 卸载 / 冒烟 / 替代换机
110
+ scripts/ 开发安装 / 卸载 / 冒烟 / 替代换机 / 发布
90
111
  test/ 单元、组件、时序测试与 fixtures
91
112
  legacy/ 需求反馈稿与原型脚本
92
113
  ```
93
114
 
94
115
  ## 已知限制
95
116
 
96
- - 未在 macOS/Linux 实机验证;跨平台哈希由单测(HASH-01/06)覆盖。
117
+ - macOS 上单测已全绿(Node 22.23.3),但 DSH 桌面端整机闭环只在 Windows 实测过;Linux 未验证。
97
118
  - 服务端单节点,未做限流与多副本;坚果云单账号有流量配额限制。
98
119
  - `link:` 本地依赖需要手工放回目标机。
99
- - 远端只保留 1 份包,上传即覆盖(回滚靠本地 `pre-restore` 快照)。
120
+ - 远端只保留 1 份包,上传即覆盖(回滚靠本地 `pre-restore` 快照;每次应用生成独立快照目录)。
100
121
 
101
122
  ## License
102
123