前言¶
在 DSH(DeepSeek Harness)的插件機制裏,web 會話中處理 git 工作區改動時,手工整理 diff、拆分提交和寫 commit message 比較瑣碎。dsh-ezcommit-plugin 提供的是一個「一鍵 Commit」入口:由當前會話模型按業務顆粒度拆分 git 改動,並在用戶確認後分批提交。
這是什麼¶
dsh-ezcommit-plugin 是 DSH「一鍵 Commit」靜態雙面插件,由 PenguinAndy 維護,採用 MIT 許可證。它用於在 DSH web 會話中處理本地 git 倉庫的改動。安裝並重啓 profile 後,web 會話標題欄會出現 [分支名] [一鍵 Commit] 按鈕。
核心功能¶
主要能力如下:
- 非 git 倉庫時按鈕置灰。
- 按鈕左側展示分支名;detached 狀態下退化爲短 hash。
- 工作區無改動時按鈕置灰。
- 點擊「一鍵 Commit」後彈出二次確認框。
- 由當前會話模型按業務顆粒度拆分 git 改動爲多個 Conventional Commits 批次。
- 模型判定爲環境噪音時,只提示原因,不執行任何 git 寫操作。
- 敏感文件路徑與內容不發送給模型,也不進入提交計劃或執行。
安裝與啓用¶
安裝¶
下面給出從 npm 安裝該插件的命令:
dsh plugin --profile web add dsh-ezcommit-plugin
也可以從 git 倉庫或本地 checkout 安裝:
dsh plugin --profile web add git+https://github.com/PenguinAndy/dsh-ezcommit-plugin.git
dsh plugin --profile web add link:/path/to/dsh-ezcommit-plugin
啓用¶
安裝完成後,需要重啓 profile 纔會出現按鈕並掛載路由。以 web profile 爲例:
dsh web
刷新頁面後,會話標題欄會出現 [分支名] [一鍵 Commit] 按鈕。
典型用法¶
使用流程如下:
1、點擊「一鍵 Commit」,二次確認框展示分支與改動計數。
2、「開始分析」後,由當前會話模型裁決爲 noise 或 commit;commit 時展示拆分批次、文件清單、被過濾敏感文件與未覆蓋文件告警。
3、「執行 N 批提交」逐批執行 git add 與 git commit,並返回每批短 hash。
適用場景與注意¶
適合在 DSH web 會話中處理本地 git 改動的開發者使用。執行提交時不執行 git push、不使用 --force、不修改 git 歷史;多批次中任一批失敗即停止,不回滾,已成功批次照常報告。
需要注意以下邊界:
- 插件以當前
dsh進程權限運行,安裝前應檢查源碼與許可證。 - 要求
Node.js >=18,DSH >=0.1.1-rc.1。 - 分析時會把工作區
status、diff與未跟蹤文本採樣(每文件前 8KB、最多 32 個)發送給當前會話模型服務商,敏感路徑除外。 - API 僅接受同源 POST,拒絕跨站調用。
- 同一
sessionId的 analyze/execute 有進程內 in-flight 鎖,重複點擊直接拒絕。
相關鏈接¶
如果需要在 DSH web 會話中減少手工整理提交的工作量,可以從源碼倉庫查看實現細節:
- GitHub:https://github.com/PenguinAndy/dsh-ezcommit-plugin