DeepSeek Harness Plugin: dsh-version-history

Introduction

DeepSeek Harness (DSH) follows a “everything is a plugin” architecture, where sidebar plugins can extend core capabilities. Developers often need to manage local Git repository version changes, disk health status, LAN sharing services, and push synchronization with GitHub within the same interface. Traditional approaches typically require opening multiple tools or scripts, which is fragmented and lacks a unified view. dsh-version-history consolidates these capabilities into a single panel, making it ideal for DSH users who need centralized management of Git and storage status.

Plugin Overview

  • Name: dsh-version-history
  • Maintainer: Tanjintao2
  • Category: Client
  • Stars: 0
  • Core value: Provides a unified panel in the DSH sidebar for Git version history, disk health/SMART, LAN sharing, and GitHub push.

Main Panel Layout

The sidebar entry is GIT Management (sidebar.panellist id version-history, order 21). The main panel uses a three-column layout:

  • Left column: Repository / Version
  • Center column: Commit details
  • Right column: Disk health

Top bar buttons include: Regenerate / Disk Panel / LAN / GitHub / Backup / About / Open in New Tab. Among these, “Disk Panel / LAN / GitHub / Backup / About” switch sub-views within the panel (with a “← Back” button) and also attempt to open the corresponding page in the right sidebar.

Backup & Mirroring

Panel top bar “Backup” → “Backup Settings”:

  1. Mirror: Set the mirror root directory (absolute path), e.g., D:\GitMirror, then click “Save Mirror”. The directory will be auto-created if it doesn’t exist, and the UI will display the derived bundles/ and logs/ directories.
  2. One-click Copy: Mirrors each listed repository one by one (uses git push --mirror for existing repos, git clone --mirror for new ones), and generates bundles/<name>-<yyyymmdd-HHmmss>.bundle for each repository. Each repository retains the most recent N copies (default 10); copies beyond N are automatically rotated out.
  3. Passphrase: On first access, it will ask whether to set a passphrase. Once set, every “Save Mirror” or “One-click Copy” operation will require it, otherwise the Host side will reject the request (needPassword / badPassword). The passphrase is stored as a scrypt salted hash in reports/backup.json — never in plaintext and never echoed back. If you choose not to set one, passwordMode is written as 'none' and it won’t be asked again.
  4. Auto Backup (new in 0.1.6): Once the toggle is enabled, “One-click Copy” runs automatically at the scheduled time. Frequency can be set to Daily at HH:mm or Every N minutes (5–1440). Auto-triggered runs skip the passphrase check, while manually clicking “One-click Copy” still requires it. Driven by a Host-side timer (checks every 60 seconds for due time), only active while DSH is running. For 7×24 operation, you need to add a separate task in Windows “Task Scheduler”. The last auto-run time and success/failure status are displayed on the card (backup.json’s auto.lastRunAt / auto.lastOk).
  5. Push Protection (0.1.15): The “Block Push” toggle in the same block is off by default. Once locked, all GitHub push/publish operations are rejected on the Host side (POST /dsh-vh/gh’s push / publish return 423), and no operations reach the remote. This toggle does not require the passphrase, making it easy to unlock.

The Windows scheduled task GitBackup-Local running daily at 21:00 executes the external script D:\scripts\backup-all.ps1. It reads D:\reports\repos.json and D:\repos\*.git, performs push --mirror / clone --mirror per repository, creates bundles and rotates to keep the most recent -Keep copies (default 10), writes logs to D:\GitMirror\logs\backup-all.log, and finally runs visualize.ps1 -NoOpen to refresh the page. The “Auto Backup” within the panel is an in-process DSH timer; the two do not conflict.

GitHub Push & Status

  • GitHub Status Auto-badge: Below each repository row in the left column, badges are displayed including Local/LAN and GitHub Synced / GitHub Ahead N / GitHub Behind N / GitHub Unpushed / GitHub Diverged. The Host side auto-detects whether origin is on github.com, and the relationship between the remote same-name branch SHA and local HEAD. Results are cached for 3 minutes; when offline, the badge is silently hidden.
  • Context Menu: Right-click a repository row in the left column to perform:
  • “Push to Private Repo” / “Push to Public Repo”: Creates a repository with the corresponding visibility (reuses if it already exists), pushes the current branch and tags, and echoes back the URL.
  • “Copy Repo Path”
  • “Cancel”
  • If the repository has uncommitted changes or no version tags yet, a confirmation dialog appears before pushing (0.1.15).
  • PAT Expiry: The GitHub panel allows entering the token expiry date; it will be highlighted in yellow within 7 days of expiry. After expiry, binding/testing/pushing will all fail — you can check the status here.
  • Push Protection Lock: Once the “Block Push” lock in Backup Settings is enabled, all GitHub pushes are rejected (423).

Disk Health & SMART

  • Disk Panel: Displays disk capacity and SMART health information.
  • SMART Freshness: The panel shows “SMART collected N hours ago”; if over 24 hours, it will be highlighted in yellow with a prompt to rescan.
  • Script Dependencies: This package only orchestrates; it does not generate data. External scripts disk-health.ps1 (must explicitly pass -Out <healthPath>) and disk-health-admin.ps1 (requires admin privileges to obtain NVMe lifespan and other counters, otherwise elevated=false) are needed. Scripts are user-supplied and follow the agreed interface.

LAN Sharing

Controls the LAN Smart HTTP service via lan/start / lan/stop, with the default port being 8788. lan.json and lan/firewall routes are used for configuration and status queries. The service exposes the bare repository directory externally (default <root>/repos), which can be adjusted via the environment variable DSH_VH_REPOS_ROOT.

Installation & Activation

Each release includes dsh-version-history-<version>.tgz in npm layout (package root in package/). Example with PowerShell:

$ver = '0.1.10'   # Change to your desired version
$url = "https://github.com/Tanjintao2/dsh-version-history/releases/download/v$ver/dsh-version-history-$ver.tgz"
$tmp = Join-Path $env:TEMP "dsh-vh-$ver"

New-Item -ItemType Directory -Force $tmp | Out-Null
Invoke-WebRequest $url -OutFile (Join-Path $tmp 'pkg.tgz')

# Extract
tar -xzf (Join-Path $tmp 'pkg.tgz') -C $tmp

Then hand it off to DSH for installation:

plugin_manager: action=install_bundle, target=<tmp>\package
plugin_manager: action=set_plugin,   target="include:dsh-version-history", enabled=false
plugin_manager: action=set_plugin,   target="include:dsh-version-history", enabled=true
  • install_bundle copies the package to <DSH_HOME>\profiles\<profile>\node_modules\dsh-version-history\ and writes a line into the profile’s patch layer.
  • set_plugin false → true triggers the Host half to re-import; Client half changes require refreshing the DSH window (or restarting).
  • After installation, the sidebar will show GIT Management. You can self-check via GET http://127.0.0.1:<DSH port>/version-history/health — the returned path is the actually effective one (mismatch indicates the profile patch layer has an override).
  • Verify version: check the "version" field in node_modules\dsh-version-history\package.json of the installed directory.

To pin an older version, change $ver to 0.1.4 or another older version number; Release attachments are retained long-term. With an npm environment, you can also directly run npm i <downloaded .tgz>, but this only installs into a regular node_modules and won’t auto-register with DSH.

Method B: Install from source directory (for development / renaming / code modification)

# Install (provide the absolute path of this directory)
#   plugin_manager: action=install_bundle, target=<this directory>
# Reload after modifying host half
#   plugin_manager: action=set_plugin, target="include:dsh-version-history", enabled=false → true
# Refresh DSH window page after modifying client half

Configuration (Portable)

The code contains no personal absolute paths. All directories default to deriving from ~/.dsh-version-history:

~/.dsh-version-history/
├── reports/     data.json, health.json, smart.json, repos.json, github.json, backup.json, history.html
└── scripts/     visualize.ps1, disk-health.ps1, disk-health-admin.ps1, smart-launch.ps1, dpapi.ps1

Priority: Plugin config > Environment variables > Defaults.

Common environment variables:

Variable Purpose
DSH_VH_ROOT Root directory (auto-derives reports / scripts / repos)
DSH_VH_REPORTS Override reports directory only
DSH_VH_SCRIPTS Override scripts directory only
DSH_VH_REPOS_ROOT Bare repo directory exposed by the LAN service (default <root>/repos)
DSH_VH_GIT git executable (default git, resolved via PATH)
DSH_VH_LAN_PORT LAN Smart HTTP port (default 8788)
DSH_VH_REPOS Pre-populated repo list (semicolon or comma-separated absolute paths), only effective when repos.json doesn’t exist yet

To point elsewhere (e.g., scripts in D:\scripts, reports in D:\reports), override config in the profile patch layer — do not modify files inside the package:

- id: dsh-version-history
  name: dsh-version-history
  config:
    dataPath: 'D:\reports\data.json'
    reportPath: 'D:\reports\版本历史.html'
    scriptPath: 'D:\scripts\visualize.ps1'
    reposPath: 'D:\reports\repos.json'
    healthPath: 'D:\reports\health.json'
    healthScript: 'D:\scripts\disk-health.ps1'
    smartPath: 'D:\reports\smart.json'
    smartScript: 'D:\scripts\disk-health-admin.ps1'
    smartLauncher: 'D:\scripts\smart-launch.ps1'
    smartStatePath: 'D:\reports\smart.state.json'
    smartLogPath: 'D:\reports\smart.log'
    githubPath: 'D:\reports\github.json'
    dpapiScript: 'D:\scripts\dpapi.ps1'
    reposRoot: 'D:\repos'
    gitExe: 'D:\git\tools\git\cmd\git.exe'
    lanPort: 8788

Routes (Host half, prefix /version-history)

GET routes include:

  • health, data.json, report, refresh, repos, repos/add, repos/remove, disks.json, disks/scan, smart.json, smart.state.json, smart.log, smart/scan, lan.json, lan/start, lan/stop, lan/firewall, github.json, github/test.

Write operations go through POST /dsh-vh/gh, POST /dsh-vh/backup, POST /dsh-vh/lan (with action in the body). DSH’s webServer.resource routes only allow GET; POST requires a separate plain handler at the host layer before the 405 is issued.

Access check: These routes (including GET) first query the host’s ctx.connection.requestRejection({ headers }) before entering business logic, returning 401 as unauthorized.

External Script Dependencies (not included in this package)

Script Invocation Contract
visualize.ps1 -NoOpen (refresh button) Generates data.json; repos.json is the repo list it reads
disk-health.ps1 -Out <healthPath> Writes disk health JSON; must explicitly pass -Out, otherwise only outputs to stdout
disk-health-admin.ps1 -Out <smartPath> -Log <smartLogPath> Collects SMART; admin privileges required for NVMe lifespan and other counters, otherwise degrades with elevated=false
smart-launch.ps1 No args Start-Process -Verb RunAs -Wait to launch admin script, writes phase / exitCode / error into smart.state.json (UAC cancellation also logged with reason)
dpapi.ps1 -Mode Protect (plaintext via stdin)
-Mode Unprotect -B64 <ciphertext>
Encrypts/decrypts using Windows DPAPI (CurrentUser); GitHub token is only stored as ciphertext on disk

In-Process Concurrency & Performance

  • /data.json GitHub status detection now uses 3-way concurrency.
  • visualize.ps1 per-version diff has a disk cache, making hot runs 3× faster. Set VH_TIMING=1 to view per-phase timings.
  • Pure frontend fetch from this package’s Host half same-origin routes for data retrieval — no iframes, and it benefits from DSH’s theme variables and locale.

UI Language

The dropdown on the top-right of the top bar allows switching between 中文 / English, defaulting to Chinese. The selection is stored in browser localStorage['dsh-vh-lang']. English mode only translates UI text (dictionary + number-aware rules), e.g., 1 commits becomes singular; repository names, paths, commit messages, volume labels, and other data remain unchanged.

Use Cases & Notes

  • Suited for DSH users who need centralized management of local Git repository version history, disk health, LAN sharing, and GitHub push.
  • The plugin runs with the current DSH process privileges; verify source code and license before installation.
  • External script dependencies must be user-supplied and follow the agreed interface.

Summary

dsh-version-history provides a unified panel in the DSH sidebar for Git version history, disk health/SMART, LAN sharing, and GitHub push. Through features like mirroring, one-click copy, auto backup, and push protection, it meets the backup and synchronization needs of local repositories. Configuration paths and scripts are user-customizable, supporting portable deployment via environment variables and the profile patch layer.

  • Plugin directory: https://www.skillhub.cn/plugins/Tanjintao2/dsh-version-history
  • GitHub: https://github.com/Tanjintao2/dsh-version-history
羽毛球分组比赛记分
小程序二维码

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

Xiaoye