Introduction

When developing agents, there are often requirements like letting the AI check open issues in a repository, submit an issue, or check the results of a specific Actions run. The conventional approach is either to set up your own callback server to handle OAuth or to stuff the token into various scripts and pass it around. This creates a complex chain and risks exposing the token to third-party intermediaries.

dsh-github-connect takes a different approach: it places a permanent button in the bottom left corner of the DSH chat interface. Authorization is completed using the GitHub OAuth Device Flow (or by directly pasting a PAT), without needing a callback server or going through third-party intermediaries. Once connected, the AI can send REST requests directly to GitHub via the github_api tool provided by the plugin. Below is an introduction to its features, installation, and usage.

What is it

dsh-github-connect is a DSH plugin by Moon-shiyue, licensed under MIT (declared in package.json). In a nutshell, it is a portable GitHub connection plugin; once connected, the AI can directly manipulate your GitHub via the github_api tool.

By “portable,” it means that copying the entire plugin directory to another machine and installing it is enough to get started: connection uses the GitHub OAuth Device Flow, and authorization is completed by entering the verification code in the browser; the token is only saved in the .github-auth.json file within the plugin directory on the local machine.

Core Features

  • Persistent Button in Bottom Left: A GitHub button appears at the left end of the composer toolbar, with a green dot indicating a connected status.
  • Two Connection Methods: OAuth Device Flow (enter your own Client ID, auto-poll after entering the verification code in the browser) or paste a Personal Access Token (fine-grained PAT is recommended).
  • AI-side github_api Tool: Once connected, the AI can send REST requests to api.github.com, covering operations such as Issues, PRs, Repositories, Gists, and Actions, with a system prompt automatically attached to guide the model’s usage.
  • Local Token Storage: .github-auth.json (gitignored), with a one-click disconnect option in the panel.
  • Built-in Trusted Network Layer lib/net.js (based on undici): Automatically uses a proxy by default and handles system CA trust.
  • Zero Build, Zero Runtime Framework: The host side is pure ESM, while the client side is pure __ModuleLoader__ modules.
  • Idempotent Installation Script: Repeated execution is safe and automatically updates the code.

Installation and Enablement

The easiest way is to simply tell the AI directly in a DSH chat:

Please install this plugin: https://github.com/Moon-shiyue/dsh-github-connect

Or copy and execute the command. Windows:

powershell -ExecutionPolicy Bypass -c "irm https://raw.githubusercontent.com/Moon-shiyue/dsh-github-connect/master/install.ps1 | iex"

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/Moon-shiyue/dsh-github-connect/master/install.sh | bash

The one-click script automatically completes three steps: cloning the code, installing dependencies with pnpm, and registering it into the profile (default is web). After completion, restart dsh web once and refresh the page. If the GitHub button appears in the bottom left of the chat interface, the installation is successful.

If you want to install manually, first clone the repository and install dependencies, then register it into the profile as a link:

git clone https://github.com/Moon-shiyue/dsh-github-connect.git
cd dsh-github-connect
pnpm install
dsh plugin --profile web add link:<本目录绝对路径>
dsh web

After installation, verify it using the following command; the output should contain a line with dsh-github-connect:

dsh --dump-config --profile web

Environment requirements: Node >= 20.18.1 (declared in engines), dependencies on undici ^7.29.0 and @deepseek-ai/dsh-tools 0.1.1-rc.2, peerDependencies are @deepseek-ai/cordis ^4.0.1.

Connection and Usage

  1. Click the GitHub button in the bottom left of the chat interface. Choose a method when not connected:
    - Device Flow Login: Enter your own GitHub OAuth App Client ID (create one at github.com/settings/developers, no callback URL needed), adjust scopes as needed, click “Start Connection”, enter the verification code on the opened page, and the plugin will automatically poll until authorization is complete;
    - Paste Token: Enter a fine-grained PAT, recommended to only grant permissions for the necessary repositories.
    The scopes for the device flow default to repo gist read:org workflow and can be modified in the panel. The plugin does not embed the author’s OAuth App; authorization happens entirely between “your App” and “your account”.

  2. Once you see “✓ Connected”, you can start chatting directly, for example:
    - “List the open issues in my account”
    - “Create an issue for xxx/yyy repo, title…, content…”

  3. To disconnect, click “Disconnect” in the panel (requires confirmation). Disconnecting only deletes the local token file; for safety, you can also revoke it directly in GitHub’s Settings → Applications / Tokens.

When not connected, calling github_api will return a 401 structural error and prompt you to authorize by clicking the button in the bottom left; it will not freeze/hang.

Network and Proxy

The plugin includes a built-in trusted network layer lib/net.js, based on undici. It automatically uses a proxy by default and does not require setting any environment variables. For each GitHub request, the proxy resolution order is:

  1. Plugin configuration proxy;
  2. Environment variables HTTPS_PROXY / HTTP_PROXY / ALL_PROXY (including lowercase forms);
  3. Windows system proxy (automatically reads WinINET registry settings);
  4. None found → Direct connection.

NO_PROXY is also effective: both environment variables and the config item noProxy support *, host:port, and .domain suffixes, defaulting to exempt localhost / 127.0.0.1.

Regarding system CA trust: Windows exports root certificates from the system certificate store (cached for 30 days, auto-refreshed); macOS/Linux reads standard CA bundle paths (e.g., /etc/ssl/certs/ca-certificates.crt). This solves issues like unable to verify the first certificate caused by local TLS interception proxies and direct connection resets. If all steps fail, it falls back to the Node default fetch, and the plugin will not crash.

When manual proxy specification is needed, add configuration to the cordis.patch.yml file in the profile:

- id: dsh-github-connect
  name: dsh-github-connect
  config:
    proxy: http://127.0.0.1:7890   # auto(默认)| direct | http(s)://host:port
    noProxy:                       # 可选:这些主机不走代理
      - localhost
      - 127.0.0.1

Use Cases and Notes

Suitable for: Developers who work in DSH daily and want the AI to directly read/write to their GitHub (check issues, submit PRs, check Actions), especially in scenarios where building a callback service is not feasible or where security is a concern regarding tokens passing through third parties.

A few points to note before use:

  • Permissions and Review: The plugin runs with the permissions of the current dsh process. After the AI connects, it can operate GitHub on your behalf. It is recommended to check the source code and license before installing, grant PAT with minimal fine-grained permissions, and reduce OAuth scopes as needed.
  • Token Security: The token is only stored locally in .github-auth.json. Except for sending it directly to api.github.com, it does not go through any other servers. This file is gitignored; do not share or commit it to git.
  • Troubleshooting “Invalid Token”: First, look at the specific reason in the error. Bad credentials means the token was indeed rejected by GitHub (expired, revoked, or incomplete copy); if it is UNABLE_TO_VERIFY_LEAF_SIGNATURE or ECONNRESET / ETIMEDOUT, there is usually a TLS interception proxy on the local machine or a need to use a proxy. The network layer automatically reads system proxy and system certificate store. After restarting dsh web, it usually works. If it still fails, manually configure proxy as mentioned above.
  • Uninstall: dsh plugin --profile web remove dsh-github-connect; if you no longer use it, you can delete the plugin directory, but note that the directory contains .github-auth.json, so confirm before deleting.
  • How Changes Take Effect: For client code changes, simply refresh the page; for host code changes (lib/index.js, lib/net.js), restart dsh web.

Conclusion

dsh-github-connect compresses “letting the AI operate GitHub” into a single button in the bottom left: Device Flow or PAT authorization, token stays local, network layer automatically handles proxy and certificates. If GitHub appears frequently in your workflow, it is worth trying.

  • GitHub: https://github.com/Moon-shiyue/dsh-github-connect
  • Community Directory Entry: https://www.skillhub.cn/plugins/Moon-shiyue/dsh-github-connect (社区站点,与 DeepSeek / 幻方无官方从属关系)