Introduction

The composer area in the DSH Web UI typically hosts command entry points and mode controls. However, during daily use, the current workspace’s git branch is not always immediately obvious. If you frequently switch between DSH and other terminal tools, dsh-git-branch provides a lightweight information indicator: it displays the current workspace’s git branch next to the composer mode controls and refreshes immediately upon window focus, page visibility changes, or session/workspace switching.

What is this

dsh-git-branch is a DSH plugin maintained by hanyueqiang under the MIT license.

It is installed as a DSH bundle. The installation command adds the package to the profile’s bundles and takes effect during the next startup via the patch layer; therefore, no additional manual configuration of host and client is required.

Core Features

Display Location

The plugin displays the current workspace’s git branch behind the composer mode control in the DSH Web UI.

The client registers a conversation.input.left chip and conversation.chat.commandview to hide the transfer command.

Branch Display

  • Normal branches are displayed as ⎇ main
  • Detached HEAD is displayed as ⎇ detached @ a1b2c3d
  • If the current workspace is not inside a git repository, no content is rendered

Refresh Rules

The following events trigger an immediate refresh:

  1. Plugin mount
  2. Switch session/workspace
  3. Window focus
  4. visibilitychange becomes visible
  5. Click branch chip

Additionally, the plugin uses a 60-second polling interval as a fallback refresh mechanism.

Related client constants:

POLL_INTERVAL_MS = 60000

POLL_INTERVAL_MS controls the fallback polling interval; setting it to <= 0 disables this polling.

Host and Client Responsibilities

  • The host registers the /git-branch command and returns JSON results in the command’s text field
  • The client registers a conversation.input.left chip and conversation.chat.commandview to hide the transfer command

Installation and Activation

  1. Install the plugin:
dsh plugin --profile web add dsh-git-branch
  1. If using a local checkout:
dsh plugin --profile web add ./dsh-git-branch
  1. Restart the profile and refresh the page.

dsh plugin add detects dsh.bundle and adds the package to dsh.profile.bundles; the patch layer takes effect on the next startup.

Typical Usage

After installation and page refresh, you can see the branch chip directly next to the composer mode controls.

Clicking the chip triggers an immediate refresh.

To modify the command name, you can override the line with the same id in your profile’s cordis.patch.yml:

- id: git-branch
  name: dsh-git-branch
  config:
    commandName: git-branch   # optional; default is git-branch

Note: Unknown configuration keys will cause loading to fail.

If you need to disable the fallback polling, set POLL_INTERVAL_MS to less than or equal to 0.

Use Cases and Notes

  • Suitable for users who need to quickly verify the current workspace’s git branch within the DSH Web UI
  • If the workspace is not a git repository, the plugin will not render the branch chip
  • Only supported configuration keys are used during configuration overrides; unknown keys will cause loading to fail
  • The plugin activates with the profile and joins the bundles. Since the plugin runs with the permissions of the current DSH process, it is recommended to check the source code and the MIT license before installation

Conclusion

The value of dsh-git-branch is quite specific: it places the current workspace’s git branch next to the composer mode controls, triggers refreshes on focus, visibility, and session/workspace switching, and includes a 60-second fallback polling mechanism.

Community Plugin Directory Page:

https://www.skillhub.cn/plugins/hanyueqiang/dsh-git-branch

GitHub:

https://github.com/hanyueqiang/dsh-git-branch