dsh-git-scm 0.1.0 → 0.2.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 CHANGED
@@ -42,7 +42,17 @@ sidebar and works on the checkout of the Session's current working directory.
42
42
  default keeps that draft's language. The model seam comes from the Host's own
43
43
  runtime, so this package keeps no LLM dependency.
44
44
  - **Changes**: staged changes and working-tree changes (modified, added,
45
- deleted, renamed, copied, conflicting, untracked).
45
+ deleted, renamed, copied, conflicting, untracked; an untracked directory is
46
+ listed as its files, not as one directory row).
47
+ - **Flat list or directory tree**: the staged and working-tree sections open as a
48
+ flat list; the header's view control switches both to a directory tree whose
49
+ folders start expanded and collapse on click. Single-child directory chains
50
+ compact into one `a / b / c` row, the way the Explorer compacts folders, and a
51
+ directory row carries the same hover commands for every file underneath
52
+ (stage/unstage/discard); its changed-file count appears on hover as well. In a
53
+ narrow panel the flat list keeps the file name
54
+ whole and ellipsizes the grey directory suffix instead of hiding it outright;
55
+ the tree keeps its directory rows at any width.
46
56
  - **Change lists right under the repository header**: the staged and
47
57
  working-tree sections follow the header directly; the header row itself
48
58
  carries the refresh, fetch, pull, push, and bulk-action controls, so no
@@ -56,13 +66,13 @@ sidebar and works on the checkout of the Session's current working directory.
56
66
  to dock on the right, where both the divider and the pane's own left edge
57
67
  resize its width (double-clicking a divider restores the default size); the
58
68
  divider is a layout-free seam that sits exactly on the pane border and
59
- highlights on hover, and the dock
60
- always leaves the list at least 300px wide (a narrower panel shrinks the
61
- preview instead). Rows carry
69
+ 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
62
71
  old and new line numbers, long unchanged runs collapse to their edges and
63
72
  expand on click, the pane switches between single-column and side-by-side
64
- views, expands to nearly the whole panel, and searches its content with
65
- match highlighting, a match counter, and next/previous stepping. `⌘F` /
73
+ views, expands to nearly the whole panel, toggles word wrap (the choice
74
+ persists), and searches its content with match highlighting, a match counter,
75
+ and next/previous stepping. `⌘F` /
66
76
  `Ctrl+F` opens that search while the pointer or focus is over the panel, and
67
77
  pressing it again focuses the open field with the caret after the query.
68
78
  - **File history**: a change row's context menu opens that file's commit history
@@ -102,9 +112,9 @@ the panel keeps working.
102
112
  **Amend** fills it with the previous commit message and unticking restores the
103
113
  draft that was there before.
104
114
  - Stage, unstage, discard, and commit (including amend). Multi-select works with
105
- checkboxes, `Ctrl`/`Cmd`-click, and `Shift`-click; while a section has a
106
- selection its header row shows the count plus the stage/unstage/discard
107
- commands beside the bulk stage-all command, so the list gains no extra row.
115
+ `Ctrl`/`Cmd`-click and `Shift`-click; while a section has a selection its
116
+ header row shows the count plus the stage/unstage/discard commands beside the
117
+ bulk stage-all command, so the list gains no extra row.
108
118
  Clicking empty space in the list clears the selection, a right-click on a
109
119
  selected row commands the whole selection (an unselected row is selected
110
120
  first), and the list no longer takes text selection. A section with a
@@ -121,17 +131,19 @@ the panel keeps working.
121
131
  in both themes. The bottom toast card follows the active theme's layered
122
132
  surface and label colours, tinted only by its tone colour.
123
133
  - Context menus on changes, branches, remote branches, commits, commits' files,
124
- remotes, stashes, and tags: show changes, preview in this panel, file
134
+ remotes, stashes, and tags: show changes in this panel, file
125
135
  history,
126
136
  stage/unstage, discard, stash the selected paths, add to `.gitignore`, copy a
127
137
  path or absolute path, reveal in the file manager, check out a branch, check
128
138
  out a commit, create/rename/delete a branch, delete a remote branch, copy a
129
139
  commit SHA or message, cherry-pick, revert, apply/pop/drop a stash, and delete
130
140
  a tag.
131
- - **Show changes** hands the file to the app's own changes view (`本地变更` /
132
- `变更请求`, the rich review tab) scrolled to that file, through
133
- `ctx.sidebarRight.openResource('dsh-resource://forge-changes/<session>/local',
134
- { params: { path } })`; the comparison pane's hand-off button does the same.
141
+ - **Open file reuses one preview**: choosing **Open file** from a change row's
142
+ menu hands the file to the app's own code view. The first open splits the
143
+ docked right Sidebar so the change list stays on the left and the preview opens
144
+ on the right; later opens replace that preview tab instead of adding tabs.
145
+ Deleted files cannot be opened; when the pane cannot split (too narrow, or
146
+ already split) the preview opens as another tab in the active pane.
135
147
  - Fetch all remotes, pull, and push; a branch with no upstream gets one on push.
136
148
  A fetch reports whether remote references actually moved ("no new commits" vs
137
149
  "N references updated"), and the remotes header carries the last fetch time
@@ -162,8 +174,11 @@ JSON route on the shared web server:
162
174
 
163
175
  - `POST /api/dsh-git-scm` with `{ sessionId, action, params }`, answered with
164
176
  `{ ok: true, data }` or `{ ok: false, error: { code, message, detail } }`.
165
- Actions: `summary`, `status`, `diff`, `commits`, `commitFiles`, `commitDiff`,
166
- `stashDiff`, and `action`.
177
+ Actions: `summary`, `github`, `commitMessage`, `status`, `commits`,
178
+ `commitFiles`, `commitDiff`, `stashDiff`, `fileHistory`, `diff`, and `action`.
179
+ `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.
167
182
  - Only same-origin JSON POSTs are admitted. A request names a Session, never a
168
183
  path: the Host half resolves the Session's effective working directory through
169
184
  the `workingDirectory` service, so a page cannot reach a directory the open
@@ -180,6 +195,7 @@ JSON route on the shared web server:
180
195
  |:--|:--|
181
196
  | `src/index.ts` | Host half: the JSON route, Session resolution, the subprocess `exec` seam |
182
197
  | `src/host/git.ts` | Git command layer: argv construction, machine-output parsing, operations |
198
+ | `src/host/commit-message.ts` | Commit-message prompt construction and model-output cleanup |
183
199
  | `src/host/types.ts` | Host-side TypeScript contracts (wire shapes, exec seam, Git results) |
184
200
  | `src/client/*.ts(x)` | Browser half sources: panel, trees, menus, diff view, copy, styles |
185
201
  | `cordis.patch.yml` | Bundle patch layer; its row `name` equals `package.json#name` |
@@ -194,11 +210,12 @@ dsh plugin --profile <profile> add dsh-git-scm
194
210
  ```
195
211
 
196
212
  For local development, pack the package and install that tarball (this is the
197
- closest to the real npm layout):
213
+ closest to the real npm layout; replace `<version>` with the `version` in
214
+ `package.json`):
198
215
 
199
216
  ```sh
200
217
  pnpm --filter dsh-git-scm pack
201
- dsh plugin --profile dev add ./packages/dsh-git-scm/dsh-git-scm-0.1.0.tgz
218
+ dsh plugin --profile dev add ./packages/dsh-git-scm/dsh-git-scm-<version>.tgz
202
219
  ```
203
220
 
204
221
  The bundle patch inserts the Host row, and the `dsh.client` declaration in
@@ -219,9 +236,12 @@ pnpm --filter dsh-git-scm dev:client # browser bundle watch
219
236
 
220
237
  ## TypeScript port
221
238
 
222
- This package is a 1:1 TypeScript port of the JavaScript plugin at
223
- `<DSH checkout>/.dsh-plugins/dsh-git-scm`; behavior, route shape, Git argv, error
224
- codes and UI structure are unchanged.
239
+ This package began as a 1:1 TypeScript port of the JavaScript `dsh-git-scm`
240
+ plugin bundled with the DSH checkout: at migration time its behavior, route
241
+ shape, Git argv, error codes, and UI structure matched the original. The two are
242
+ no longer identical — since the port this package has added branch publishing to
243
+ a custom remote or a new GitHub repository, repository initialization,
244
+ model-written commit messages, and word wrap in the comparison pane.
225
245
 
226
246
  - **Host half** (`src/index.ts`, `src/host/git.ts`): strict TypeScript
227
247
  (`tsconfig.json`, extends the repo base). The Cordis context services are
@@ -250,7 +270,10 @@ codes and UI structure are unchanged.
250
270
  - Branch lists are capped at 500 local and 500 remote branches.
251
271
  - A third-party plugin cannot mount the host's diff component, so the docked
252
272
  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 real
254
- changes view is one click away in the comparison header and the context menu.
273
+ runs, side-by-side mode) styled with the host's theme tokens; the host's own
274
+ Changes view remains available from its normal sidebar entry.
275
+ - **Open file tracks its own preview.** The panel replaces the preview tab it
276
+ opened; a tab opened from another entry point is reused only when it already
277
+ shows that file. Closing the preview makes the next open split a fresh pane.
255
278
  - Authentication for push and pull is Git's own (credential helpers, SSH agent);
256
279
  the panel never handles tokens.