deepseek-harness-git
v1.2.1
Published
Git source-control panel for the DeepSeek Harness Web GUI: repository discovery, changes, staging, diffs, AI commit messages, branches, and sync.
Maintainers
Readme
deepseek-harness-git
A Git source-control page for the DeepSeek Harness Web GUI, modelled on the source-control panel people know from VS Code: repository discovery, staged and working-tree groups, per-file staging, unified diffs, a commit box with AI message generation, branch switching, recent history, and fetch/pull/push.
The plugin is a bundle with two halves:
- Host (
index.js) runs the localgitexecutable for one registered Workspace at a time and publishes one authenticated exact Fetch route,POST /api/dsh-git, on Connection's shared/apichannel. - Client (
client.js) registers a main-column page keyeddsh-gitand an icon in the sidebar's global panel list. Opening the icon selects the page, exactly like the shipped Plugins and Schedules panels.
Features
| Area | What it does |
|---|---|
| Workspace | Lists the profile's registered Workspaces, remembers the last one, and scans it for repositories. |
| Repository discovery | Walks up to four levels below the Workspace root, recognises .git directories and worktree files, and skips build and dependency directories. |
| Repository selection | A Manage repositories dialog lists every detected repository with a checkbox; the choice is persisted per Workspace, and the header's repository chip switches the active one. |
| Changes | Merge, staged, and working-tree groups with status letters (M, A, D, R, C, T, U, !), original paths for renames, a tree/list toggle, a collapsible directory tree with single-child folder compaction, and per-row stage/unstage/discard. |
| Commit | Message box with a per-repository draft, Ctrl/Cmd+Enter, amend, staged count, stage-all, and AI message generation from the changes. |
| AI model | The commit box defaults to the profile's new-session model and can pin another provider/model from the profile's adapters for message generation; the choice is remembered in this browser. |
| Diff | Unified patches with old/new line numbers, hunk headers, add/remove colouring, binary and truncated notices, and a 1,500-line render cap with "show all". |
| History | The 40 most recent commits, filterable by committer name or email, with a picker that lists the loaded committers, their emails, and their commit counts; selecting a commit shows its metadata, a collapsible changed-file list with statuses, and the patch. Selecting a changed file focuses that file's patch. |
| Branches | Local branch menu with upstream, current marker, switch, create, delete, Publish branch, and Set upstream. |
| Upstream | The branch menu lists configured remotes and their fetched branches; point the current local branch at any of them without leaving the panel. |
| Remotes | Manage remotes adds or removes remote repositories, lists their URLs, and fetches all remotes. |
| Sync | Fetch, pull, and push, with ahead/behind counts and a bounded 120-second network timeout. |
| Empty states | No Workspaces, no repositories found (with Scan again and Initialize repository), no repositories loaded, clean tree, no staged changes, no commits. |
| Localization | English and Chinese dictionaries, registered in the host locale namespace dsh-git. |
Install
From the Harness profile that should own the panel, either install the published package:
plugin_manager install_bundle target: [email protected]or install this checkout by absolute path:
plugin_manager install_bundle target: <absolute path to this directory>The bundle's cordis.patch.yml inserts one row:
- insert:
- id: deepseek-harness-git
name: deepseek-harness-git
config: {}config.gitPath may override the executable name or an absolute path when
git is not on the Host's PATH:
- insert:
- id: deepseek-harness-git
name: deepseek-harness-git
config:
gitPath: 'C:\Program Files\Git\cmd\git.exe'AI message generation defaults to the profile's new-session model. The commit box's AI model selector can pin another provider/model for this browser; the optional profile config below is the fallback when no selection is stored. Set both fields together:
- insert:
- id: deepseek-harness-git
name: deepseek-harness-git
config:
messageProvider: magpie
messageModel: devin/deepseek-v4-1-flash-1017Use
- Open the sidebar's panel list and choose Git.
- Pick a Workspace from the folder chip beside the title. The panel scans it for repositories and loads every one it finds by default.
- Open Manage repositories (the list button in the toolbar, or the repository chip's menu) and uncheck the repositories this page should not load. The choice is remembered per Workspace.
- Use the repository chip to switch the active repository. The staged and working-tree lists are a collapsible directory tree; click a folder to expand or collapse it, or use the tree/list button in the Merge changes section header to switch to a flat list. Review a file, stage it, write a message, and commit. The Generate button in the commit box asks the selected model for a message based on the staged changes (or the working-tree changes when nothing is staged). The AI model row defaults to the new-session model; choose another model to pin it for this browser.
- Switch branches from the branch chip. A branch without an upstream offers
Publish branch (push it and set the upstream) and Set upstream (track
an already-fetched remote branch). For a local repository with no remote,
open Manage remotes first, add the remote, fetch it, then set the
upstream. Sync from the toolbar. Selecting a commit in History lists its
changed files; click one to focus its patch. Type in the Filter by author
box above the commit list to show only commits by one committer, or use its
picker button to choose a committer from the loaded history (each entry shows
how many commits that person authored). The box matches name or email, and
the section badge shows how many commits match (for example
6/40).
The page is root-scoped, so it remains usable with no Session selected. It polls the active repository every five seconds while the page is visible and refreshes on window focus.
Host contract
One route, one JSON envelope:
{ "endpoint": "state", "payload": { "cwd": "D:\\project" } }The host answers { ok: true, value } or
{ ok: false, error: { code, message } }. Endpoints:
| Endpoint | Payload | Result |
|---|---|---|
| repos | — | { workspaces: [{ id, title, path }] } |
| scan | { cwd } | { workspace, repos: [{ path, relativePath, name }], truncated } |
| models | — | provider/model catalog plus the new-session default |
| message | { cwd, locale, provider?, model? } | AI-generated commit message, model route, and file count |
| state | { cwd } | repository head, staged/unstaged entries, branches, remotes, commits |
| diff | { cwd, path, group, originalPath? } | one parsed patch |
| show | { cwd, hash } | commit metadata and parsed patch |
| stage | { cwd, paths } or { cwd, all: true } | git add |
| unstage | { cwd, paths } or { cwd, all: true } | git restore --staged (unborn-HEAD fallback: git rm --cached) |
| discard | { cwd, paths } | git restore -- for tracked paths, delete for untracked |
| commit | { cwd, message, amend?, stageAll? } | new short hash and output |
| checkout | { cwd, branch } | git switch |
| createBranch | { cwd, branch } | git switch -c |
| deleteBranch | { cwd, branch } | git branch -d (unmerged branches are refused) |
| remoteBranches | { cwd, remote } | fetched branches of one remote |
| setUpstream | { cwd, branch, remote, remoteBranch } | git branch --set-upstream-to |
| addRemote | { cwd, name, url } | git remote add |
| removeRemote | { cwd, name } | git remote remove |
| fetch / pull / push | { cwd } | network verbs |
| init | { cwd } | git init -b main |
Safety boundaries
- Workspace admission. Every request names
cwd; the host accepts a registered Workspace root or a directory inside one, resolves both sides withfs.realpath, and rejects a path that escapes the Workspace through a symlink. The route cannot be used as an arbitrary-cwd command runner. - Bounded discovery. A scan walks at most four levels and 2,000 directories,
skips symlinks, hidden directories, and build/dependency directories
(
node_modules,dist,build,target, …), and reports truncation. - No shell. Commands use
execFilewith an argv array. User paths travel after--, and branch, remote, and remote URL values are validated before they reach argv. - AI data egress. AI message generation sends the changed-file list and a
bounded diff (24,000 characters) to the selected model (default: the profile's
new-session model) through
ctx.llm; it never calls an external service directly. - Path containment. Diff and mutation paths must be repository-relative,
with no
..segment or drive prefix. - Non-interactive.
GIT_TERMINAL_PROMPT=0,GIT_EDITOR=true, and pager suppression keep a missing credential or an editor from hanging the request. - Bounded. Reads time out after 60 seconds, network verbs after 120 seconds, command output is capped at 4,000 characters, and patches at 6,000 lines.
Development
The package has no build step and no runtime dependency beyond the browser's React and the Host's Node runtime.
node test/host.test.mjs # real git, temporary repositories, scan
node test/client-module.test.mjs # module-loader contract
node --check index.js client.jsThe interaction model — staged/working-tree grouping, status letters, the
commit input, and the branch/sync vocabulary — follows the VS Code Git
extension (extensions/git) and SCM view (src/vs/workbench/contrib/scm),
which are MIT-licensed. No VS Code source is copied; the implementation here is
original and uses the Harness slot, locale, and Connection APIs.
Publishing
The npm name deepseek-harness-git is available and matches the GitHub
repository name. publishConfig.registry points at the canonical registry, so a
plain publish works even when the local install registry is a mirror.
The first release must be published manually; that first upload creates the package, and only then can npm store a Trusted Publisher for it:
npm publishprepublishOnly runs npm run check && npm test before the upload, and
npm pack --dry-run lists exactly the published files.
After the package exists, configure GitHub Actions as a Trusted Publisher (package settings on npmjs.com, or the CLI):
npm trust github deepseek-harness-git \
--file publish.yml \
--repo beifeng778/deepseek-harness-git \
--yesAllow direct publish (npm publish) for that trusted publisher. No
NPM_TOKEN secret is required; the workflow uses OIDC through
permissions: id-token: write and --provenance.
Create the empty GitHub repository, then push:
git remote add origin [email protected]:beifeng778/deepseek-harness-git.git
git push -u origin main.github/workflows/ci.yml runs the tests on Node 20 and 22.
.github/workflows/publish.yml publishes on a GitHub release, or manually from
the Actions tab (workflow_dispatch).
Known limitations
- One active repository per page view; the repository manager switches between loaded repositories but does not aggregate their changes into one list.
- Discovery stops at four levels below the Workspace and skips hidden directories and symlinks; a repository outside that shape is not detected. There is no manual path entry.
- No conflict-resolution editor: conflicted files appear in their own Merge changes group with git's combined diff and can be marked resolved once the markers are removed elsewhere.
- Branch deletion is the safe
git branch -d: an unmerged branch is refused. There is no force-delete control; use the CLI for-D. - Set upstream lists fetched remote branches; a brand-new local branch has no remote counterpart until Publish branch (or Push) creates it.
- Manage remotes can add and remove repositories, but does not edit an existing URL. Removing a remote clears the upstream of branches that tracked it.
- No line-level (hunk) staging or inline diff editing.
- The Recent commits author filter narrows the 40 commits the panel already
loads; it does not run a
git log --authorquery over older history. - AI message generation depends on the profile's default model; the prompt diff is truncated at 24,000 characters, and the message appears only after the model stream completes.
- No list virtualization: a repository with tens of thousands of changed files
renders every row, and the five-second poll runs a full
git statuseach time. - Push relies on credentials already configured for the Host's git process; there is no in-app credential prompt.
- The panel is read/write through the local git CLI only; it does not use the
Harness
worktreesservice or the agent's sandbox providers.
