dsh-plugin-github: DSH Host-Side GitHub Workflow Integration

Preface

In DeepSeek Harness (DSH), the common approach to let agents operate GitHub is to use external scripts or piece together REST calls on the fly: tokens are scattered, write operations are hard to audit, and the browser side must accommodate ESM and the loading constraints of window.__ModuleLoader__. The dsh-plugin-github maintained by valing1837 takes a different path — host-only: it only registers host-side agent tools, comes without a client bundle, and structurally avoids desktop web startup and module format conflicts; tokens are resolved from the DSH credential domain, and write operations to GitHub state can go through an approval gate; it also comes with a deterministic PR review that does not depend on model credentials and a reusable composite action approach. The plugin targets DSH 0.2.0-rc.2, developed and tested on Node 22.19 or 24 (the package declares ^22.19.0 || >=24.0.0).

What is this

dsh-plugin-github is a community plugin (category: workflow), repository valing1837/dsh-plugin-github, directory page SkillHub. In one sentence: through the GitHub REST API and local git, it exposes capabilities such as creating repositories, reading diffs, opening/reviewing/merging PRs, issues, search, checks, and releases as DSH tools; the review side scans unified diffs with pure-function rules and deliberately makes no model calls. License MIT, current package version 0.1.0.

Why host-only

The plugin has no dsh.client, no lib/client.js. DSH 0.2.x’s browser side requires the client to self-register via window.__ModuleLoader__.load({...}) and contain no top-level import; putting ordinary ESM there causes web startup to fail (the README has been tested: Cannot use import statement outside a module). This plugin only registers host tools and does not trigger such failures.

Core features

Agent tools (29)

The README’s tool table covers repository lifecycle, PR/issue, content, CI, and more, for example:

Category Representative tools
Diagnostics github_status (configuration and token source, does not send requests, does not print secrets), github_whoami
Repository github_create_repo, github_list_repos, github_delete_repo (requires confirm to exactly equal owner/repo), github_clone, github_push
Content and branches github_get_file, github_put_file, github_delete_file, github_list_branches, github_compare
Pull Request github_list_pulls, github_get_pull (metadata + per-file patch + full unified diff), github_create_pull, github_update_pull, github_review_pull, github_merge_pull
Issue github_list_issues, github_get_issue, github_create_issue, github_update_issue, github_comment
Search and CI github_search, github_get_checks, github_set_status
Releases github_list_releases, github_create_release
Review (read-only) github_analyze_pull: runs deterministic rules against the PR diff, returning findings + a publishable review body + inline comment shape

Slash command /github

Direct queries without going through model turns (implemented by not hard-injecting commands, but using ctx.get('commands') to probe, to avoid whole-package loading failures when the composite command runtime is missing):

/github status                          token source, apiBase, gate status
/github whoami                          current account
/github repo <owner>/<name>             repository overview
/github pr <owner>/<name> <n>           PR overview
/github checks <owner>/<name> <ref>     CI status (lists runs that are not green)
/github review <owner>/<name> <n>       run deterministic review on the PR
/github search <query>                  search issues / PRs

Write-operation approval gate

When the approveWrites config is true by default, it registers a tools/pre-execute listener that returns { kind: 'ask', reason: '... will change state on GitHub: ...' } for 14 tools that change GitHub state. At runtime it dispatches via ctx.approval, and only allowed-once continues; if there is no responder it is rejected. The intercepted tools include create_repo, delete_repo, push, create_pull, update_pull, review_pull, merge_pull, create_issue, update_issue, comment, put_file, delete_file, create_release, set_status. github_clone is not within the gate (it only reads from GitHub; local writes are managed by the file sandbox). You can set approveWrites: false to disable the listener.

Deterministic review (lib/review.js)

Pure functions: input is a unified diff, output is findings; no network, no clock, no random numbers. Example rules: secret-literal, known-token-prefix, conflict-marker, focused-test, sensitive-file, etc. are errors; debug-leftover, dangerous-eval, destructive-shell, etc. are warnings; todo-added, trailing-whitespace, lockfile-only, large-change (defaults to over largeChangeLines 800 lines), etc. are notes. The output includes a findings list, a review body tagged with <!-- dsh-plugin-github:review -->, and GitHub inline comments that can be anchored to added lines; file-level/PR-level findings go into unanchoredFindings.

  • Tokens are not written into the plugin source; after github_push / github_clone complete, it tries to set origin to a URL without credentials.
  • stdout/stderr are returned via redact() to avoid git error messages leaking token-bearing URLs.
  • Commit identity prefers the existing git config user.email; if empty, it uses the configured authorName / authorEmail.

Installation and enabling

The desktop profile is exclusive to Electron; the CLI’s dsh plugin add refuses to manage the desktop profile, so the official step is to clone and then run the install script (idempotent; it backs up before modifying package.json):

git clone https://github.com/valing1837/dsh-plugin-github
cd dsh-plugin-github
powershell -ExecutionPolicy Bypass -File install.ps1

The script copies the package to <profile>\node_modules\dsh-plugin-github, and writes dsh-plugin-github into dsh.profile.bundles in <profile>\package.json. The default profile is %USERPROFILE%\.dsh\profiles\desktop; it can be overridden with -ProfileDir. After installation, restart DSH (host-side changes are not reloaded by HMR).

Token and permissions

Resolution order:

  1. Config item token (literal value, not recommended)
  2. DSH credential domain credentialRef(tokenRef), default reference name GITHUB_TOKEN
  3. Environment variable GITHUB_TOKEN

Recommended to configure under refs: in %USERPROFILE%\.dsh\.credentials.yaml:

refs:
  GITHUB_TOKEN: ghp_xxxxxxxx
Method What is needed
Classic token scope repo (includes creating repos, pushing, PR/issue, deleting repos)
Fine-grained token Contents / Pull requests / Issues each RW, Metadata R; creating repos additionally requires Account → Administration RW

Use github_status to see whether the token is resolved and where it comes from; use github_whoami to verify validity.

Configuration items (excerpt)

Can be overridden in the profile patch; all have default values:

Key Default Description
tokenRef GITHUB_TOKEN Credential reference name
apiBase https://api.github.com REST base URL
gitHost github.com Can be changed for Enterprise
approveWrites true Write-operation approval
reviewMinSeverity warning Minimum severity for inline comments
reviewMaxComments 20 Upper limit on inline comments (≤50)
largeChangeLines 800 Large-change prompt threshold

For the full list, see the “Configuration items” section in the repository README.

Typical usage

  1. Install and restart DSH, and configure GITHUB_TOKEN in the credentials file or environment.
  2. In a session, have the agent call github_status / github_whoami to confirm connectivity.
  3. Read a PR: github_get_pull or the slash /github pr owner/name n; only analyze without posting: github_analyze_pull or /github review owner/name n.
  4. When a change to GitHub state is needed, under approveWrites: true, approve once in the UI (allowed-once) and then execute github_push, github_create_pull, github_merge_pull, etc.

The repository also provides action.yml and a review CLI, for CI to reuse the same set of diff rules; the README notes that the composite action has been verified by script against a real PR in local Git Bash, but the self-review workflow has not yet been run to completion on a GitHub-hosted runner (planned to be completed in the next PR to this repository).

Applicable scenarios and notes

Suitable for: teams or individuals already developing on the DSH 0.2.x desktop profile who want the agent to stably operate GitHub (repositories/PRs/issues/review/status), and who want human gates on write operations and PR review not tied to model APIs.

Notes:

  • The plugin runs with the current DSH process privileges; please review the source code and the MIT license yourself before installing.
  • Do not use the dsh plugin add github:... installation method not given in the materials; take the README’s install.ps1 as the standard.
  • github_delete_repo is irreversible and requires a confirm guardrail; the repo scope of a classic token has a broad range of permissions, so choose the token type according to minimal needs.
  • The community directory SkillHub has no official affiliation with DeepSeek / QuantumMill; this article only introduces community plugin capabilities.

Conclusion

dsh-plugin-github brings GitHub workflows into the DSH host side: 29 tools, write approval, deterministic diff review, and /github quick queries; tokens go through the credential domain, and the review side does not need to hold model credentials. To learn more, please visit the SkillHub directory page and the GitHub repository.

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

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

Xiaoye