dsh-git-scm 0.2.0 → 0.3.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/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 name, a status-bar-style branch chip whose
10
- branch name opens a searchable branch switcher (local and remote branches,
11
- with the dirty `*` / staged `+` markers and ahead/behind counts) and whose
12
- cloud control publishes the branch when it has no upstream, hover tooltips
13
- naming the repository, branch, and action, upstream, and the last fetch time.
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 header's push control routes
16
- a missing remote into the publish dialog instead of failing: choose a private
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 push controls.
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
@@ -43,7 +61,9 @@ sidebar and works on the checkout of the Session's current working directory.
43
61
  runtime, so this package keeps no LLM dependency.
44
62
  - **Changes**: staged changes and working-tree changes (modified, added,
45
63
  deleted, renamed, copied, conflicting, untracked; an untracked directory is
46
- listed as its files, not as one directory row).
64
+ listed as its files, not as one directory row). File names stay on one line:
65
+ the directory suffix yields first, and a name that still does not fit ends
66
+ with an ellipsis instead of wrapping or dropping its extension.
47
67
  - **Flat list or directory tree**: the staged and working-tree sections open as a
48
68
  flat list; the header's view control switches both to a directory tree whose
49
69
  folders start expanded and collapse on click. Single-child directory chains
@@ -54,12 +74,29 @@ sidebar and works on the checkout of the Session's current working directory.
54
74
  whole and ellipsizes the grey directory suffix instead of hiding it outright;
55
75
  the tree keeps its directory rows at any width.
56
76
  - **Change lists right under the repository header**: the staged and
57
- working-tree sections follow the header directly; the header row itself
58
- carries the refresh, fetch, pull, push, and bulk-action controls, so no
59
- separate "Changes" group row takes space.
60
- - **A collapsible Git repositories group** (branches, remotes, stashes, tags)
61
- whose sections are indented under it; every section collapses on its own and
62
- the group title carries no counter.
77
+ working-tree sections follow the header directly; the header row carries
78
+ refresh and the sync split control, the sync row beside it carries the view
79
+ toggle and the bulk change menu, so no separate "Changes" group row takes
80
+ space.
81
+ - **A collapsible Git repositories group** (worktrees, branches, remotes,
82
+ stashes, tags) whose sections are indented under it; every section collapses
83
+ on its own and the group title carries no counter.
84
+ - **Worktrees**: the repository's checkouts in one list ahead of the branches —
85
+ the main checkout, linked ones, and registrations whose directory is gone
86
+ (marked missing, carrying Git's prune reason). A row names its branch and
87
+ shows the directory relative to this checkout; the current one is marked, and
88
+ a locked one says so. The row menu offers **Switch to this worktree**, **Copy
89
+ worktree path**, and **Remove worktree**; removal asks first and, when the
90
+ checkout has uncommitted changes, offers an explicit **Force Remove** after a
91
+ second confirmation. A missing registration offers **Prune missing worktrees**
92
+ instead. The section's **New Worktree** action creates a branch at the current
93
+ HEAD in `<repository>/.agents/worktrees/<slug>` (the pool keeps itself out of
94
+ Git's status through a `.gitignore` of `*`), or checks out an existing local
95
+ branch there, then offers to move this Session into the new checkout.
96
+ Clicking a linked row — or confirming a switch — moves the Session's working
97
+ directory into that checkout, and the panel re-reads itself there. A linked
98
+ checkout marks the header with a compact folder-glyph badge whose tooltip
99
+ names its path.
63
100
  - **Docked comparison**: clicking a changed file, a commit's file, or a stash
64
101
  opens its comparison in a pane that docks below the list by default (a
65
102
  draggable divider resizes it and the size is remembered) and can be switched
@@ -67,7 +104,11 @@ sidebar and works on the checkout of the Session's current working directory.
67
104
  resize its width (double-clicking a divider restores the default size); the
68
105
  divider is a layout-free seam that sits exactly on the pane border and
69
106
  highlights on hover, and the dock keeps a 280px minimum while stopping at the
70
- list's 300px reservation when the panel is wide enough. Rows carry
107
+ list's 300px reservation when the panel is wide enough. The title row is a
108
+ disclosure control: clicking it folds the body to one strip and clicking it
109
+ again unfolds it. A panel narrower than 580px starts the comparison folded
110
+ below the list, while a fullscreen Sidebar opens it docked on the right and
111
+ unfolded. Rows carry
71
112
  old and new line numbers, long unchanged runs collapse to their edges and
72
113
  expand on click, the pane switches between single-column and side-by-side
73
114
  views, expands to nearly the whole panel, toggles word wrap (the choice
@@ -82,7 +123,9 @@ sidebar and works on the checkout of the Session's current working directory.
82
123
  a filterable file list with per-file `+n/−n` counts and the commit totals;
83
124
  opening a file shows its diff for the commit, with one control back to the
84
125
  review. Choosing another commit replaces the review in the same pane.
85
- - **Branches**: every local branch with its upstream and last commit date,
126
+ - **Branches**: every local branch with its upstream and last commit date.
127
+ Long branch names stay on one line and end with an ellipsis when they do not
128
+ fit (the upstream path and relative date yield first),
86
129
  coloured the way VS Code shows them — green `↑n` for local commits the remote
87
130
  does not have, amber `↓n` for remote commits not pulled yet, and a green `▲+`
88
131
  unpublished mark for a branch with no upstream. Green is reserved for work that
@@ -105,13 +148,21 @@ still works through a custom remote URL.
105
148
  Commit-message generation uses the app's configured default model; a profile
106
149
  without a model route reports that generation is unavailable while the rest of
107
150
  the panel keeps working.
151
+ Switching a Session between worktrees uses the host's `agents` and
152
+ `workingDirectory` services; a profile that lacks them still lists the
153
+ worktrees but reports that switching is unavailable.
108
154
 
109
155
  ## What it does
110
156
 
111
- - The message field starts one line tall and grows to six lines; ticking
112
- **Amend** fills it with the previous commit message and unticking restores the
113
- draft that was there before.
114
- - Stage, unstage, discard, and commit (including amend). Multi-select works with
157
+ - The message field starts one line tall and grows to six lines; the commit
158
+ split button's label states what a click will do — **Commit**, **Commit
159
+ Tracked** (nothing staged: the tracked working changes are staged first, and
160
+ untracked files are left out), **Amend**, or **Amend Tracked** — and its
161
+ chevron menu carries the amend toggle, which fills the field with the
162
+ previous commit message and restores the draft when turned off (an inline
163
+ note marks the amended state).
164
+ - Stage, unstage, discard, and commit (including amend through the commit
165
+ menu). Multi-select works with
115
166
  `Ctrl`/`Cmd`-click and `Shift`-click; while a section has a selection its
116
167
  header row shows the count plus the stage/unstage/discard commands beside the
117
168
  bulk stage-all command, so the list gains no extra row.
@@ -121,9 +172,10 @@ the panel keeps working.
121
172
  selection shows its total and a parenthesised selection count beside the
122
173
  title and keeps no per-selection header controls; the row actions and the
123
174
  context menu still apply to the whole selection.
124
- - The repository header's more-actions menu offers stage all, unstage all,
125
- discard all, stash all (with untracked), commit all, undo the last commit,
126
- fetch, pull, and push.
175
+ - The bulk change menu beside the sync row offers stage all, unstage all,
176
+ discard all, stash all (with untracked), commit all, and undo the last
177
+ commit; the sync split control's menu carries fetch, pull, push, and force
178
+ push, including fetching from or pushing to one named remote.
127
179
  - Menus, the branch switcher, and dialogs use the host's own surface
128
180
  tokens (`--dsw-menu-surface-fill`, `--dsw-menu-backdrop-filter`,
129
181
  `--dsw-elevation-prominent`, `--dsw-alias-toast-bg`, the radius and menu-icon
@@ -144,10 +196,12 @@ the panel keeps working.
144
196
  on the right; later opens replace that preview tab instead of adding tabs.
145
197
  Deleted files cannot be opened; when the pane cannot split (too narrow, or
146
198
  already split) the preview opens as another tab in the active pane.
147
- - Fetch all remotes, pull, and push; a branch with no upstream gets one on push.
148
- A fetch reports whether remote references actually moved ("no new commits" vs
149
- "N references updated"), and the remotes header carries the last fetch time
150
- inline, so freshness costs no extra row.
199
+ - Fetch, pull, and push from the sync split control; a branch with no upstream
200
+ gets one on push. **Fetch From** fetches one named remote and **Push To**
201
+ pushes the current branch to one; **Force Push** confirms first, then pushes
202
+ with a lease. A fetch reports whether remote references actually moved ("no
203
+ new commits" vs "N references updated"), and the remotes header carries the
204
+ last fetch time inline, so freshness costs no extra row.
151
205
  Refresh, fetch, pull, push, commit, and branch operations re-read every expanded
152
206
  branch's commit list and every expanded commit's files, so refreshed history
153
207
  replaces the cached lists instead of leaving stale rows. Branch rows switch
@@ -156,9 +210,16 @@ the panel keeps working.
156
210
  branch has unpushed work, amber when it has unpulled commits. Hovering a
157
211
  branch that is behind its upstream adds a pull control that fetches and
158
212
  fast-forwards exactly that branch (without checking it out); branches with
159
- nothing to pull show no such control. Committing also offers "commit all changes" and "undo last
160
- commit".
161
- - `⌘Enter` / `Ctrl+Enter` commits from the message field.
213
+ nothing to pull show no such control. Committing also offers "commit all
214
+ changes" and "undo last commit" from the commit split button's menu.
215
+ - Worktree rows move the Session between checkouts: clicking a linked row (or
216
+ its menu's **Switch to this worktree**) asks, then re-reads the panel in the
217
+ new checkout; **New Worktree** creates a branch's checkout in the
218
+ repository's `.agents/worktrees` pool and offers the same move; removal
219
+ retries through an explicit force confirmation when Git refuses a dirty
220
+ checkout, and prune clears registrations whose directories are gone.
221
+ - `⌘Enter` / `Ctrl+Enter` commits from the message field; with nothing staged
222
+ it stages the tracked changes first, exactly like **Commit Tracked**.
162
223
 
163
224
  ## Where it appears
164
225
 
@@ -177,15 +238,18 @@ JSON route on the shared web server:
177
238
  Actions: `summary`, `github`, `commitMessage`, `status`, `commits`,
178
239
  `commitFiles`, `commitDiff`, `stashDiff`, `fileHistory`, `diff`, and `action`.
179
240
  `github` reads the GitHub CLI account for the publish dialog, `commitMessage`
180
- asks the configured model to write or improve a message, and `fileHistory`
181
- pages one file's commit history.
241
+ asks the configured model to write or improve a message, `fileHistory` pages
242
+ one file's commit history, and the one `action` operation that is not a Git
243
+ command — `switchWorktree` — asks the Host to move the Session's working
244
+ directory into a registered checkout after validating it against the
245
+ repository's worktree list.
182
246
  - Only same-origin JSON POSTs are admitted. A request names a Session, never a
183
247
  path: the Host half resolves the Session's effective working directory through
184
248
  the `workingDirectory` service, so a page cannot reach a directory the open
185
249
  Session does not already belong to.
186
250
  - Reading is lazy: the opening snapshot carries identity, changes, branches,
187
- stashes, and tags; a branch's commits and a commit's files are read only when
188
- that tree node expands.
251
+ stashes, tags, and the registered worktrees; a branch's commits and a commit's
252
+ files are read only when that tree node expands.
189
253
  - Every Git invocation goes through `ctx.subprocess` (executable resolution plus
190
254
  a collected spawn) with a fixed prefix that disables hooks, optional index
191
255
  writes, and the filesystem monitor. Local commands are bounded at 30 s and
@@ -241,7 +305,9 @@ plugin bundled with the DSH checkout: at migration time its behavior, route
241
305
  shape, Git argv, error codes, and UI structure matched the original. The two are
242
306
  no longer identical — since the port this package has added branch publishing to
243
307
  a custom remote or a new GitHub repository, repository initialization,
244
- model-written commit messages, and word wrap in the comparison pane.
308
+ model-written commit messages, word wrap in the comparison pane, the Zed-style
309
+ sync and commit split controls with their remote and commit menus, and Git
310
+ worktree management with Session switching.
245
311
 
246
312
  - **Host half** (`src/index.ts`, `src/host/git.ts`): strict TypeScript
247
313
  (`tsconfig.json`, extends the repo base). The Cordis context services are
@@ -264,7 +330,8 @@ model-written commit messages, and word wrap in the comparison pane.
264
330
  ## Known limitations
265
331
 
266
332
  - One repository per Session: the panel reads the checkout that contains the
267
- Session's working directory and does not offer a repository picker.
333
+ Session's working directory and does not offer a repository picker; switching
334
+ between that repository's worktrees moves the Session's working directory.
268
335
  - No merge, rebase, blame, or history graph; conflicts are shown and can be
269
336
  staged after they are resolved outside the panel.
270
337
  - Branch lists are capped at 500 local and 500 remote branches.