dsh-git-scm 0.1.0 → 0.3.0
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/README.md +140 -54
- package/lib/client.js +1568 -336
- package/lib/client.js.map +1 -1
- package/lib/host/git.d.ts +43 -0
- package/lib/host/types.d.ts +2 -0
- package/lib/index.js +214 -8
- package/lib/index.js.map +1 -1
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -6,18 +6,36 @@ sidebar and works on the checkout of the Session's current working directory.
|
|
|
6
6
|
|
|
7
7
|
## What it shows
|
|
8
8
|
|
|
9
|
-
- **Repository header**: repository
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
- **Repository header**: a repository glyph whose tooltip names the repository
|
|
10
|
+
(there is no visible repository-name label, so the branch chip gets the room),
|
|
11
|
+
a status-bar-style branch chip whose branch name opens a searchable branch
|
|
12
|
+
switcher (local and remote branches, with the dirty `*` / staged `+` markers
|
|
13
|
+
and ahead/behind counts) and whose cloud control publishes the branch when it
|
|
14
|
+
has no upstream. The hover tips name the repository, branch, and action: the
|
|
15
|
+
branch chip reads `demo-repo (Git) - main, Checkout branch/tag…` and the
|
|
16
|
+
publish control reads `demo-repo (Git) - Publish to GitHub`. The header also
|
|
17
|
+
carries a **Refresh** control and a Zed-style sync split control. The sync
|
|
18
|
+
control's primary segment is the action
|
|
19
|
+
the branch state calls for — **Publish** (which opens the publish dialog when
|
|
20
|
+
the repository has no remote), **Pull ↓n ↑n**, **Push ↑n**, or **Fetch** — and
|
|
21
|
+
its chevron opens the full command list: Fetch, Fetch From, Pull, Pull
|
|
22
|
+
(Rebase), Push, Push To, and Force Push; Fetch From and Push To open a remote
|
|
23
|
+
submenu, and Force Push asks first. The sync row below the header carries the
|
|
24
|
+
upstream, the ahead/behind counts, the last fetch time, the flat/tree view
|
|
25
|
+
toggle, and the bulk change menu. In a panel narrower than 340px the pill
|
|
26
|
+
drops its ahead/behind counts (the sync row repeats them) and the branch
|
|
27
|
+
chip's cloud button retires, since the pill's Publish primary already covers
|
|
28
|
+
it. A linked checkout marks the header with a compact folder-glyph badge
|
|
29
|
+
labelled **Linked worktree** for assistive tech, whose tooltip names the
|
|
30
|
+
checkout path.
|
|
14
31
|
- **Publish a branch**: while the current branch has never been pushed the
|
|
15
|
-
commit action becomes **Publish Branch** and the
|
|
16
|
-
|
|
32
|
+
commit action becomes **Publish Branch** and the sync control's primary
|
|
33
|
+
segment becomes **Publish**, which opens the publish dialog directly when the
|
|
34
|
+
repository has no remote: choose a private
|
|
17
35
|
or public GitHub repository (created through an authenticated `gh` CLI,
|
|
18
36
|
default name from the folder) or fall back to any custom remote URL. After
|
|
19
37
|
the push the branch tracks its new upstream and the panel returns to the
|
|
20
|
-
ordinary commit and
|
|
38
|
+
ordinary commit and sync controls.
|
|
21
39
|
- **Not a Git repository yet**: a Session directory outside Git shows an empty
|
|
22
40
|
state with two actions and a refresh control. **Initialize repository** runs
|
|
23
41
|
`git init -b main` and reads the new checkout; **Publish to Git** initializes
|
|
@@ -42,27 +60,58 @@ sidebar and works on the checkout of the Session's current working directory.
|
|
|
42
60
|
default keeps that draft's language. The model seam comes from the Host's own
|
|
43
61
|
runtime, so this package keeps no LLM dependency.
|
|
44
62
|
- **Changes**: staged changes and working-tree changes (modified, added,
|
|
45
|
-
deleted, renamed, copied, conflicting, untracked
|
|
63
|
+
deleted, renamed, copied, conflicting, untracked; an untracked directory is
|
|
64
|
+
listed as its files, not as one directory row).
|
|
65
|
+
- **Flat list or directory tree**: the staged and working-tree sections open as a
|
|
66
|
+
flat list; the header's view control switches both to a directory tree whose
|
|
67
|
+
folders start expanded and collapse on click. Single-child directory chains
|
|
68
|
+
compact into one `a / b / c` row, the way the Explorer compacts folders, and a
|
|
69
|
+
directory row carries the same hover commands for every file underneath
|
|
70
|
+
(stage/unstage/discard); its changed-file count appears on hover as well. In a
|
|
71
|
+
narrow panel the flat list keeps the file name
|
|
72
|
+
whole and ellipsizes the grey directory suffix instead of hiding it outright;
|
|
73
|
+
the tree keeps its directory rows at any width.
|
|
46
74
|
- **Change lists right under the repository header**: the staged and
|
|
47
|
-
working-tree sections follow the header directly; the header row
|
|
48
|
-
|
|
49
|
-
separate "Changes" group row takes
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
75
|
+
working-tree sections follow the header directly; the header row carries
|
|
76
|
+
refresh and the sync split control, the sync row beside it carries the view
|
|
77
|
+
toggle and the bulk change menu, so no separate "Changes" group row takes
|
|
78
|
+
space.
|
|
79
|
+
- **A collapsible Git repositories group** (worktrees, branches, remotes,
|
|
80
|
+
stashes, tags) whose sections are indented under it; every section collapses
|
|
81
|
+
on its own and the group title carries no counter.
|
|
82
|
+
- **Worktrees**: the repository's checkouts in one list ahead of the branches —
|
|
83
|
+
the main checkout, linked ones, and registrations whose directory is gone
|
|
84
|
+
(marked missing, carrying Git's prune reason). A row names its branch and
|
|
85
|
+
shows the directory relative to this checkout; the current one is marked, and
|
|
86
|
+
a locked one says so. The row menu offers **Switch to this worktree**, **Copy
|
|
87
|
+
worktree path**, and **Remove worktree**; removal asks first and, when the
|
|
88
|
+
checkout has uncommitted changes, offers an explicit **Force Remove** after a
|
|
89
|
+
second confirmation. A missing registration offers **Prune missing worktrees**
|
|
90
|
+
instead. The section's **New Worktree** action creates a branch at the current
|
|
91
|
+
HEAD in `<repository>/.agents/worktrees/<slug>` (the pool keeps itself out of
|
|
92
|
+
Git's status through a `.gitignore` of `*`), or checks out an existing local
|
|
93
|
+
branch there, then offers to move this Session into the new checkout.
|
|
94
|
+
Clicking a linked row — or confirming a switch — moves the Session's working
|
|
95
|
+
directory into that checkout, and the panel re-reads itself there. A linked
|
|
96
|
+
checkout marks the header with a compact folder-glyph badge whose tooltip
|
|
97
|
+
names its path.
|
|
53
98
|
- **Docked comparison**: clicking a changed file, a commit's file, or a stash
|
|
54
99
|
opens its comparison in a pane that docks below the list by default (a
|
|
55
100
|
draggable divider resizes it and the size is remembered) and can be switched
|
|
56
101
|
to dock on the right, where both the divider and the pane's own left edge
|
|
57
102
|
resize its width (double-clicking a divider restores the default size); the
|
|
58
103
|
divider is a layout-free seam that sits exactly on the pane border and
|
|
59
|
-
highlights on hover, and the dock
|
|
60
|
-
|
|
61
|
-
|
|
104
|
+
highlights on hover, and the dock keeps a 280px minimum while stopping at the
|
|
105
|
+
list's 300px reservation when the panel is wide enough. The title row is a
|
|
106
|
+
disclosure control: clicking it folds the body to one strip and clicking it
|
|
107
|
+
again unfolds it. A panel narrower than 580px starts the comparison folded
|
|
108
|
+
below the list, while a fullscreen Sidebar opens it docked on the right and
|
|
109
|
+
unfolded. Rows carry
|
|
62
110
|
old and new line numbers, long unchanged runs collapse to their edges and
|
|
63
111
|
expand on click, the pane switches between single-column and side-by-side
|
|
64
|
-
views, expands to nearly the whole panel,
|
|
65
|
-
match highlighting, a match counter,
|
|
112
|
+
views, expands to nearly the whole panel, toggles word wrap (the choice
|
|
113
|
+
persists), and searches its content with match highlighting, a match counter,
|
|
114
|
+
and next/previous stepping. `⌘F` /
|
|
66
115
|
`Ctrl+F` opens that search while the pointer or focus is over the panel, and
|
|
67
116
|
pressing it again focuses the open field with the caret after the query.
|
|
68
117
|
- **File history**: a change row's context menu opens that file's commit history
|
|
@@ -95,25 +144,34 @@ still works through a custom remote URL.
|
|
|
95
144
|
Commit-message generation uses the app's configured default model; a profile
|
|
96
145
|
without a model route reports that generation is unavailable while the rest of
|
|
97
146
|
the panel keeps working.
|
|
147
|
+
Switching a Session between worktrees uses the host's `agents` and
|
|
148
|
+
`workingDirectory` services; a profile that lacks them still lists the
|
|
149
|
+
worktrees but reports that switching is unavailable.
|
|
98
150
|
|
|
99
151
|
## What it does
|
|
100
152
|
|
|
101
|
-
- The message field starts one line tall and grows to six lines;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
153
|
+
- The message field starts one line tall and grows to six lines; the commit
|
|
154
|
+
split button's label states what a click will do — **Commit**, **Commit
|
|
155
|
+
Tracked** (nothing staged: the tracked working changes are staged first, and
|
|
156
|
+
untracked files are left out), **Amend**, or **Amend Tracked** — and its
|
|
157
|
+
chevron menu carries the amend toggle, which fills the field with the
|
|
158
|
+
previous commit message and restores the draft when turned off (an inline
|
|
159
|
+
note marks the amended state).
|
|
160
|
+
- Stage, unstage, discard, and commit (including amend through the commit
|
|
161
|
+
menu). Multi-select works with
|
|
162
|
+
`Ctrl`/`Cmd`-click and `Shift`-click; while a section has a selection its
|
|
163
|
+
header row shows the count plus the stage/unstage/discard commands beside the
|
|
164
|
+
bulk stage-all command, so the list gains no extra row.
|
|
108
165
|
Clicking empty space in the list clears the selection, a right-click on a
|
|
109
166
|
selected row commands the whole selection (an unselected row is selected
|
|
110
167
|
first), and the list no longer takes text selection. A section with a
|
|
111
168
|
selection shows its total and a parenthesised selection count beside the
|
|
112
169
|
title and keeps no per-selection header controls; the row actions and the
|
|
113
170
|
context menu still apply to the whole selection.
|
|
114
|
-
- The
|
|
115
|
-
discard all, stash all (with untracked), commit all, undo the last
|
|
116
|
-
fetch, pull, and
|
|
171
|
+
- The bulk change menu beside the sync row offers stage all, unstage all,
|
|
172
|
+
discard all, stash all (with untracked), commit all, and undo the last
|
|
173
|
+
commit; the sync split control's menu carries fetch, pull, push, and force
|
|
174
|
+
push, including fetching from or pushing to one named remote.
|
|
117
175
|
- Menus, the branch switcher, and dialogs use the host's own surface
|
|
118
176
|
tokens (`--dsw-menu-surface-fill`, `--dsw-menu-backdrop-filter`,
|
|
119
177
|
`--dsw-elevation-prominent`, `--dsw-alias-toast-bg`, the radius and menu-icon
|
|
@@ -121,21 +179,25 @@ the panel keeps working.
|
|
|
121
179
|
in both themes. The bottom toast card follows the active theme's layered
|
|
122
180
|
surface and label colours, tinted only by its tone colour.
|
|
123
181
|
- Context menus on changes, branches, remote branches, commits, commits' files,
|
|
124
|
-
remotes, stashes, and tags: show changes
|
|
182
|
+
remotes, stashes, and tags: show changes in this panel, file
|
|
125
183
|
history,
|
|
126
184
|
stage/unstage, discard, stash the selected paths, add to `.gitignore`, copy a
|
|
127
185
|
path or absolute path, reveal in the file manager, check out a branch, check
|
|
128
186
|
out a commit, create/rename/delete a branch, delete a remote branch, copy a
|
|
129
187
|
commit SHA or message, cherry-pick, revert, apply/pop/drop a stash, and delete
|
|
130
188
|
a tag.
|
|
131
|
-
- **
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
189
|
+
- **Open file reuses one preview**: choosing **Open file** from a change row's
|
|
190
|
+
menu hands the file to the app's own code view. The first open splits the
|
|
191
|
+
docked right Sidebar so the change list stays on the left and the preview opens
|
|
192
|
+
on the right; later opens replace that preview tab instead of adding tabs.
|
|
193
|
+
Deleted files cannot be opened; when the pane cannot split (too narrow, or
|
|
194
|
+
already split) the preview opens as another tab in the active pane.
|
|
195
|
+
- Fetch, pull, and push from the sync split control; a branch with no upstream
|
|
196
|
+
gets one on push. **Fetch From** fetches one named remote and **Push To**
|
|
197
|
+
pushes the current branch to one; **Force Push** confirms first, then pushes
|
|
198
|
+
with a lease. A fetch reports whether remote references actually moved ("no
|
|
199
|
+
new commits" vs "N references updated"), and the remotes header carries the
|
|
200
|
+
last fetch time inline, so freshness costs no extra row.
|
|
139
201
|
Refresh, fetch, pull, push, commit, and branch operations re-read every expanded
|
|
140
202
|
branch's commit list and every expanded commit's files, so refreshed history
|
|
141
203
|
replaces the cached lists instead of leaving stale rows. Branch rows switch
|
|
@@ -144,9 +206,16 @@ the panel keeps working.
|
|
|
144
206
|
branch has unpushed work, amber when it has unpulled commits. Hovering a
|
|
145
207
|
branch that is behind its upstream adds a pull control that fetches and
|
|
146
208
|
fast-forwards exactly that branch (without checking it out); branches with
|
|
147
|
-
nothing to pull show no such control. Committing also offers "commit all
|
|
148
|
-
commit".
|
|
149
|
-
-
|
|
209
|
+
nothing to pull show no such control. Committing also offers "commit all
|
|
210
|
+
changes" and "undo last commit" from the commit split button's menu.
|
|
211
|
+
- Worktree rows move the Session between checkouts: clicking a linked row (or
|
|
212
|
+
its menu's **Switch to this worktree**) asks, then re-reads the panel in the
|
|
213
|
+
new checkout; **New Worktree** creates a branch's checkout in the
|
|
214
|
+
repository's `.agents/worktrees` pool and offers the same move; removal
|
|
215
|
+
retries through an explicit force confirmation when Git refuses a dirty
|
|
216
|
+
checkout, and prune clears registrations whose directories are gone.
|
|
217
|
+
- `⌘Enter` / `Ctrl+Enter` commits from the message field; with nothing staged
|
|
218
|
+
it stages the tracked changes first, exactly like **Commit Tracked**.
|
|
150
219
|
|
|
151
220
|
## Where it appears
|
|
152
221
|
|
|
@@ -162,15 +231,21 @@ JSON route on the shared web server:
|
|
|
162
231
|
|
|
163
232
|
- `POST /api/dsh-git-scm` with `{ sessionId, action, params }`, answered with
|
|
164
233
|
`{ ok: true, data }` or `{ ok: false, error: { code, message, detail } }`.
|
|
165
|
-
Actions: `summary`, `
|
|
166
|
-
`stashDiff`, and `action`.
|
|
234
|
+
Actions: `summary`, `github`, `commitMessage`, `status`, `commits`,
|
|
235
|
+
`commitFiles`, `commitDiff`, `stashDiff`, `fileHistory`, `diff`, and `action`.
|
|
236
|
+
`github` reads the GitHub CLI account for the publish dialog, `commitMessage`
|
|
237
|
+
asks the configured model to write or improve a message, `fileHistory` pages
|
|
238
|
+
one file's commit history, and the one `action` operation that is not a Git
|
|
239
|
+
command — `switchWorktree` — asks the Host to move the Session's working
|
|
240
|
+
directory into a registered checkout after validating it against the
|
|
241
|
+
repository's worktree list.
|
|
167
242
|
- Only same-origin JSON POSTs are admitted. A request names a Session, never a
|
|
168
243
|
path: the Host half resolves the Session's effective working directory through
|
|
169
244
|
the `workingDirectory` service, so a page cannot reach a directory the open
|
|
170
245
|
Session does not already belong to.
|
|
171
246
|
- Reading is lazy: the opening snapshot carries identity, changes, branches,
|
|
172
|
-
stashes, and
|
|
173
|
-
that tree node expands.
|
|
247
|
+
stashes, tags, and the registered worktrees; a branch's commits and a commit's
|
|
248
|
+
files are read only when that tree node expands.
|
|
174
249
|
- Every Git invocation goes through `ctx.subprocess` (executable resolution plus
|
|
175
250
|
a collected spawn) with a fixed prefix that disables hooks, optional index
|
|
176
251
|
writes, and the filesystem monitor. Local commands are bounded at 30 s and
|
|
@@ -180,6 +255,7 @@ JSON route on the shared web server:
|
|
|
180
255
|
|:--|:--|
|
|
181
256
|
| `src/index.ts` | Host half: the JSON route, Session resolution, the subprocess `exec` seam |
|
|
182
257
|
| `src/host/git.ts` | Git command layer: argv construction, machine-output parsing, operations |
|
|
258
|
+
| `src/host/commit-message.ts` | Commit-message prompt construction and model-output cleanup |
|
|
183
259
|
| `src/host/types.ts` | Host-side TypeScript contracts (wire shapes, exec seam, Git results) |
|
|
184
260
|
| `src/client/*.ts(x)` | Browser half sources: panel, trees, menus, diff view, copy, styles |
|
|
185
261
|
| `cordis.patch.yml` | Bundle patch layer; its row `name` equals `package.json#name` |
|
|
@@ -194,11 +270,12 @@ dsh plugin --profile <profile> add dsh-git-scm
|
|
|
194
270
|
```
|
|
195
271
|
|
|
196
272
|
For local development, pack the package and install that tarball (this is the
|
|
197
|
-
closest to the real npm layout
|
|
273
|
+
closest to the real npm layout; replace `<version>` with the `version` in
|
|
274
|
+
`package.json`):
|
|
198
275
|
|
|
199
276
|
```sh
|
|
200
277
|
pnpm --filter dsh-git-scm pack
|
|
201
|
-
dsh plugin --profile dev add ./packages/dsh-git-scm/dsh-git-scm
|
|
278
|
+
dsh plugin --profile dev add ./packages/dsh-git-scm/dsh-git-scm-<version>.tgz
|
|
202
279
|
```
|
|
203
280
|
|
|
204
281
|
The bundle patch inserts the Host row, and the `dsh.client` declaration in
|
|
@@ -219,9 +296,14 @@ pnpm --filter dsh-git-scm dev:client # browser bundle watch
|
|
|
219
296
|
|
|
220
297
|
## TypeScript port
|
|
221
298
|
|
|
222
|
-
This package
|
|
223
|
-
|
|
224
|
-
codes and UI structure
|
|
299
|
+
This package began as a 1:1 TypeScript port of the JavaScript `dsh-git-scm`
|
|
300
|
+
plugin bundled with the DSH checkout: at migration time its behavior, route
|
|
301
|
+
shape, Git argv, error codes, and UI structure matched the original. The two are
|
|
302
|
+
no longer identical — since the port this package has added branch publishing to
|
|
303
|
+
a custom remote or a new GitHub repository, repository initialization,
|
|
304
|
+
model-written commit messages, word wrap in the comparison pane, the Zed-style
|
|
305
|
+
sync and commit split controls with their remote and commit menus, and Git
|
|
306
|
+
worktree management with Session switching.
|
|
225
307
|
|
|
226
308
|
- **Host half** (`src/index.ts`, `src/host/git.ts`): strict TypeScript
|
|
227
309
|
(`tsconfig.json`, extends the repo base). The Cordis context services are
|
|
@@ -244,13 +326,17 @@ codes and UI structure are unchanged.
|
|
|
244
326
|
## Known limitations
|
|
245
327
|
|
|
246
328
|
- One repository per Session: the panel reads the checkout that contains the
|
|
247
|
-
Session's working directory and does not offer a repository picker
|
|
329
|
+
Session's working directory and does not offer a repository picker; switching
|
|
330
|
+
between that repository's worktrees moves the Session's working directory.
|
|
248
331
|
- No merge, rebase, blame, or history graph; conflicts are shown and can be
|
|
249
332
|
staged after they are resolved outside the panel.
|
|
250
333
|
- Branch lists are capped at 500 local and 500 remote branches.
|
|
251
334
|
- A third-party plugin cannot mount the host's diff component, so the docked
|
|
252
335
|
comparison is this plugin's own renderer (line numbers, collapsed unchanged
|
|
253
|
-
runs, side-by-side mode) styled with the host's theme tokens; the host's
|
|
254
|
-
|
|
336
|
+
runs, side-by-side mode) styled with the host's theme tokens; the host's own
|
|
337
|
+
Changes view remains available from its normal sidebar entry.
|
|
338
|
+
- **Open file tracks its own preview.** The panel replaces the preview tab it
|
|
339
|
+
opened; a tab opened from another entry point is reused only when it already
|
|
340
|
+
shows that file. Closing the preview makes the next open split a fresh pane.
|
|
255
341
|
- Authentication for push and pull is Git's own (credential helpers, SSH agent);
|
|
256
342
|
the panel never handles tokens.
|