前言¶
在 DSH 裏,插件狀態往往分散在 profile 的文件中:profiles/<profile>/package.json 的 dependencies 與 dsh.profile.bundles,以及 cordis.patch.yml。如果要把一套已安裝插件搬到另一個環境,手動複製這些文件容易漏項。
dsh-plugin-sync 做的事情比較直接:把當前 profile 的插件清單同步到 GitHub Gist,再在目標環境導入並執行 pnpm install。
這是什麼¶
dsh-plugin-sync 是一個 DSH 插件,由 AngLi1997 維護,許可證爲 MIT。它把當前 profile 的插件清單整理爲 dsh-plugins.json,通過 GitHub Gist 做導出和導入。
安裝後,可以在 dsh-market 中查看。
核心功能¶
GitHub 登錄¶
使用 GitHub OAuth 設備流快捷登錄,無需手動粘貼 token。
GitHub 授權僅需 gist 權限。
導出¶
將 profiles/<profile>/package.json 的 dependencies、dsh.profile.bundles 和 cordis.patch.yml 打包爲 dsh-plugins.json,上傳到 Gist。
導入¶
從 Gist 讀取插件清單,寫回 package.json / cordis.patch.yml,並自動執行 pnpm install。
導入完成後,會提示重啓 Harness 生效。
Gist 創建¶
未指定 Gist 地址時,會創建名爲 dsh_plugin_sync_XXXX 的私有 Gist。
安裝與啓用¶
使用 DSH 插件命令安裝:
dsh plugin --profile web add dsh-plugin-sync
安裝後,可以在 dsh-market 中查看。
也可以手動編輯 profile 的 package.json,把 dsh-plugin-sync 加入 dependencies 與 dsh.profile.bundles,然後執行:
pnpm install
執行後重啓 Harness。
典型用法¶
1、打開設置 →「插件同步」
2、點「登錄 GitHub」,按提示跳轉 GitHub 授權,僅需 gist 權限
3、點「導出到 Gist」上傳插件清單;如果未填 Gist 地址,會創建 dsh_plugin_sync_XXXX 私有 Gist
4、點「從 Gist 導入」,填寫 Gist 地址後自動安裝,並提示重啓 Harness
適用場景與注意¶
- 適合需要在不同機器或不同開發環境之間同步 DSH 插件清單的場景。
- 該插件以當前
dsh進程權限運行;安裝前應檢查源碼、許可證與依賴。該插件許可證爲 MIT。 - 導入流程會自動執行
pnpm install,執行前建議確認 Gist 內容可信。 - 依賴處理上,
@deepseek-ai/*與react保持外部依賴,zod打包進產物;package.json中peerDependencies的@deepseek-ai/*與react均標記爲 optional。
結尾¶
dsh-plugin-sync 的價值在於把 profile 插件清單的同步變成一個可重複的導出/導入流程,而不是手動複製 JSON 和 patch 文件。
安裝後可在 DSH 社區目錄 / dsh-market 中查看;GitHub 倉庫地址:dsh-plugin-sync。