dsh-git-sync
通过 Git 仓库同步 DeepSeek Harness 的配置、历史数据和提示词。
默认同步以下内容(可通过 include 调整):
settings.yaml— Harness 设置AGENTS.md— 用户全局提示词/约定skills/— 自定义技能与提示词sessions/— 会话历史storages/— 本地存储数据cordis.patch.yml— 用户级补丁配置profiles/web/cordis.patch.yml、profiles/web/package.json— Web profile 配置
不会同步 .credentials.yaml 等凭据文件。
安装
在插件源码目录执行:
dsh plugin --profile web add .或从 GitHub 安装:
dsh plugin --profile web add github:shenmo7192/dsh-git-sync配置
安装后可在 ~/.dsh/profiles/web/cordis.patch.yml 中覆盖插件配置:
- id: git-sync
config:
repository: https://gitee.com/shenmo7192/dsh-sync.git
branch: main
syncOnStart: true
intervalMinutes: 60
autoPull: true
autoPush: true
include:
- settings.yaml
- AGENTS.md
- skills
- sessions
- storages
- cordis.patch.yml
- profiles/web/cordis.patch.yml
- profiles/web/package.json
- profiles/web/pnpm-lock.yaml
- profiles/web/pnpm-workspace.yaml
- profiles/web/cordis.yml
ignore:
- '**/node_modules/**'
- '.credentials.yaml'配置项
| 字段 | 说明 | 默认值 |
|---|---|---|
repository | Git 仓库地址 | https://gitee.com/shenmo7192/dsh-sync.git |
branch | 分支 | main |
dshHome | DSH 主目录 | $DSH_HOME 或 ~/.dsh |
localPath | 本地镜像仓库路径 | ~/.dsh-git-sync |
statePath | 同步状态文件路径 | ~/.dsh-git-sync-state.json |
syncOnStart | 启动时立即同步 | true |
intervalMinutes | 定时同步间隔(分钟),0 表示不定时 | 60 |
autoPull | 是否拉取远程更新 | true |
autoPush | 是否推送本地更新 | true |
include | 要同步的相对路径列表 | 见上文 |
ignore | 忽略模式 | 见上文 |
userName | Git 提交用户名 | shenmo |
userEmail | Git 提交邮箱 | shenmo@spark-app.store |
工作原理
插件会在本机维护一个 Git 镜像仓库,默认位于 ~/.dsh-git-sync:
1. 确保镜像仓库存在并切换到指定分支; 2. 读取本地同步状态(~/.dsh-git-sync-state.json); 3. 首次在已有远程数据的设备上运行时,采用远程版本并应用到 DSH 主目录; 4. 如果只有本地修改,则提交并推送到远程; 5. 如果远程和本地都有修改,先把本地修改提交到镜像,再变基合并远程;若发生冲突则本次同步失败,需手动解决镜像仓库中的冲突; 6. 将最终合并结果应用回 DSH 主目录; 7. 如果开启了 autoInstall,自动在 ~/.dsh/profiles/* 下执行 pnpm install,下载并安装同步过来的插件依赖。
> 注意:当前版本是面向个人多设备同步的轻量实现。如果多台设备同时修改同一文件,Git 合并冲突会导致本次同步失败,请手动解决镜像仓库中的冲突后再同步。