前言¶
在 DeepSeek Harness(DSH)裏做完一輪改動,目錄還在本機,若要把同一套樹建成 GitHub 倉庫並完成首次提交與推送,通常要在終端裏依次 git init、配置 remote、gh repo create、再 push。步驟不多,但會打斷當前會話節奏。
下面介紹的 dsh-publish-github 把整條鏈路收成一條斜槓命令:在 Composer 裏指定本地路徑,由插件按序執行初始化、暫存、提交與推送(或創建遠程倉庫),並在會話裏用 ✓/✗ 逐行回報每一步。插件歸類爲 DSH 社區目錄中的「聯網工具」,維護者爲 lucyVan;倉庫見 GitHub,目錄頁見 SkillHub。社區目錄爲獨立站點,與 DeepSeek / 幻方無官方從屬關係。
這是什麼¶
dsh-publish-github 是面向 DeepSeek Harness 的 GitHub 發佈插件。它通過宿主提供的 ctx.commands.register 註冊 /publish,不依賴打包在 Electron app.asar 內的 @deepseek-ai/* 包,因此以磁盤掛載方式安裝後即可使用。當前版本 0.1.0,許可證 MIT;engines 要求 Node >= 22,DSH >=0.2.2-rc.1 <0.3.0-0(資料記載在 0.2.2-rc.1 上驗證過)。
核心功能¶
一條命令覆蓋從本地目錄到 GitHub 的首次發佈流程:
/publish <dir> → git init(如需要)→ git add -A → commit(首次提交)
→ 已有 origin → push;否則 → gh repo create --source . --push
設計上強調安全邊界:
- 拒絕 force-push、刪分支、reset 歷史等危險操作措辭;
- 遠程
origin已存在時只做普通push,不會重建 remote; - 子進程環境中剝離
DSH_*變量,避免 Harness 配置傳入gh; - 允許發佈用戶顯式指定的任意目錄(路徑即授權範圍)。
可選參數(摘自 README):
| Flag | 作用 |
|---|---|
--private |
創建私有倉庫(默認公開) |
--name <repo> |
倉庫名(默認取目錄 basename) |
--message "<msg>" |
提交說明 / 倉庫描述(默認 Publish <repo>) |
--author <name> |
首次提交作者名(默認 git 配置) |
--email <addr> |
首次提交作者郵箱(默認 git 配置) |
已知限制:僅提供 /publish,無設置頁;只面向 GitHub,不發佈 npm;遠程已有不相關歷史時推送失敗且原樣回報錯誤,不做衝突合併。
安裝與啓用¶
插件聲明瞭 dsh.bundle,通過 dsh plugin add 會以 profile 層自動註冊,無需手改 patch。
從 GitHub 安裝(資料原文命令):
dsh plugin --profile desktop add github:lucyVan/dsh-publish-github
本地 checkout 安裝:
dsh plugin --profile desktop add /absolute/path/to/dsh-publish-github
安裝後需重啓 DSH。完成 GitHub 授權任選其一:
- 安裝 GitHub CLI 並登錄:
# macOS
brew install gh
# Windows (PowerShell / winget)
winget install --id GitHub.cli
# Linux (Debian/Ubuntu)
sudo apt install gh
# 各平臺相同
gh auth login
- 或在 DSH credentials 中保存
GITHUB_TOKEN;插件會將其作爲GH_TOKEN注入gh子進程,從而可不依賴gh auth login。
卸載:
dsh plugin --profile desktop remove dsh-publish-github
然後重啓 DSH。
若 DSH 升級後超出 engines.dsh 窗口,安裝可能被拒絕;README 說明可用 dsh plugin --profile <name> allow-version ... --accept-risk 嘗試未驗證宿主,並建議先備份工作區。
典型用法¶
在 Composer 中指定要發佈的目錄:
/publish /path/to/your/project
路徑含空格時加引號;Windows 與 Unix 路徑寫法 README 均有示例:
/publish "C:\Users\me\My Projects" --private
/publish "/Users/me/My Projects" --name my-project
組合私有倉庫、自定義倉庫名與說明:
/publish ~/IdeaProjects/my-plugin --private --name best-plugin --message "My first DSH plugin"
依賴項:git 與 gh 均須在 PATH 上;README 記載 macOS 上測過,Windows 未測但已實現多種 gh 可執行名探測與引號路徑處理。
適用場景與注意¶
適合:在 DSH 桌面 profile 中快速把插件原型、腳本目錄或小型項目首次推到 GitHub,且希望步驟可視、默認不做破壞性 git 操作的用戶。
注意:
- 插件代碼在 DSH 進程權限下運行;安裝前應閱讀 倉庫源碼 與 MIT 許可證,確認行爲符合預期。
- 首次提交的默認作者爲
DSH <dsh@localhost>(README 註明,可事後 amend);也可用--author/--email覆蓋。 - 僅 GitHub;不與 npm 發佈混用。
- 社區目錄當前星標爲 0,不代表質量結論,僅以文檔與倉庫聲明爲準。
結尾¶
經過上面的步驟,你可以在不大開終端編排的情況下,用 /publish 完成「初始化 → 提交 → 建庫或推送」。進一步細節以 README 爲準:
- 目錄頁:https://www.skillhub.cn/plugins/lucyVan/dsh-publish-github
- GitHub:https://github.com/lucyVan/dsh-publish-github