zou82/dsh-plugin-git-sync: A Git + GitHub Automation Plugin for DeepSeek Harness

Introduction

DeepSeek Harness (DSH) extends its functionality through a plugin system. zou82/dsh-plugin-git-sync is a workflow plugin designed to automate interactions between local Git repositories and GitHub. It handles repository creation, synchronization, and credential management to reduce manual operations.

Core Features

  • Repository Creation Inquiry at Project Start: When starting a new project, the agent first asks whether to create a repository on GitHub. The repository name requires user confirmation; if unsatisfied, the user can directly input a desired name. The repository can be renamed at any time after creation.
  • Automatic Sync After Every Code Change: The agent calls git_sync to commit and push after each round of modifications. If missed, the “end-of-turn fallback” automatically synchronizes (configurable).
  • Secure Credential Handling: GitHub tokens are stored in DSH’s credential store and never enter conversations, remote URLs, process command lines, or any output.
  • File Watching and Auto-Commit: Automatically commits and pushes when workspace files change (configurable debounce in milliseconds).
  • Conflict Handling: Supports pull --rebase. In case of conflicts, it lists the conflicting files and stops for manual resolution. It never performs force pushes.
  • Conventional Commits Support: Guides the agent to use the feat/fix/chore(scope): summary format.
  • Sensitive File Scanning: Scans for sensitive files (e.g., .env, keys) and large files (warning threshold 50MB) before committing, blocking the commit if found.
  • Automatic Commit Identity Setup: Automatically sets the Git commit identity based on repo/local configuration without touching global settings.

Environment Requirements

  • DeepSeek Harness Desktop (DSH) 2.x
  • Git installed locally (git --version is available)
  • A GitHub account and Personal Access Token (PAT)
    • Fine-grained PAT requires permissions: Administration: Read and write (repo creation), Contents: Read and write (push), Metadata: Read
    • Classic PAT requires permissions: repo (entire scope)

Installation and Activation

  1. Build and Package (if needed)
   npm install
   npm run build       # Outputs to lib/
   npm pack            # Outputs dsh-plugin-git-sync-<version>.tgz
  1. Install into DSH Profile
    Assuming your profile directory is ~/.dsh/profiles/web, install the built package:
   cd ~/.dsh/profiles/web
   pnpm add /path/to/dsh-plugin-git-sync-<version>.tgz
  1. Register Bundle
    Edit the profile’s package.json and add the plugin to dsh.profile.bundles:
   {
     "dsh": {
       "profile": {
         "bundles": [ "...other bundles...", "dsh-plugin-git-sync" ]
       }
     }
   }
  1. Restart DSH Desktop
    Completely exit and reopen DSH Desktop. Once the plugin is loaded, the log will show:
   [I] [git-sync] git-sync: Plugin loaded (GitHub sync enabled)

Configuration

The plugin has two types of configuration: GitHub Token (Credentials) and Plugin Settings. Both can be modified via the DSH Settings interface (Settings → Plugins → Plugin Configuration → GitHub Sync) or by directly editing the files.

1. Configure GitHub Token

Add a line under refs: in the ~/.dsh/.credentials.yaml file:

version: 1
refs:
  DEEPSEEK_API_KEY: your-other-key
  GITHUB_TOKEN: github_pat_xxxxxxxxxxxx

2. Configure Plugin Settings

Add a git-sync: section to the ~/.dsh/settings.yaml file:

git-sync:
  github:
    username: your-github-username        # Owner for repo creation; uses token account if empty
    visibility: private               # Default repository visibility: private / public
    defaultBranch: main
    insecureTls: false                # Set to true if local TLS is intercepted
  auth:
    method: extraheader               # Git credential injection method
  git:
    committerName: ""                 # Commit author name; uses GitHub username if empty
    committerEmail: ""                # Commit author email; uses GitHub noreply email if empty
  autoSync: true                      # End-of-turn fallback strategy
  askBeforeInit: true                 # Whether to ask about repo creation at project start
  init:
    createGitignore: true
    initialCommitMessage: "chore: initial commit"
  safety:
    scanForSecrets: true              # Scan for sensitive files and block commits before committing
    maxFileSizeMb: 50                 # Large file warning threshold

Typical Usage

The plugin is ready to use after starting a new conversation in DSH.

  1. Create Repository (including name confirmation/customization)

    I am starting a new project at D:\my-project (the directory is empty). Help me create a GitHub repository and write a Python script.

The agent will call git_init:
- Asks whether to create a repository
- Asks if the repository name is my-project; user confirms or inputs a custom name
- Automatically suggests a suffix (e.g., my-project-2) if the name conflicts
- Automatically completes local init, GitHub creation, and the first commit/push

  1. Rename

    Change the repository name to better-name.

The agent calls git_rename and completes the GitHub rename and local remote sync after confirmation.

  1. Auto-sync after Code Changes

    Add a parameter parsing feature.

The agent calls git_sync to commit and push after modifying the code; if not called, the fallback push happens automatically at the end of the turn.

Notes

  • The plugin runs with the permissions of the current DSH process. Please ensure DSH Desktop has permission to read/write the working directory and execute Git commands.
  • Plugin state is stored in the <workspace>/.dsh-git-sync/ directory, which is automatically added to the project’s .gitignore.
  • If local TLS is intercepted (e.g., by security software or proxies), github.insecureTls: true must be set.
  • The plugin relies on the Cordis plugin system. If the initial load fails, it will be automatically disabled by the “Startup Recovery” mechanism. Check disabledBundles in startup-recovery/state.json and remove it.
羽毛球分组比赛记分
小程序二维码

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

Xiaoye