dsh-coding-enhanced 0.8.2 → 0.8.4
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 +4 -3
- package/docs/review-prompts-and-chain.md +319 -0
- package/lib/client.js +2 -2
- package/lib/index.js +19 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -265,7 +265,7 @@ Open **Settings → Coding Enhanced** (the same controls appear on the plugin's
|
|
|
265
265
|
| Setting | Default | What it does |
|
|
266
266
|
|---|---|---|
|
|
267
267
|
| **Change gate** (`AI Change Review`) | on | the pre-write review gate for `review_write` / `review_patch` |
|
|
268
|
-
| **AI explanations** | on | require
|
|
268
|
+
| **AI explanations** | on | require at least one note per changed file; line-level notes for user-requested/key/hard changes; off = no notes and no AI rows |
|
|
269
269
|
| **Workspace time machine** (`Turn Withdraw`) | on | turn-start snapshots, multi-turn withdraw and the restore action |
|
|
270
270
|
| **Turns kept for withdraw** | 10 | how many recent turns stay withdrawable (1–50) |
|
|
271
271
|
| **Snapshot nested git repositories** | on | include nested repositories' working files (excluding `.git`) |
|
|
@@ -407,8 +407,9 @@ already covers the “beautiful diff panel” case. Next:
|
|
|
407
407
|
- **P4 — external AI adversarial cross-review**: review-scoped tokens,
|
|
408
408
|
participants, verdicts, proposals.
|
|
409
409
|
|
|
410
|
-
See [the architecture](docs/web-review-architecture.md)
|
|
411
|
-
survey](docs/prior-art.md).
|
|
410
|
+
See [the architecture](docs/web-review-architecture.md), [the prior-art
|
|
411
|
+
survey](docs/prior-art.md), and [the review contract](docs/review-prompts-and-chain.md)
|
|
412
|
+
for the exact prompts and the full chain.
|
|
412
413
|
|
|
413
414
|
## 🛠️ Development
|
|
414
415
|
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# Review contract: prompts & chain
|
|
2
|
+
|
|
3
|
+
> Version: **0.8.4** · Date: 2026-11-22 · Source: `dsh-coding-enhanced`
|
|
4
|
+
>
|
|
5
|
+
> This document records the exact prompts, tool contracts and execution chain
|
|
6
|
+
> of the AI change-review workflow. It is intended as a reference for
|
|
7
|
+
> documentation and blog posts; the code is authoritative if the two differ.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Positioning
|
|
12
|
+
|
|
13
|
+
`dsh-coding-enhanced` is **not another AI PR reviewer**. It is a workflow layer
|
|
14
|
+
for DSH agents:
|
|
15
|
+
|
|
16
|
+
- **Pre-write change gate** — native file tools are refused while Pre-review is on;
|
|
17
|
+
the agent queues `review_write` / `review_patch`; nothing lands until the user
|
|
18
|
+
finishes.
|
|
19
|
+
- **Workspace time machine** — per-turn shadow-git snapshots and multi-turn withdraw.
|
|
20
|
+
- **Non-blocking review handoff** — the plugin starts a persistent waiter child;
|
|
21
|
+
the main agent continues or ends its turn and is woken when the review finishes.
|
|
22
|
+
- **Remote + cross-AI** — planned: passkey web review and an external cross-review API.
|
|
23
|
+
|
|
24
|
+
The direct prior art is [`9087/dsh-diff-approval`](https://github.com/9087/dsh-diff-approval)
|
|
25
|
+
(a post-edit review panel). The differentiator is the **gate + withdraw + handoff**,
|
|
26
|
+
not the diff pixels. See [`prior-art.md`](prior-art.md).
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. Architecture
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
┌──────────────────────────── DSH host ────────────────────────────┐
|
|
34
|
+
│ main agent (session) │
|
|
35
|
+
│ ├─ system prompt (the velvet rope) │
|
|
36
|
+
│ ├─ native tools: read / write / edit / ... │
|
|
37
|
+
│ └─ review tools: review_write / review_patch / review_wait │
|
|
38
|
+
│ │
|
|
39
|
+
│ plugin: coding-enhanced (host, lib/index.js) │
|
|
40
|
+
│ ├─ native gate: tools/pre-execute │
|
|
41
|
+
│ ├─ review state: entries / notes / decisions / waitKey │
|
|
42
|
+
│ ├─ per-file notes validation │
|
|
43
|
+
│ ├─ auto waiter: ensureReviewWaiter → ctx.subagents │
|
|
44
|
+
│ ├─ shadow-git snapshots / withdraw │
|
|
45
|
+
│ ├─ settings / updates / RPC /api/coding-enhanced │
|
|
46
|
+
│ └─ client bundle (lib/client.js) │
|
|
47
|
+
│ │
|
|
48
|
+
│ ctx.subagents (manager) │
|
|
49
|
+
│ ├─ spawn provider: a fresh child agent │
|
|
50
|
+
│ └─ fork provider: a child seeded with the parent conversation │
|
|
51
|
+
│ │
|
|
52
|
+
│ review waiter child (spawn) ── review_wait ──► review state │
|
|
53
|
+
│ │ │
|
|
54
|
+
│ └── completion message ──► main agent wakes │
|
|
55
|
+
│ │
|
|
56
|
+
│ client │
|
|
57
|
+
│ ├─ input Review tools: Pre-review / AI explanations │
|
|
58
|
+
│ ├─ Code review tab: diff / AI rows / decisions / Finish │
|
|
59
|
+
│ └─ Settings / plugin page: Updates / About │
|
|
60
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Components
|
|
64
|
+
|
|
65
|
+
| Layer | File | Responsibility |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| Host | `lib/index.js` | system prompt, tools, gate, review state, validation, waiter, settings, snapshots, RPC |
|
|
68
|
+
| Client | `lib/client.js` | Review tools popover, review tab, settings, plugin page, diff and AI rows |
|
|
69
|
+
| DSH | `ctx.tools`, `ctx.subagents`, `ctx.sessions` | tool registry, subagent manager, sessions |
|
|
70
|
+
| Bridge | `/api/coding-enhanced` | authenticated RPC between client and host |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 3. The prompts
|
|
75
|
+
|
|
76
|
+
### 3.1 System prompt (injected every turn while the gate is on)
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change.
|
|
80
|
+
Queue every change with review_write (new file / full file) or review_patch
|
|
81
|
+
(unified diff) and include at least one note per changed file while AI
|
|
82
|
+
explanations are on; add line-level notes for user-requested, key or
|
|
83
|
+
hard-to-understand changes (no upper limit). Do not use write/edit/apply_patch/
|
|
84
|
+
str_replace_editor. The plugin starts or reuses the review waiter automatically:
|
|
85
|
+
after queueing, just continue or end the turn; never call review_wait and do
|
|
86
|
+
not manage a subagent. If a file is rejected, read the comment and revise.
|
|
87
|
+
This is house rules. 💅
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3.2 `review_write`
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Queue a new file or a full-file rewrite for the user's review. This does not
|
|
94
|
+
write the file: the change is held in the Code review tab until the user
|
|
95
|
+
finishes. Use review_patch for edits to existing files. At least one notes
|
|
96
|
+
entry per changed file is required while AI explanations are on; prefer
|
|
97
|
+
line-level notes (line/hunk) for user-requested, key or hard-to-understand
|
|
98
|
+
changes. Each note is 1-2 sentences explaining why. The plugin starts or
|
|
99
|
+
reuses the review waiter automatically; just queue and continue, and never
|
|
100
|
+
call review_wait from the main agent.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 3.3 `review_patch`
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
Queue a unified diff for the user's review. The patch must use ---/+++ headers
|
|
107
|
+
and @@ hunks with paths relative to the working directory; a/ and b/ prefixes
|
|
108
|
+
and diff --git headers are accepted. Use one patch per file when possible;
|
|
109
|
+
multiple files are allowed. This does not modify the workspace: the change is
|
|
110
|
+
held in the Code review tab until the user finishes. At least one notes entry
|
|
111
|
+
per changed file is required while AI explanations are on; prefer line-level
|
|
112
|
+
notes (line/hunk) for user-requested, key or hard-to-understand changes. Each
|
|
113
|
+
note is 1-2 sentences explaining why. The plugin starts or reuses the review
|
|
114
|
+
waiter automatically; just queue and continue, and never call review_wait
|
|
115
|
+
from the main agent.
|
|
116
|
+
|
|
117
|
+
Example:
|
|
118
|
+
--- a/src/app.ts
|
|
119
|
+
+++ b/src/app.ts
|
|
120
|
+
@@ -10,7 +10,9 @@
|
|
121
|
+
const app = createApp()
|
|
122
|
+
- app.use(oldRouter)
|
|
123
|
+
+ app.use(newRouter)
|
|
124
|
+
+ app.use(logger)
|
|
125
|
+
app.listen(3000)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 3.4 `review_wait`
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
Wait for a review. Only a review waiter subagent should call this: pass the
|
|
132
|
+
reviewId and waitKey from review_write/review_patch. The main agent must not
|
|
133
|
+
call it; if it does, the call is refused so the turn never blocks. Returns one
|
|
134
|
+
structured result per file: applied, rejected (with the user's comment),
|
|
135
|
+
edited, or failed.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 3.5 Native gate denial
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
File changes must go through the review gate while Pre-review is on. Use
|
|
142
|
+
review_write (new file / full file) or review_patch (unified diff) with at
|
|
143
|
+
least one note per changed file; the plugin starts or reuses the review waiter
|
|
144
|
+
automatically; just continue. Never call review_wait from the main agent.
|
|
145
|
+
Shell commands are outside the review.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 3.6 Per-file validation errors
|
|
149
|
+
|
|
150
|
+
Multi-file patch:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
AI explanations are on: add at least one note for each changed file.
|
|
154
|
+
Missing: <file1>, <file2>.
|
|
155
|
+
Turn off AI explanations in the input bar to queue without notes.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Single-file write:
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
AI explanations are on: add at least one note for this file. Use line-level
|
|
162
|
+
notes for user-requested, key or hard-to-understand changes. Turn off AI
|
|
163
|
+
explanations in the input bar to queue without notes.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 3.7 UI strings (0.8.4)
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
AI explanations
|
|
170
|
+
Require at least one note per changed file. Off: queue changes without notes.
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```text
|
|
174
|
+
AI 解释
|
|
175
|
+
每个改动文件至少一条说明。关闭后排队不再要求解释。
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 4. The chain
|
|
181
|
+
|
|
182
|
+
```text
|
|
183
|
+
[input Review tools]
|
|
184
|
+
AI explanations toggle
|
|
185
|
+
│ setSettings({ aiExplain })
|
|
186
|
+
▼
|
|
187
|
+
[plugin host featureFlags]
|
|
188
|
+
│ system prompt + tool descriptions
|
|
189
|
+
▼
|
|
190
|
+
[main AI]
|
|
191
|
+
review_write / review_patch (notes)
|
|
192
|
+
│
|
|
193
|
+
▼
|
|
194
|
+
[host validation]
|
|
195
|
+
aiExplain on?
|
|
196
|
+
every changed file covered?
|
|
197
|
+
│
|
|
198
|
+
▼
|
|
199
|
+
[review state]
|
|
200
|
+
entries / notes / decisions / waitKey
|
|
201
|
+
│
|
|
202
|
+
├──────────────► [Code review tab]
|
|
203
|
+
│ diff + AI rows
|
|
204
|
+
│ Approve / Reject / Edit / Finish
|
|
205
|
+
│ │
|
|
206
|
+
│ ▼
|
|
207
|
+
│ host applies files
|
|
208
|
+
│
|
|
209
|
+
└──────────────► [ensureReviewWaiter]
|
|
210
|
+
scoped subagent tool → spawn child
|
|
211
|
+
child: review_wait(reviewId, waitKey)
|
|
212
|
+
│
|
|
213
|
+
▼
|
|
214
|
+
review finishes
|
|
215
|
+
│
|
|
216
|
+
▼
|
|
217
|
+
child returns per-file results
|
|
218
|
+
│
|
|
219
|
+
▼
|
|
220
|
+
parent completion → main agent wakes
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Steps
|
|
224
|
+
|
|
225
|
+
1. The user toggles **AI explanations** in the input bar; the client calls
|
|
226
|
+
`setSettings({ aiExplain })`; the host stores `featureFlags.aiExplain`.
|
|
227
|
+
2. The host injects the system prompt and the tool descriptions on the next turn.
|
|
228
|
+
3. The main agent calls `review_write` / `review_patch` with notes.
|
|
229
|
+
4. The host validates: when `aiExplain` is on, every changed file needs at least
|
|
230
|
+
one non-empty note; a multi-file patch names the missing files and refuses.
|
|
231
|
+
5. The change is staged in the review state; nothing is written to disk.
|
|
232
|
+
6. `ensureReviewWaiter` starts a waiter child through the agent-scoped
|
|
233
|
+
`subagent` tool (spawn), or reuses the persistent child with `sendMessage`.
|
|
234
|
+
7. The child calls `review_wait` with the reviewId and waitKey.
|
|
235
|
+
8. The user reviews in the Code review tab; **Finish** applies the files.
|
|
236
|
+
9. The child's `review_wait` returns the per-file outcomes; the child reports to
|
|
237
|
+
its parent; the main agent's next turn receives the result.
|
|
238
|
+
10. The next review reuses the same child; one persistent waiter per conversation.
|
|
239
|
+
|
|
240
|
+
### Endpoints and slots
|
|
241
|
+
|
|
242
|
+
- RPC: `POST /api/coding-enhanced` with `{ endpoint, payload }`
|
|
243
|
+
- Client slots: `conversation.input.right` (Review tools),
|
|
244
|
+
`conversation.chat.assistant-actions` (withdraw), review tab type,
|
|
245
|
+
`settings.section`, `plugins.bundle.config`.
|
|
246
|
+
- Host services: `tools`, `subagents`, `sessions`, `connection`, `systemPrompt`.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 5. Subagent design
|
|
251
|
+
|
|
252
|
+
### 5.1 spawn vs fork
|
|
253
|
+
|
|
254
|
+
| | spawn | fork |
|
|
255
|
+
|---|---|---|
|
|
256
|
+
| Tool | `subagent` | `subagent_fork` |
|
|
257
|
+
| Provider | `spawn` | `fork` |
|
|
258
|
+
| Child context | fresh; only the prompt | inherited completed conversation |
|
|
259
|
+
| Project understanding | needs a brief / reads files | has the conversation |
|
|
260
|
+
| Token cost | prompt + brief + output | inherited prefix (provider cache) + output |
|
|
261
|
+
| Isolation | high | lower |
|
|
262
|
+
| Use | review waiter; independent tasks | project-aware explanation; follow-ups |
|
|
263
|
+
|
|
264
|
+
### 5.2 What the waiter uses
|
|
265
|
+
|
|
266
|
+
**spawn.** The waiter only needs `reviewId` / `waitKey` and `review_wait`;
|
|
267
|
+
it does not need project detail. The child is persistent: the host stores
|
|
268
|
+
`reviewWaiters[sessionId]` and reuses it with `sendMessage`.
|
|
269
|
+
|
|
270
|
+
### 5.3 Why the parent explains, not a comment subagent
|
|
271
|
+
|
|
272
|
+
An earlier option (“Line AI B”) used a dedicated comment subagent. It was
|
|
273
|
+
dropped:
|
|
274
|
+
|
|
275
|
+
- the parent already has the full project and user intent;
|
|
276
|
+
- a fresh comment child needs a brief and still risks missing context;
|
|
277
|
+
- the parent's notes cost less than a second child context;
|
|
278
|
+
- the waiter child stays a pure `review_wait` observer.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 6. Design decisions
|
|
283
|
+
|
|
284
|
+
- **The model writes; the host enforces.** Notes are required at the tool
|
|
285
|
+
boundary, not only in a prompt.
|
|
286
|
+
- **One explanation per changed file is the floor**, not the ceiling. Line-level
|
|
287
|
+
notes are recommended for user-requested, key or hard-to-understand changes.
|
|
288
|
+
- **No upper limit** on notes; the reviewer can ask for more.
|
|
289
|
+
- **The main agent cannot block.** `review_wait` is refused for the owner
|
|
290
|
+
session; only a child may wait.
|
|
291
|
+
- **One persistent waiter per conversation**, reused with `sendMessage`.
|
|
292
|
+
- **The gate covers native file tools**; shell writes are documented as outside
|
|
293
|
+
the review.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## 7. Caveats
|
|
298
|
+
|
|
299
|
+
- Shell commands can still write files outside the gate; a post-turn warning is
|
|
300
|
+
planned.
|
|
301
|
+
- The auto waiter uses the agent-scoped `subagent` tool; if the provider is
|
|
302
|
+
unavailable it falls back to a direct `spawn` activation, then to a manual
|
|
303
|
+
`review_wait` fallback.
|
|
304
|
+
- npm publishing uses Trusted Publishing (OIDC); the registry CDN may lag a few
|
|
305
|
+
minutes after the workflow succeeds.
|
|
306
|
+
- The review contract is versioned with the plugin; this document describes
|
|
307
|
+
0.8.4.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 8. Version history (review workflow)
|
|
312
|
+
|
|
313
|
+
| Version | Change |
|
|
314
|
+
|---|---|
|
|
315
|
+
| 0.6.0 | Non-blocking review waiter; per-file decisions |
|
|
316
|
+
| 0.7.0 | Gate coverage for `str_replace_editor` / `multi_edit` / `notebook_edit`; main `review_wait` refused; notes required; AI explanations toggle; wrap all rows |
|
|
317
|
+
| 0.8.0–0.8.2 | Plugin-owned persistent waiter via `ctx.subagents` (agent-scoped tool, `spawn`) |
|
|
318
|
+
| 0.8.3 | Parent-written explanations; per-file notes validation; comment subagent dropped |
|
|
319
|
+
| 0.8.4 | Copy fixes; this document |
|
package/lib/client.js
CHANGED
|
@@ -41,7 +41,7 @@ window.__ModuleLoader__.load({
|
|
|
41
41
|
reviewTools: 'Review tools',
|
|
42
42
|
autoReview: 'Pre-review',
|
|
43
43
|
aiExplain: 'AI explanations',
|
|
44
|
-
aiExplainDesc: 'Require
|
|
44
|
+
aiExplainDesc: 'Require at least one note per changed file. Off: queue changes without notes.',
|
|
45
45
|
autoReviewDesc: 'The agent must queue every edit with review_write / review_patch before it lands. Off: native write/edit.',
|
|
46
46
|
reviewFeatureOff: 'AI Change Review is off in Settings. Enable it first, then use this switch.',
|
|
47
47
|
reviewOn: 'On',
|
|
@@ -153,7 +153,7 @@ window.__ModuleLoader__.load({
|
|
|
153
153
|
reviewTools: 'Review 工具',
|
|
154
154
|
autoReview: 'AI 改动预审查',
|
|
155
155
|
aiExplain: 'AI 解释',
|
|
156
|
-
aiExplainDesc: '
|
|
156
|
+
aiExplainDesc: '每个改动文件至少一条说明。关闭后排队不再要求解释。',
|
|
157
157
|
autoReviewDesc: 'AI 的每次改动都必须先进入 review(review_write / review_patch)才能落盘。关闭后走原生 write/edit。',
|
|
158
158
|
reviewFeatureOff: '设置里的 AI Change Review 处于关闭状态,先启用后再用这个开关。',
|
|
159
159
|
reviewOn: '开',
|
package/lib/index.js
CHANGED
|
@@ -1263,8 +1263,20 @@ export function apply(ctx) {
|
|
|
1263
1263
|
targets.set(newTarget.relative, { ...newTarget, newFile: oldTarget === null })
|
|
1264
1264
|
}
|
|
1265
1265
|
|
|
1266
|
-
if (featureFlags.aiExplain === true
|
|
1267
|
-
|
|
1266
|
+
if (featureFlags.aiExplain === true) {
|
|
1267
|
+
const missing = []
|
|
1268
|
+
for (const target of targets.values()) {
|
|
1269
|
+
const covered = Array.isArray(notes) && notes.some((note) => {
|
|
1270
|
+
if (note === null || typeof note !== 'object') return false
|
|
1271
|
+
if (typeof note.text !== 'string' || note.text.trim() === '') return false
|
|
1272
|
+
const rawPath = typeof note.path === 'string' ? note.path.replace(/^[ab]\//, '').replace(/^\.\//, '') : ''
|
|
1273
|
+
return rawPath === '' ? targets.size === 1 : rawPath === target.relative
|
|
1274
|
+
})
|
|
1275
|
+
if (!covered) missing.push(target.relative)
|
|
1276
|
+
}
|
|
1277
|
+
if (missing.length > 0) {
|
|
1278
|
+
throw new Error(`AI explanations are on: add at least one note for each changed file. Missing: ${missing.join(', ')}. Turn off AI explanations in the input bar to queue without notes.`)
|
|
1279
|
+
}
|
|
1268
1280
|
}
|
|
1269
1281
|
const review = ensureReview(session.id)
|
|
1270
1282
|
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'dsh-ce-patch-'))
|
|
@@ -1397,7 +1409,7 @@ export function apply(ctx) {
|
|
|
1397
1409
|
const registerReviewTools = () => {
|
|
1398
1410
|
ctx.tools.register(defineTool({
|
|
1399
1411
|
name: 'review_write',
|
|
1400
|
-
description: 'Queue a new file or a full-file rewrite for the user\'s review. This does not write the file: the change is held in the Code review tab until the user finishes. Use review_patch for edits to existing files.
|
|
1412
|
+
description: 'Queue a new file or a full-file rewrite for the user\'s review. This does not write the file: the change is held in the Code review tab until the user finishes. Use review_patch for edits to existing files. At least one notes entry per changed file is required while AI explanations are on; prefer line-level notes (line/hunk) for user-requested, key or hard-to-understand changes. Each note is 1-2 sentences explaining why. The plugin starts or reuses the review waiter automatically; just queue and continue, and never call review_wait from the main agent.',
|
|
1401
1413
|
parameters: {
|
|
1402
1414
|
file_path: { type: 'string', required: true, description: 'Path to write, resolved like the write tool.' },
|
|
1403
1415
|
content: { type: 'string', required: true, description: 'Full UTF-8 text content to write.' },
|
|
@@ -1421,7 +1433,7 @@ export function apply(ctx) {
|
|
|
1421
1433
|
if (session === undefined) return 'No active session.'
|
|
1422
1434
|
if (featureFlags.review !== true) return 'The review gate is off. Use the write tool instead.'
|
|
1423
1435
|
if (featureFlags.aiExplain === true && !hasNotes(args.notes)) {
|
|
1424
|
-
throw new Error('AI explanations are on: add at least one
|
|
1436
|
+
throw new Error('AI explanations are on: add at least one note for this file. Use line-level notes for user-requested, key or hard-to-understand changes. Turn off AI explanations in the input bar to queue without notes.')
|
|
1425
1437
|
}
|
|
1426
1438
|
const queued = await stageFileChange(session, { id: exec.callId, name: 'write', arguments: { file_path: args.file_path, content: args.content, notes: args.notes } })
|
|
1427
1439
|
if (queued === undefined) return 'Could not queue this change (missing or invalid file_path).'
|
|
@@ -1433,7 +1445,7 @@ export function apply(ctx) {
|
|
|
1433
1445
|
|
|
1434
1446
|
ctx.tools.register(defineTool({
|
|
1435
1447
|
name: 'review_patch',
|
|
1436
|
-
description: 'Queue a unified diff for the user\'s review. The patch must use ---/+++ headers and @@ hunks with paths relative to the working directory; a/ and b/ prefixes and diff --git headers are accepted. Use one patch per file when possible; multiple files are allowed. This does not modify the workspace: the change is held in the Code review tab until the user finishes.
|
|
1448
|
+
description: 'Queue a unified diff for the user\'s review. The patch must use ---/+++ headers and @@ hunks with paths relative to the working directory; a/ and b/ prefixes and diff --git headers are accepted. Use one patch per file when possible; multiple files are allowed. This does not modify the workspace: the change is held in the Code review tab until the user finishes. At least one notes entry per changed file is required while AI explanations are on; prefer line-level notes (line/hunk) for user-requested, key or hard-to-understand changes. Each note is 1-2 sentences explaining why. The plugin starts or reuses the review waiter automatically; just queue and continue, and never call review_wait from the main agent. Example:\n--- a/src/app.ts\n+++ b/src/app.ts\n@@ -10,7 +10,9 @@\n const app = createApp()\n- app.use(oldRouter)\n+ app.use(newRouter)\n+ app.use(logger)\n app.listen(3000)',
|
|
1437
1449
|
parameters: {
|
|
1438
1450
|
patch: { type: 'string', required: true, description: 'A unified diff (---/+++/@@) to queue for review.' },
|
|
1439
1451
|
notes: {
|
|
@@ -1533,7 +1545,7 @@ export function apply(ctx) {
|
|
|
1533
1545
|
if (!REVIEW_TOOLS.has(exec.name)) return next()
|
|
1534
1546
|
return {
|
|
1535
1547
|
kind: 'deny',
|
|
1536
|
-
reason: 'File changes must go through the review gate while Pre-review is on. Use review_write (new file / full file) or review_patch (unified diff) with
|
|
1548
|
+
reason: 'File changes must go through the review gate while Pre-review is on. Use review_write (new file / full file) or review_patch (unified diff) with at least one note per changed file; the plugin starts or reuses the review waiter automatically; just continue. Never call review_wait from the main agent. Shell commands are outside the review.',
|
|
1537
1549
|
}
|
|
1538
1550
|
}
|
|
1539
1551
|
|
|
@@ -1544,7 +1556,7 @@ export function apply(ctx) {
|
|
|
1544
1556
|
name: 'tool:review-gate',
|
|
1545
1557
|
order: 110,
|
|
1546
1558
|
text: () => featureFlags.review === true && featureFlags.autoReview === true
|
|
1547
|
-
? '🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change. Queue every change with review_write (new file / full file) or review_patch (unified diff) and include
|
|
1559
|
+
? '🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change. Queue every change with review_write (new file / full file) or review_patch (unified diff) and include at least one note per changed file while AI explanations are on; add line-level notes for user-requested, key or hard-to-understand changes (no upper limit). Do not use write/edit/apply_patch/str_replace_editor. The plugin starts or reuses the review waiter automatically: after queueing, just continue or end the turn; never call review_wait and do not manage a subagent. If a file is rejected, read the comment and revise. This is house rules. 💅'
|
|
1548
1560
|
: '',
|
|
1549
1561
|
}), 'coding-enhanced: review prompt')
|
|
1550
1562
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-coding-enhanced",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "The DSH change gate: queue AI edits before write, rewind turns with shadow-git snapshots, and hand review to a non-blocking waiter subagent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|