@lukstei/dsh-client-review-git 0.0.0-stage → 0.2.2-rc.5.11
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/LICENSE +21 -0
- package/README.md +144 -2
- package/cordis.patch.yml +4 -0
- package/dist/client.js +3378 -0
- package/dist/host.js +1101 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +611 -0
- package/lib/typert.remote-client.d.ts +37 -0
- package/lib/typert.remote-client.d.ts.map +1 -0
- package/lib/typert.remote-client.js +505 -0
- package/package.json +156 -3
- package/src/client/FileInspector.tsx +162 -0
- package/src/client/GitDiffPane.tsx +252 -0
- package/src/client/GitReviewCard.tsx +202 -0
- package/src/client/GitReviewRow.tsx +191 -0
- package/src/client/ReviewToolbar.tsx +470 -0
- package/src/client/contract.ts +27 -0
- package/src/client/css.d.ts +5 -0
- package/src/client/index.tsx +230 -0
- package/src/client/review-turn.ts +193 -0
- package/src/client/reviewSelection.ts +14 -0
- package/src/client/useLoad.ts +38 -0
- package/src/client/useReviewViewState.ts +244 -0
- package/src/git-service.ts +845 -0
- package/src/index.ts +67 -0
- package/src/review-tool.ts +85 -0
- package/src/workspace-review-service.ts +400 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lukas Steinbrecher
|
|
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,145 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lukstei/dsh-client-review-git
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Read-only Git review for DSH sessions. A Workspace Review sidebar tab and a split-pane overlay compare branches, single commits, and staged or unstaged changes in the repositories a session touched. The agent can post a review card into the chat with `git_review_present`.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Use this package](#use-this-package)
|
|
10
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
11
|
+
- [Further Exploration](#further-exploration)
|
|
12
|
+
- [Model Experience](#model-experience)
|
|
13
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
14
|
+
- [Dev Note](#dev-note)
|
|
15
|
+
|
|
16
|
+
-----
|
|
17
|
+
|
|
18
|
+
<a id="use-this-package"></a>
|
|
19
|
+
## Use this package
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
- insert:
|
|
23
|
+
- id: dsh-client-git-diff
|
|
24
|
+
name: '@lukstei/dsh-client-review-git'
|
|
25
|
+
config: {}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
No config. Host entry `inject`: `sessionController`, `workingDirectory`, `sessions`, `sessionPersistence`; the tool part also needs `tools` and `agents`. Client (`platform: web`, `immediately: true`) needs `sidebarRightTabs`, `slots`, `remote`, `uiConversation`. It mounts the typed, session-addressed `workspaceReview` Remote (methods `catalog`, `resolve`, `commits`, `view`, `file`). Reload host and client together after an upgrade.
|
|
29
|
+
|
|
30
|
+
### Plugin dependencies
|
|
31
|
+
|
|
32
|
+
Server-side and client-side entries. Patch row id: `dsh-client-git-diff`.
|
|
33
|
+
|
|
34
|
+
**Server-side** (`inject`: `sessionController`, `workingDirectory`, `sessions`, `sessionPersistence`; child plugin for the tool injects `tools`, `agents`):
|
|
35
|
+
|
|
36
|
+
| Plugin / service | Required? | Provided by | Effect without it |
|
|
37
|
+
|---|---|---|---|
|
|
38
|
+
| `sessionController` | Required | @deepseek-ai/dsh-api-session-controller | Plugin stays pending; never applies. No `workspaceReview` Remote service and no `git_review_present` tool. |
|
|
39
|
+
| `workingDirectory` | Required | @deepseek-ai/dsh-working-directory | Plugin stays pending; never applies. |
|
|
40
|
+
| `sessions` | Required | @deepseek-ai/dsh-session | Plugin stays pending; never applies. |
|
|
41
|
+
| `sessionPersistence` | Required | @deepseek-ai/dsh-session-persistence | Plugin stays pending; never applies. |
|
|
42
|
+
| `tools`, `agents` | Required for the tool | @deepseek-ai/dsh-tools, @deepseek-ai/dsh-agent | Child plugin stays pending: `git_review_present` not registered; the Remote service still runs. |
|
|
43
|
+
|
|
44
|
+
**Client-side** (`inject`: `sidebarRightTabs`, `slots`, `remote`, `uiConversation`):
|
|
45
|
+
|
|
46
|
+
| Plugin / service | Required? | Provided by | Effect without it |
|
|
47
|
+
|---|---|---|---|
|
|
48
|
+
| `sidebarRightTabs`, `slots`, `remote`, `uiConversation` | Required | @deepseek-ai/dsh-client-ui-sidebar-right, @deepseek-ai/dsh-client-ui-slots, @deepseek-ai/dsh-api-gateway, @deepseek-ai/dsh-client-ui-conversation (also `-chat` in `dsh.client.inject`) | Plugin stays pending; never applies. No review UI. |
|
|
49
|
+
| `splitView` + `remote.workspaceReview` | Optional | [`@lukstei/dsh-client-split-view`](../dsh-client-split-view/README.md); `workspaceReview` is this package's host service | Nested plugin stays pending: review cards cannot open the split-pane overlay (`opener` stays unset) and the pane-header review action is not registered. |
|
|
50
|
+
|
|
51
|
+
Code imports (no mount): [`@lukstei/util-review-ui`](../util-review-ui/README.md) (`review`, `types`, client components). Declared deps `@deepseek-ai/dsh-tool-present` are libraries; no `present` service is injected.
|
|
52
|
+
|
|
53
|
+
Used by: nothing.
|
|
54
|
+
|
|
55
|
+
### UI
|
|
56
|
+
|
|
57
|
+
- **Workspace Review** tab in the right sidebar (id `dsh-client-git-diff`), plus the `gitdiff.review` slot factory used by split-view overlays.
|
|
58
|
+
- With [`@lukstei/dsh-client-split-view`](../dsh-client-split-view/README.md), a sub-plugin adds a header button (`split.pane.header.actions`) that toggles the `gitdiff.review` overlay on that pane's session.
|
|
59
|
+
- The toolbar offers a repository dropdown when the session touched several repositories (a static label for one), then scopes: **Branches** (default **All commits**, with a separate commit dropdown) and **Working tree** (**Staged**, **Unstaged**).
|
|
60
|
+
- One file tree combines navigation and contents. Files start collapsed; click to expand inline. Rows show addition and deletion counts. File contents load on expansion and are cached until refresh.
|
|
61
|
+
- Selecting code offers a quote that is inserted into the conversation composer (clipboard copy when no composer is available).
|
|
62
|
+
- View state (repository, scope, expanded files, scroll, wrap) is kept per session in `localStorage` (`dsh-client-review-git:state:v1:<sessionId>`) for 24 hours.
|
|
63
|
+
|
|
64
|
+
### Scopes
|
|
65
|
+
|
|
66
|
+
- **Branch vs baseline.** Ordinary Git branches compare against the merge base with the remote's recorded default branch. Without exactly one `refs/remotes/*/HEAD` target, pick a baseline manually. GitButler-managed branches compare against the branch directly below them; bottom and standalone branches use `but --json config target`. A GitButler failure is shown without blocking plain Git comparisons.
|
|
67
|
+
- When GitButler inspection succeeds, `gitbutler/workspace`, `gitbutler/target` and `main` are hidden from the branch list but stay available as baselines. Branches without a commit in the last 7 days are not offered.
|
|
68
|
+
- **Commit.** Compares a commit with its first parent; a root commit shows its initial files. History loads 50 entries at a time.
|
|
69
|
+
- **Staged** compares HEAD with the index (including before the first commit). **Unstaged** compares the index with the working tree and includes non-ignored untracked files as additions. Both cover the current checkout, including a GitButler workspace.
|
|
70
|
+
- Git supplies changed-file metadata and counts. Hunks are computed client-side from both complete files, so expanding context needs no further reads. Binary or non-UTF-8 files and unresolved conflicts show a notice.
|
|
71
|
+
- Refresh reloads the repository and branch list. Reads never check out, fetch, or change Git state.
|
|
72
|
+
|
|
73
|
+
### Repository discovery
|
|
74
|
+
|
|
75
|
+
The session's current directory repository is always included. Further repositories come from files written or edited through the native `write`/`edit` tools (including calls via `run_code`) after the last working-directory change, with no file-count limit. Directory lookups are memoized. Refresh retries discovery. Shell edits and tools without path metadata are not discovered. A request for a repository outside this list is rejected.
|
|
76
|
+
|
|
77
|
+
-----
|
|
78
|
+
|
|
79
|
+
<a id="understand-the-implementation"></a>
|
|
80
|
+
## Understand the implementation
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary>Implementation internals — click to expand</summary>
|
|
84
|
+
|
|
85
|
+
| File | Role |
|
|
86
|
+
|---|---|
|
|
87
|
+
| [src/index.ts](src/index.ts) | Host entry: mounts `WorkspaceReviewService`, registers the tool, persists presented cards |
|
|
88
|
+
| [src/review-tool.ts](src/review-tool.ts) | `createGitReviewTool` (`git_review_present`) |
|
|
89
|
+
| [src/workspace-review-service.ts](src/workspace-review-service.ts) | `workspaceReview` Remote: session repository discovery and methods |
|
|
90
|
+
| [src/git-service.ts](src/git-service.ts) | `git` and `but` calls: repositories, scopes, commits, compare, file contents |
|
|
91
|
+
| [src/client/index.tsx](src/client/index.tsx) | Client entry: sidebar tab, slot factory, card slots, split sub-plugin |
|
|
92
|
+
| [src/client/contract.ts](src/client/contract.ts) | `gitdiff.review` factory and `tool.call.toolview` slot augmentations |
|
|
93
|
+
| [src/client/review-turn.ts](src/client/review-turn.ts) | Turn data node `git-review`, built from `command/run` events |
|
|
94
|
+
| `src/client/GitDiffPane.tsx`, `ReviewToolbar.tsx`, `FileInspector.tsx`, `GitReviewCard.tsx`, `GitReviewRow.tsx`, `useReviewViewState.ts` | UI and view state |
|
|
95
|
+
| [scripts/gen-typert.ts](scripts/gen-typert.ts) | Generates `lib/typert.host.*` and `lib/typert.remote-client.*` (`pnpm run gen:typert`, part of build/typecheck) |
|
|
96
|
+
|
|
97
|
+
On a successful `git_review_present` result the host appends a `command/run` (`git-review`, args `{ turn, callId, target }`) and a `command/done` event to the session. The client rebuilds cards from those events, so reloads and replays show the same cards. Review scope resolution is deferred to click time through `workspaceReview.resolve`. Cards render in `conversation.chat.turnTail`; the tool call row renders in `tool.call.toolview`.
|
|
98
|
+
|
|
99
|
+
Shared components and schemas come from [`@lukstei/util-review-ui`](../util-review-ui/README.md). Trust boundary: every Remote call is session-scoped and `repository` must be in the session's discovered list; git and `but` run as read-only commands.
|
|
100
|
+
|
|
101
|
+
Tests: unit specs beside sources; integration specs in [src/integration/](src/integration/) (`pnpm run test:integration`).
|
|
102
|
+
|
|
103
|
+
</details>
|
|
104
|
+
|
|
105
|
+
-----
|
|
106
|
+
|
|
107
|
+
<a id="further-exploration"></a>
|
|
108
|
+
## Further Exploration
|
|
109
|
+
|
|
110
|
+
- Upstream: [DSH module graph](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/module-graph.md).
|
|
111
|
+
- [`@lukstei/util-review-ui`](../util-review-ui/README.md), [`@lukstei/dsh-client-split-view`](../dsh-client-split-view/README.md).
|
|
112
|
+
|
|
113
|
+
<a id="model-experience"></a>
|
|
114
|
+
## Model Experience
|
|
115
|
+
|
|
116
|
+
### git_review_present
|
|
117
|
+
|
|
118
|
+
#### What the model sees
|
|
119
|
+
|
|
120
|
+
Description: "Present a Git review card in the transcript. Always use it instead of writing the branch and commit into the reply when the user should inspect them." Parameters: `repository` (optional absolute path, or path relative to the session working directory, to a file or directory inside the repo; defaults to the working directory), `branch` (required, local branch name or full ref), `commit` (optional SHA or ref on `branch`; reviews that commit alone). Result text: `Git review ready: <branch> @ <short sha> (<repo name>)`, the commit and repo parts only when present.
|
|
121
|
+
|
|
122
|
+
#### Token effect
|
|
123
|
+
|
|
124
|
+
One tool schema per mounted agent and one short result line per call.
|
|
125
|
+
|
|
126
|
+
#### KV Cache effect
|
|
127
|
+
|
|
128
|
+
The schema is static for the mount lifetime. Results extend the conversation without rewriting its prefix.
|
|
129
|
+
|
|
130
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
131
|
+
## Known Limitations and Deferred Work
|
|
132
|
+
|
|
133
|
+
- The review card's open button needs Split View. Without it the call succeeds and the card shows, but it has no open action.
|
|
134
|
+
- Repository discovery ignores shell edits and tools without file path metadata.
|
|
135
|
+
- GitButler support relies on the `but` CLI being on the host `PATH`.
|
|
136
|
+
|
|
137
|
+
<a id="dev-note"></a>
|
|
138
|
+
### Dev Note
|
|
139
|
+
|
|
140
|
+
<details>
|
|
141
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
142
|
+
|
|
143
|
+
`pnpm run verify` runs Biome, typert generation and build, typecheck, unit and integration tests. `pnpm run ladle` serves component stories.
|
|
144
|
+
|
|
145
|
+
</details>
|
package/cordis.patch.yml
ADDED