deepseek-harness-git 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ ## 1.0.1
4
+
5
+ - CI: publish future releases through npm trusted publishing (OIDC).
6
+
7
+ ## 1.0.0
8
+
9
+ - Initial release of `deepseek-harness-git`, the Git source-control page for the DeepSeek Harness Web GUI.
10
+ - Workspace-scoped repository discovery with per-workspace selection of the repositories to load.
11
+ - Merge, staged, and working-tree groups with per-file stage, unstage, and discard.
12
+ - Unified diffs with old/new line numbers, hunk headers, binary and truncated notices, rename support, and conflict combined diffs.
13
+ - Commit box with per-repository drafts, amend, stage-all, `Ctrl`/`Cmd`+`Enter`, and AI message generation through the profile's default model.
14
+ - AI model picker for commit-message generation: defaults to the new-session model and can pin another provider/model for the browser.
15
+ - Local branch switching and creation, recent commits with details, and fetch/pull/push.
16
+ - Delete a merged local branch from the branch menu (safe `git branch -d`).
17
+ - Publish a branch without an upstream: push it and set the upstream in one action.
18
+ - Manage remote repositories: add or remove a remote, list its URL, and fetch all remotes.
19
+ - Set upstream from the branch menu, with the configured remotes and their fetched branches listed in the dialog.
20
+ - English and Chinese UI, display metadata, and an original icon for the Plugin Manager.
21
+ - Host-side safety: workspace/symlink admission, no shell, bounded scans, diffs, and network verbs.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 beifeng778
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,258 @@
1
- # Temporary Holding Version
1
+ # deepseek-harness-git
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/beifeng778/deepseek-harness-git/actions/workflows/ci.yml/badge.svg)](https://github.com/beifeng778/deepseek-harness-git/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/deepseek-harness-git.svg)](https://www.npmjs.com/package/deepseek-harness-git)
5
+ [![license](https://img.shields.io/npm/l/deepseek-harness-git.svg)](LICENSE)
6
+ [![GitHub stars](https://img.shields.io/github/stars/beifeng778/deepseek-harness-git?style=social)](https://github.com/beifeng778/deepseek-harness-git/stargazers)
7
+
8
+ A Git source-control page for the DeepSeek Harness Web GUI, modelled on the
9
+ source-control panel people know from VS Code: repository discovery, staged and
10
+ working-tree groups, per-file staging, unified diffs, a commit box with AI
11
+ message generation, branch switching, recent history, and fetch/pull/push.
12
+
13
+ The plugin is a bundle with two halves:
14
+
15
+ - **Host** (`index.js`) runs the local `git` executable for one registered
16
+ Workspace at a time and publishes one authenticated exact Fetch route,
17
+ `POST /api/dsh-git`, on Connection's shared `/api` channel.
18
+ - **Client** (`client.js`) registers a main-column page keyed `dsh-git` and an
19
+ icon in the sidebar's global panel list. Opening the icon selects the page,
20
+ exactly like the shipped Plugins and Schedules panels.
21
+
22
+ ## Features
23
+
24
+ | Area | What it does |
25
+ |---|---|
26
+ | Workspace | Lists the profile's registered Workspaces, remembers the last one, and scans it for repositories. |
27
+ | Repository discovery | Walks up to four levels below the Workspace root, recognises `.git` directories and worktree files, and skips build and dependency directories. |
28
+ | 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. |
29
+ | Changes | Merge, staged, and working-tree groups with status letters (`M`, `A`, `D`, `R`, `C`, `T`, `U`, `!`), original paths for renames, and per-row stage/unstage/discard. |
30
+ | Commit | Message box with a per-repository draft, `Ctrl`/`Cmd`+`Enter`, amend, staged count, stage-all, and AI message generation from the changes. |
31
+ | 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. |
32
+ | 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". |
33
+ | History | The 40 most recent commits; selecting one shows its metadata and patch. |
34
+ | Branches | Local branch menu with upstream, current marker, switch, create, delete, **Publish branch**, and **Set upstream**. |
35
+ | Upstream | The branch menu lists configured remotes and their fetched branches; point the current local branch at any of them without leaving the panel. |
36
+ | Remotes | **Manage remotes** adds or removes remote repositories, lists their URLs, and fetches all remotes. |
37
+ | Sync | Fetch, pull, and push, with ahead/behind counts and a bounded 120-second network timeout. |
38
+ | Empty states | No Workspaces, no repositories found (with **Scan again** and **Initialize repository**), no repositories loaded, clean tree, no staged changes, no commits. |
39
+ | Localization | English and Chinese dictionaries, registered in the host locale namespace `dsh-git`. |
40
+
41
+ ## Install
42
+
43
+ From the Harness profile that should own the panel, either install the published
44
+ package:
45
+
46
+ ```
47
+ plugin_manager install_bundle target: deepseek-harness-git@1.0.0
48
+ ```
49
+
50
+ or install this checkout by absolute path:
51
+
52
+ ```
53
+ plugin_manager install_bundle target: <absolute path to this directory>
54
+ ```
55
+
56
+ The bundle's `cordis.patch.yml` inserts one row:
57
+
58
+ ```yaml
59
+ - insert:
60
+ - id: deepseek-harness-git
61
+ name: deepseek-harness-git
62
+ config: {}
63
+ ```
64
+
65
+ `config.gitPath` may override the executable name or an absolute path when
66
+ `git` is not on the Host's `PATH`:
67
+
68
+ ```yaml
69
+ - insert:
70
+ - id: deepseek-harness-git
71
+ name: deepseek-harness-git
72
+ config:
73
+ gitPath: 'C:\Program Files\Git\cmd\git.exe'
74
+ ```
75
+
76
+ AI message generation defaults to the profile's new-session model. The commit
77
+ box's **AI model** selector can pin another provider/model for this browser; the
78
+ optional profile config below is the fallback when no selection is stored. Set
79
+ both fields together:
80
+
81
+ ```yaml
82
+ - insert:
83
+ - id: deepseek-harness-git
84
+ name: deepseek-harness-git
85
+ config:
86
+ messageProvider: magpie
87
+ messageModel: devin/deepseek-v4-1-flash-1017
88
+ ```
89
+
90
+ ## Use
91
+
92
+ 1. Open the sidebar's panel list and choose **Git**.
93
+ 2. Pick a Workspace from the folder chip beside the title. The panel scans it
94
+ for repositories and loads every one it finds by default.
95
+ 3. Open **Manage repositories** (the list button in the toolbar, or the
96
+ repository chip's menu) and uncheck the repositories this page should not
97
+ load. The choice is remembered per Workspace.
98
+ 4. Use the repository chip to switch the active repository, review a file, stage
99
+ it, write a message, and commit. The **Generate** button in the commit box
100
+ asks the selected model for a message based on the staged changes (or the
101
+ working-tree changes when nothing is staged). The **AI model** row defaults to
102
+ the new-session model; choose another model to pin it for this browser.
103
+ 5. Switch branches from the branch chip. A branch without an upstream offers
104
+ **Publish branch** (push it and set the upstream) and **Set upstream** (track
105
+ an already-fetched remote branch). For a local repository with no remote,
106
+ open **Manage remotes** first, add the remote, fetch it, then set the
107
+ upstream. Sync from the toolbar.
108
+
109
+ The page is root-scoped, so it remains usable with no Session selected. It
110
+ polls the active repository every five seconds while the page is visible and
111
+ refreshes on window focus.
112
+
113
+ ## Host contract
114
+
115
+ One route, one JSON envelope:
116
+
117
+ ```json
118
+ { "endpoint": "state", "payload": { "cwd": "D:\\project" } }
119
+ ```
120
+
121
+ The host answers `{ ok: true, value }` or
122
+ `{ ok: false, error: { code, message } }`. Endpoints:
123
+
124
+ | Endpoint | Payload | Result |
125
+ |---|---|---|
126
+ | `repos` | — | `{ workspaces: [{ id, title, path }] }` |
127
+ | `scan` | `{ cwd }` | `{ workspace, repos: [{ path, relativePath, name }], truncated }` |
128
+ | `models` | — | provider/model catalog plus the new-session default |
129
+ | `message` | `{ cwd, locale, provider?, model? }` | AI-generated commit message, model route, and file count |
130
+ | `state` | `{ cwd }` | repository head, staged/unstaged entries, branches, remotes, commits |
131
+ | `diff` | `{ cwd, path, group, originalPath? }` | one parsed patch |
132
+ | `show` | `{ cwd, hash }` | commit metadata and parsed patch |
133
+ | `stage` | `{ cwd, paths }` or `{ cwd, all: true }` | `git add` |
134
+ | `unstage` | `{ cwd, paths }` or `{ cwd, all: true }` | `git restore --staged` (unborn-HEAD fallback: `git rm --cached`) |
135
+ | `discard` | `{ cwd, paths }` | `git restore --` for tracked paths, delete for untracked |
136
+ | `commit` | `{ cwd, message, amend?, stageAll? }` | new short hash and output |
137
+ | `checkout` | `{ cwd, branch }` | `git switch` |
138
+ | `createBranch` | `{ cwd, branch }` | `git switch -c` |
139
+ | `deleteBranch` | `{ cwd, branch }` | `git branch -d` (unmerged branches are refused) |
140
+ | `remoteBranches` | `{ cwd, remote }` | fetched branches of one remote |
141
+ | `setUpstream` | `{ cwd, branch, remote, remoteBranch }` | `git branch --set-upstream-to` |
142
+ | `addRemote` | `{ cwd, name, url }` | `git remote add` |
143
+ | `removeRemote` | `{ cwd, name }` | `git remote remove` |
144
+ | `fetch` / `pull` / `push` | `{ cwd }` | network verbs |
145
+ | `init` | `{ cwd }` | `git init -b main` |
146
+
147
+ ## Safety boundaries
148
+
149
+ - **Workspace admission.** Every request names `cwd`; the host accepts a
150
+ registered Workspace root or a directory inside one, resolves both sides with
151
+ `fs.realpath`, and rejects a path that escapes the Workspace through a
152
+ symlink. The route cannot be used as an arbitrary-cwd command runner.
153
+ - **Bounded discovery.** A scan walks at most four levels and 2,000 directories,
154
+ skips symlinks, hidden directories, and build/dependency directories
155
+ (`node_modules`, `dist`, `build`, `target`, …), and reports truncation.
156
+ - **No shell.** Commands use `execFile` with an argv array. User paths travel
157
+ after `--`, and branch, remote, and remote URL values are validated before
158
+ they reach argv.
159
+ - **AI data egress.** AI message generation sends the changed-file list and a
160
+ bounded diff (24,000 characters) to the selected model (default: the profile's
161
+ new-session model) through `ctx.llm`; it never calls an external service
162
+ directly.
163
+ - **Path containment.** Diff and mutation paths must be repository-relative,
164
+ with no `..` segment or drive prefix.
165
+ - **Non-interactive.** `GIT_TERMINAL_PROMPT=0`, `GIT_EDITOR=true`, and pager
166
+ suppression keep a missing credential or an editor from hanging the request.
167
+ - **Bounded.** Reads time out after 60 seconds, network verbs after 120 seconds,
168
+ command output is capped at 4,000 characters, and patches at 6,000 lines.
169
+
170
+ ## Development
171
+
172
+ The package has no build step and no runtime dependency beyond the browser's
173
+ React and the Host's Node runtime.
174
+
175
+ ```
176
+ node test/host.test.mjs # real git, temporary repositories, scan
177
+ node test/client-module.test.mjs # module-loader contract
178
+ node --check index.js client.js
179
+ ```
180
+
181
+ The interaction model — staged/working-tree grouping, status letters, the
182
+ commit input, and the branch/sync vocabulary — follows the VS Code Git
183
+ extension (`extensions/git`) and SCM view (`src/vs/workbench/contrib/scm`),
184
+ which are MIT-licensed. No VS Code source is copied; the implementation here is
185
+ original and uses the Harness slot, locale, and Connection APIs.
186
+
187
+ ## Publishing
188
+
189
+ The npm name `deepseek-harness-git` is available and matches the GitHub
190
+ repository name. `publishConfig.registry` points at the canonical registry, so a
191
+ plain publish works even when the local install registry is a mirror.
192
+
193
+ The **first release must be published manually**; that first upload creates the
194
+ package, and only then can npm store a Trusted Publisher for it:
195
+
196
+ ```
197
+ npm publish
198
+ ```
199
+
200
+ `prepublishOnly` runs `npm run check && npm test` before the upload, and
201
+ `npm pack --dry-run` lists exactly the published files.
202
+
203
+ After the package exists, configure GitHub Actions as a Trusted Publisher
204
+ (package settings on npmjs.com, or the CLI):
205
+
206
+ ```
207
+ npm trust github deepseek-harness-git \
208
+ --file publish.yml \
209
+ --repo beifeng778/deepseek-harness-git \
210
+ --yes
211
+ ```
212
+
213
+ Allow **direct publish** (`npm publish`) for that trusted publisher. No
214
+ `NPM_TOKEN` secret is required; the workflow uses OIDC through
215
+ `permissions: id-token: write` and `--provenance`.
216
+
217
+ Create the empty GitHub repository, then push:
218
+
219
+ ```
220
+ git remote add origin git@github.com:beifeng778/deepseek-harness-git.git
221
+ git push -u origin main
222
+ ```
223
+
224
+ `.github/workflows/ci.yml` runs the tests on Node 20 and 22.
225
+ `.github/workflows/publish.yml` publishes on a GitHub release, or manually from
226
+ the Actions tab (`workflow_dispatch`).
227
+
228
+ ## Known limitations
229
+
230
+ - One active repository per page view; the repository manager switches between
231
+ loaded repositories but does not aggregate their changes into one list.
232
+ - Discovery stops at four levels below the Workspace and skips hidden
233
+ directories and symlinks; a repository outside that shape is not detected.
234
+ There is no manual path entry.
235
+ - No conflict-resolution editor: conflicted files appear in their own **Merge
236
+ changes** group with git's combined diff and can be marked resolved once the
237
+ markers are removed elsewhere.
238
+ - Branch deletion is the safe `git branch -d`: an unmerged branch is refused.
239
+ There is no force-delete control; use the CLI for `-D`.
240
+ - **Set upstream** lists fetched remote branches; a brand-new local branch has no
241
+ remote counterpart until **Publish branch** (or Push) creates it.
242
+ - **Manage remotes** can add and remove repositories, but does not edit an
243
+ existing URL. Removing a remote clears the upstream of branches that tracked it.
244
+ - No line-level (hunk) staging or inline diff editing.
245
+ - AI message generation depends on the profile's default model; the prompt diff
246
+ is truncated at 24,000 characters, and the message appears only after the
247
+ model stream completes.
248
+ - No list virtualization: a repository with tens of thousands of changed files
249
+ renders every row, and the five-second poll runs a full `git status` each
250
+ time.
251
+ - Push relies on credentials already configured for the Host's git process;
252
+ there is no in-app credential prompt.
253
+ - The panel is read/write through the local git CLI only; it does not use the
254
+ Harness `worktrees` service or the agent's sandbox providers.
255
+
256
+ ## Star History
257
+
258
+ [![Star History Chart](https://api.star-history.com/svg?repos=beifeng778/deepseek-harness-git&type=Date)](https://star-history.com/#beifeng778/deepseek-harness-git&Date)