dsh-source-control: Git Source Control Panel for the Native DSH Right Sidebar

Introduction

DeepSeek Harness (DSH) adopts a plugin-based architecture, expanding capabilities through extension points. In the agent development workflow, it is a common requirement to perform Git operations directly within DSH. Previously, some plugins attempted to implement VS Code-like panels by directly modifying the host layout (such as grid-template-columns). However, in DSH 0.1.6-alpha.2, due to the shell’s continuous rewriting of the grid, these approaches resulted in the plugin columns failing or being hidden.

dsh-source-control avoids conflicts with the host layout. It utilizes only the official extension points ctx.sidebarRightTabs and ctx.slots.register to mount a VS Code-style Source Control panel onto the native right sidebar’s tab system of DSH.

Core Capabilities

The plugin provides complete Git interaction capabilities within the DSH right sidebar:

  • Changes & Commits: Displays four groups of status (Staged/Modified/Untracked/Conflicted), supports batch operations, single-file diff expansion, and commits with secondary confirmation.
  • Branch Management: Lists local and remote-tracking branches, supports searching by keyword (matching name or commit message), checkout, merge, delete, and create.
  • Remote Sync: Provides fetch, pull (default --ff-only), push, and “Pull (Merge)” operations. When creating a branch with no upstream, the button automatically changes to “Publish Branch”.
  • Git Worktree: Supports listing, creating, deleting, and cleaning up invalid records. Newly created worktrees are automatically registered as DSH workspaces and can be selected directly in “New Session”.
  • History: Displays the Hash, title, author, and date of recent commits.

Installation

Install the plugin via the official CLI:

dsh plugin --profile web add github:jackchen13755/dsh-source-control

Once installed, click the “+” icon in the right sidebar within a DSH session and select “Source Control” to load it.

Configuration

The plugin injects configuration via cordis.patch.yml. The default values are as follows:

- insert:
    - id: source-control
      name: 'dsh-source-control'
      config:
        recentCommits: 20        # Number of history records
        pollMs: 5000             # Panel auto-refresh interval, 0 to disable
        defaultRemote: origin    # Default remote source for sync operations, uses branch upstream if empty
        worktreeHome: ''         # Worktree hosting directory, uses $DSH_HOME/source-control/worktrees if empty

Usage Instructions

  • Branch Switching: Supports checking out directly from remote branches (establishing tracking and switching). When creating a new branch, a base point or remote branch can be specified.
  • Worktree Registration: After a worktree is created, the plugin registers it into the DSH workspace list to achieve task isolation.
  • Safety Confirmation: When performing destructive operations (such as push, deleting branches, deleting worktrees), a window.confirm dialog will pop up in the browser.

Security Model

The plugin ensures operational security through the following mechanisms:

  1. Network Boundary: Only listens to local requests; non-loopback requests are consistently rejected with a 403 response.
  2. Path Fencing: The caller only provides the sessionId. After the host resolves the working directory, all repository paths must fall within that directory, registered workspaces, or the worktree hosting directory.
  3. No Shell Concatenation: All git calls pass arguments via execFile without concatenating shell strings, preventing command injection.
  4. Request Limits: Only accepts JSON POST requests with a body size limit of 512KB.

Known Limitations

  • Conflict Handling: The conflict list only lists conflicting files and does not provide a three-way merge editor; files must be manually edited and staged.
  • Feature Trade-offs: Does not provide operations such as rebase, cherry-pick, stash, tag, submodule, nor does it support force push.
  • Pull Strategy: Uses --ff-only by default; when the history has diverged, “Pull (Merge)” must be explicitly selected.
  • Compatibility: Depends on DSH version >= 0.1.5-rc.1.

Conclusion

dsh-source-control completes the Source Control management capabilities for the native DSH environment via official extension points. It does not interfere with the shell layout, focuses on the Git workflow (staging, committing, branching, worktrees), and provides strict security fencing, making it suitable for developers who need to perform direct code collaboration within DSH.

Project URL: github.com/jackchen13755/dsh-source-control

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye