Skip to content
dsh.fish
Bundle

@ayumedaze/dsh-git

Fork-style Git GUI packaged as a DeepSeek Harness plugin (Express backend + browser frontend).

Source
ayumedaze
License
MIT
Updated
Updated yesterday

Readme

# dsh-git

把 [Fork](https://git-fork.com/) 风格 **Git 图形界面**(Express 后端 + 浏览器前端)打包成
**DeepSeek Harness(DSH)插件**,可在 DSH 桌面端 / Web 端内嵌使用。

## 目录结构

```
.
  package.json          # DSH 插件清单(dsh.bundle + dsh.client)
  cordis.patch.yml      # bundle patch:把本插件插入 profile 层级栈
  lib/
    index.js            # 宿主端入口:启动 Git GUI 服务 + 注册 /api/git-gui/info
    git-gui-server.js   # Express 后端(从原项目 server.js 重构为可嵌入 ESM 模块)
    client.js           # 客户端入口:侧边栏按钮 + shell.overlay 内嵌 iframe
  public/
    index.html          # 前端(与原项目一致)
    style.css
    app.js
```

## 工作原理

- **宿主端**(`lib/index.js`):插件被加载时在本机回环地址
  `127.0.0.1:<port>` 启动 Express 后端(默认端口 `3417`,可用环境变量
  `GIT_GUI_PORT` 覆盖),并在 DSH 的 `webServer` 上注册
  `GET /api/git-gui/info`,返回当前 Git GUI 的 `{ running, url, port }`。
- **客户端**(`lib/client.js`):在 DSH 侧边栏底部注册一个 `Git` 按钮,点击后通过
  `shell.overlay` 弹出浮层,用 `<iframe>` 内嵌 Git GUI;浮层同时提供
  “在新窗口打开”的兜底入口(桌面端会交给系统浏览器打开)。

Git GUI 前端保持原样,仍通过 `/api/...` 访问同一后端,功能与原项目一致。

## 安装

需要本机已安装 Node.js(≥22)和 `git`。用 `dsh` 自带的插件管理(本质是 `pnpm add`
到目标 profile,再把它计入 `dsh.profile.bundles`):

```powershell
# 克隆本仓库后,在仓库根目录执行
dsh plugin --profile <profile-name> add .
```

也可以从 npm 安装(发布到插件市场后):

```powershell
dsh plugin --profile <profile-name> add @ayumedaze/dsh-git
```

或者指定绝对路径:

```powershell
dsh plugin --profile <profile-name> add file:C:/path/to/dsh-git
```

安装完成后 **重启 DSH**(桌面端或 `dsh --profile <profile-name>` 重新启动),
侧边栏底部即出现 `Git` 按钮。

> 如果 profile 不存在,`dsh plugin` 会先初始化它。桌面端的 profile 名可在
> DSH 桌面端的设置/插件管理中查看。

## 使用

1. 打开 DSH,点击左侧边栏底部的 `Git`(⏣)按钮。
2. 在弹出的 Git GUI 浮层中点击 `Open…`,粘贴一个本地 git 仓库路径即可。

最近打开过的仓库会写入插件目录下的 `repos.json`,下次启动自动恢复。

## 配置

| 环境变量       | 默认值      | 说明                       |
| -------------- | ----------- | -------------------------- |
| `GIT_GUI_PORT` | `3417`      | Git GUI 后端监听端口        |

端口仅绑定 `127.0.0.1`,不会对局域网开放。

## 开发说明

- 宿主端插件导出 `name` / `inject` / `apply`,`inject = ['webServer']`,与
  `dsh-community-market` 等官方插件一致。
- 客户端为 `window.__ModuleLoader__.load({ id, factory })` 形式的模块包,仅依赖
  `react` 与 `@deepseek-ai/dsh-client-runtime/client`(`defineStore`),因此无需
  额外构建步骤即可被 DSH 的浏览器模块系统加载。
- 独立(非 DSH)运行的原版 Web Git GUI 位于原 `git-gui` 项目;本插件的
  `lib/git-gui-server.js` 是其可嵌入重构版本,二者功能一致。

Install

dsh plugin --profile web add github:ayumedaze/dsh-git

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source