dsh-coding-enhanced 0.8.2 → 0.8.3
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 +1 -1
- 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`) |
|
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)\nThe plugin starts or reuses the review waiter automatically; just queue and continue, and do not call review_wait from the main agent.',
|
|
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.3",
|
|
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",
|