@stardustlc/dsh-review 0.4.2 → 0.4.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/CHANGELOG.md +9 -0
- package/README.en.md +2 -0
- package/README.md +1 -0
- package/docs/VALIDATION.md +4 -0
- package/docs/validation-0.4.4.md +9 -0
- package/lib/exec.js +20 -1
- package/lib/git-safety.d.ts +4 -0
- package/lib/git-safety.js +37 -0
- package/lib/ledger.d.ts +1 -1
- package/lib/run.d.ts +1 -1
- package/lib/target.js +1 -1
- package/lib/update-client.js +28 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# 变更记录
|
|
2
2
|
|
|
3
|
+
## 0.4.4 (2026-10-28)
|
|
4
|
+
|
|
5
|
+
- 隔离 Git 的工作区/全局属性转换,避免仓库 clean 过滤器执行并隐藏真实改动;固定补丁前后缀和行首格式。
|
|
6
|
+
- 对无法隔离的 info/attributes 规则明确报告审查未完成,不把空补丁误报为通过;linked worktree 同样检查 common Git 目录。
|
|
7
|
+
|
|
8
|
+
## 0.4.3 (2026-10-27)
|
|
9
|
+
|
|
10
|
+
- 修复分批更新时的新旧更新控件混用:保留原页面、草稿与安装保护,空闲后接管旧控制器,兼容旧入口。
|
|
11
|
+
|
|
3
12
|
## 0.4.2 (2026-10-27)
|
|
4
13
|
|
|
5
14
|
- 更新控件移至原有工作台或原生插件详情页底部;更新记录与选项原地展开,移除独立更新菜单与页面。
|
package/README.en.md
CHANGED
|
@@ -26,6 +26,8 @@ Every mode includes two separate risk classifications. Sensitive changes cannot
|
|
|
26
26
|
|
|
27
27
|
Each run is bound to an immutable base, HEAD, source snapshot and nonce. Missing or malformed output, changed code, exhausted budgets and incomplete verification block the AI gate. Evidence must cite actual snapshot source; an asserted command transcript alone is insufficient.
|
|
28
28
|
|
|
29
|
+
Git attribute conversions are isolated so repository clean filters cannot run or hide changes. Effective `info/attributes` rules stop review with an explicit incomplete error. Confirm and remove those rules before retrying; the plugin does not edit Git configuration.
|
|
30
|
+
|
|
29
31
|
Posted findings require a fix or reasoned disposition. Fixes clear only after independent re-verification. Reviews default to three completed rounds; round three limits new findings to the actual incremental edits while re-checking unresolved findings. New files remain eligible. Binary changes require separate review.
|
|
30
32
|
|
|
31
33
|
The ten tools are `review_diff`, `review_run`, `review_report`, `review_check`, `review_respond`, `review_status`, `review_gate`, `review_learn`, `review_issue` and `review_eval`. External task submissions cannot prove independent execution and never pass the automatic gate. No tool publishes GitHub feedback or grants a human approval.
|
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ dsh plugin --profile web add @stardustlc/dsh-review
|
|
|
41
41
|
每轮还有两个独立风险判断任务,分别判断风险等级和是否需要额外人工审阅。所有任务使用新的上下文;继承作者对话的 fork 后端不会被接受。
|
|
42
42
|
|
|
43
43
|
- 每轮绑定 Git 基准、HEAD、完整文件快照和唯一运行编号。代码变化、结果缺失、格式损坏或超限都会阻止放行。
|
|
44
|
+
- 读取原始 Git 改动时隔离属性转换,不执行仓库的 clean 过滤器。`info/attributes` 含有效规则时提示审查未完成;请先确认并移除规则后重试,插件不会代改仓库配置。
|
|
44
45
|
- 复核必须说明具体成因并引用快照中的真实代码行。一个非空 evidence 字符串不算验证。
|
|
45
46
|
- 风格、命名、格式和清理建议直接过滤。已发表问题按指纹去重;每条仍须修复或写明处置原因。
|
|
46
47
|
- 默认最多 3 轮。从第 3 轮起,新问题限定在相对上轮的实际新增改动;旧问题继续复核,新文件不会漏掉。
|
package/docs/VALIDATION.md
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# 0.4.4 验证记录(2026-10-28)
|
|
2
|
+
|
|
3
|
+
Windows 回归 84 项通过、0 跳过。真实 Git 夹具验证工作区/全局 clean 过滤器不执行,原始新增行仍在快照中;info/attributes 的 clean、binary、非 ASCII 伪注释与 linked worktree 均明确阻断,未启用不安全回退。
|
|
4
|
+
|
|
5
|
+
原 Issue #1 的空白/异文件/远距离证据、原锚点仍存在时误记 fixed、默认 @profile 排除同名仓库目录均覆盖回归。
|
|
6
|
+
|
|
7
|
+
官方 DSH 0.2.1-rc.4 隔离 profile 执行原生 review_diff / review_run / review_gate。Deep 一轮实际启动 10 个独立子任务;缺陷保留且 gate 不通过。模型为受控本地适配器,不声称生产模型召回率或误报率。Web 实际打开会话轨迹与工具结果,未验证 Electron 原生窗口。
|
|
8
|
+
|
|
9
|
+
Git info/attributes 有效规则阻止本次 diff,不自动修改仓库设置。此检查不是针对另一个进程持续恶意变更 Git 配置的操作系统沙箱。
|
package/lib/exec.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
import { StringDecoder } from 'node:string_decoder';
|
|
8
|
+
import { prepareRawDiff } from './git-safety.js';
|
|
8
9
|
const DEFAULT_OUTPUT_LIMIT = 256 * 1024;
|
|
9
10
|
export function run(command, args, options) {
|
|
10
11
|
const started = Date.now();
|
|
@@ -67,7 +68,25 @@ export function run(command, args, options) {
|
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
export async function git(cwd, args, timeoutMs = 30000, maxOutputBytes = DEFAULT_OUTPUT_LIMIT, signal) {
|
|
70
|
-
|
|
71
|
+
const config = ['-c', 'core.quotepath=false', '-c', 'color.ui=false', '-c', 'core.fsmonitor=false', '-c', 'core.untrackedCache=false', '-c', 'core.attributesFile=' + (process.platform === 'win32' ? 'NUL' : '/dev/null')];
|
|
72
|
+
const env = { ...process.env, GIT_ATTR_NOSYSTEM: '1' };
|
|
73
|
+
if (args[0] !== 'diff')
|
|
74
|
+
return run('git', [...config, ...args], { cwd, timeoutMs, maxOutputBytes, signal, env });
|
|
75
|
+
const started = Date.now();
|
|
76
|
+
try {
|
|
77
|
+
const isolation = await prepareRawDiff(async (query) => {
|
|
78
|
+
const result = await run('git', [...config, ...query], { cwd, timeoutMs: Math.min(timeoutMs, 10000), maxOutputBytes: 65536, signal, env });
|
|
79
|
+
if (!result.ok)
|
|
80
|
+
throw new Error('Git safety metadata unavailable; review incomplete');
|
|
81
|
+
return result.stdout;
|
|
82
|
+
});
|
|
83
|
+
const result = await run('git', [...config, isolation.option, ...args], { cwd, timeoutMs, maxOutputBytes, signal, env });
|
|
84
|
+
isolation.verify();
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return { ok: false, code: null, stdout: '', stderr: error instanceof Error ? error.message : String(error), timedOut: false, truncated: false, durationMs: Date.now() - started };
|
|
89
|
+
}
|
|
71
90
|
}
|
|
72
91
|
/** 输出裁剪:保留头部与尾部,中间省略。 */
|
|
73
92
|
export function excerpt(text, maxLines = 40, maxChars = 4000) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 读取原始 Git 改动前隔离属性转换;info/attributes 的优先级高于 --attr-source。
|
|
3
|
+
*/
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
5
|
+
import { lstatSync, readFileSync } from 'node:fs';
|
|
6
|
+
import { isAbsolute } from 'node:path';
|
|
7
|
+
function assertInfoAttributes(file) {
|
|
8
|
+
let stat;
|
|
9
|
+
try {
|
|
10
|
+
stat = lstatSync(file);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error.code === 'ENOENT')
|
|
14
|
+
return;
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 64 * 1024)
|
|
18
|
+
throw new Error('Git info/attributes 无法安全隔离,审查未完成 / Git info/attributes cannot be isolated; review incomplete');
|
|
19
|
+
const content = readFileSync(file);
|
|
20
|
+
// Git 的空白规则不同于 JS trim;NBSP 等不能被当作注释前的空白。
|
|
21
|
+
if (content.length > 64 * 1024 || content.toString('utf8').split(/\r?\n/).some(line => !/^[ \t]*(?:#.*)?$/.test(line))) {
|
|
22
|
+
throw new Error('Git info/attributes 含有属性规则,可能改变被审查内容;本次 diff 未运行,请先移除该规则或改用文件全量扫描 / Nonempty Git info/attributes; diff review incomplete');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function prepareRawDiff(read) {
|
|
26
|
+
const format = (await read(['rev-parse', '--show-object-format'])).trim();
|
|
27
|
+
if (format !== 'sha1' && format !== 'sha256')
|
|
28
|
+
throw new Error('无法确认 Git 对象格式,审查未完成 / Unknown Git object format; review incomplete');
|
|
29
|
+
const file = (await read(['rev-parse', '--path-format=absolute', '--git-path', 'info/attributes'])).trim();
|
|
30
|
+
if (!isAbsolute(file) || file.length > 4096 || /[\x00-\x1f]/.test(file))
|
|
31
|
+
throw new Error('无法确认 Git 属性文件位置,审查未完成 / Invalid Git attribute path; review incomplete');
|
|
32
|
+
assertInfoAttributes(file);
|
|
33
|
+
return {
|
|
34
|
+
option: '--attr-source=' + createHash(format).update('tree 0\u0000').digest('hex'),
|
|
35
|
+
verify: () => assertInfoAttributes(file),
|
|
36
|
+
};
|
|
37
|
+
}
|
package/lib/ledger.d.ts
CHANGED
package/lib/run.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function runView(run: StoredRun): {
|
|
|
17
17
|
head: string;
|
|
18
18
|
mode: Mode;
|
|
19
19
|
status: import("./ledger.js").RunStatus;
|
|
20
|
-
stage: "
|
|
20
|
+
stage: "verify" | "find" | "arbiter" | "done";
|
|
21
21
|
independent: boolean;
|
|
22
22
|
round: number;
|
|
23
23
|
calls: number;
|
package/lib/target.js
CHANGED
|
@@ -24,7 +24,7 @@ export async function captureTarget(root, args, maxBytes, stateDir, signal) {
|
|
|
24
24
|
const requestedBase = (await query(['rev-parse', '--verify', '--end-of-options', baseRef + '^{commit}'])).trim();
|
|
25
25
|
const base = kind === 'commit' ? (await query(['merge-base', requestedBase, head])).trim() : head;
|
|
26
26
|
const selector = kind === 'staged' ? ['--cached', head] : kind === 'commit' ? [base, head] : [head];
|
|
27
|
-
const common = ['diff', '--no-ext-diff', '--no-textconv', '--no-color'];
|
|
27
|
+
const common = ['diff', '--no-ext-diff', '--no-textconv', '--no-color', '--src-prefix=a/', '--dst-prefix=b/', '--output-indicator-new=+', '--output-indicator-old=-', '--output-indicator-context= '];
|
|
28
28
|
const names = await query([...common, '--name-status', '-z', ...selector, '--']);
|
|
29
29
|
const patch = await query([...common, '--unified=3', ...selector, '--']);
|
|
30
30
|
const parsed = parseDiff(patch);
|
package/lib/update-client.js
CHANGED
|
@@ -176,7 +176,7 @@ function __stardustUpdatesGuard(React, name, { dirty = false, busy = false, reta
|
|
|
176
176
|
function __StardustPluginUpdatesFooter({ React, name }) {
|
|
177
177
|
const [, render] = React.useState(0), pool = __stardustUpdatesGuards();
|
|
178
178
|
React.useEffect(() => { const fn = () => render(value => value + 1); pool.viewListeners.add(fn); return () => pool.viewListeners.delete(fn); }, []);
|
|
179
|
-
const client = [...pool.clients].find(client => client.has(name));
|
|
179
|
+
const client = [...pool.clients].find(client => typeof client.Footer === 'function' && client.has(name));
|
|
180
180
|
if (!client) return null;
|
|
181
181
|
return React.createElement(client.Footer, { name });
|
|
182
182
|
}
|
|
@@ -238,14 +238,22 @@ function __stardustUpdatesJoin(host, React, require, participant) {
|
|
|
238
238
|
if (typeof root.plugin !== 'function') return;
|
|
239
239
|
let record = pools.get(root);
|
|
240
240
|
if (!record) {
|
|
241
|
-
record = { refs: new Map(), timer: null, version: participant.version, alive: true, hold: false };
|
|
241
|
+
record = { refs: new Map(), timer: null, version: participant.version, alive: true, hold: false, uiRevision: 2 };
|
|
242
242
|
pools.set(root, record);
|
|
243
|
+
__stardustUpdatesActivate(record, pools, root, React, require);
|
|
244
|
+
} else if (record.uiRevision !== 2 && !record.migration) {
|
|
245
|
+
// The first loaded participant may still own a pre-footer client. Keep
|
|
246
|
+
// its references and draft guards, wait for any admitted install, then
|
|
247
|
+
// replace that one client fiber instead of running two window heartbeats.
|
|
243
248
|
const shared = record;
|
|
244
|
-
record.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
record.migration = Promise.resolve().then(async () => {
|
|
250
|
+
while (shared.alive && shared.hold) await new Promise(resolve => setTimeout(resolve, 500));
|
|
251
|
+
if (!shared.alive || !shared.refs.size) return;
|
|
252
|
+
await shared.fiber?.dispose?.();
|
|
253
|
+
if (!shared.refs.size) return;
|
|
254
|
+
shared.alive = true; shared.uiRevision = 2; pools.set(root, shared);
|
|
255
|
+
__stardustUpdatesActivate(shared, pools, root, React, require);
|
|
256
|
+
}).catch(() => { /* The original page remains usable if host disposal fails. */ });
|
|
249
257
|
}
|
|
250
258
|
clearTimeout(record.timer);
|
|
251
259
|
const ref = {}; record.refs.set(ref, participant);
|
|
@@ -259,10 +267,17 @@ function __stardustUpdatesJoin(host, React, require, participant) {
|
|
|
259
267
|
if (!record.refs.size) record.timer = setTimeout(stop, 1000);
|
|
260
268
|
});
|
|
261
269
|
}
|
|
270
|
+
function __stardustUpdatesActivate(shared, pools, root, React, require) {
|
|
271
|
+
shared.fiber = root.plugin({ name: 'stardustlc-plugin-updates-client', inject: ['slots', 'locale', 'remote', 'remote.pluginManager'], apply(ctx) {
|
|
272
|
+
const client = __stardustUpdatesClient(ctx, React, require, shared);
|
|
273
|
+
ctx.effect(() => () => { shared.alive = false; client.dispose(); if (pools.get(root) === shared) pools.delete(root); });
|
|
274
|
+
} });
|
|
275
|
+
Promise.resolve(shared.fiber).catch(() => { shared.alive = false; if (pools.get(root) === shared) pools.delete(root); });
|
|
276
|
+
}
|
|
262
277
|
function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
263
278
|
const h = React.createElement, W = createWorkbenchUI(React), route = new URL('api/stardustlc/plugin-updates', document.baseURI);
|
|
264
279
|
const { useState, useEffect } = React, id = crypto.randomUUID(), listeners = new Set(), pool = __stardustUpdatesGuards(), requests = new Set(), notified = new Set(), knownRows = new Map();
|
|
265
|
-
let alive = true, registered = false, state = null, lastInteraction = Date.now(), inPoll = false, manualOperation = false;
|
|
280
|
+
let alive = true, registered = false, state = null, lastInteraction = Date.now(), inPoll = false, manualOperation = false, legacyHint = null;
|
|
266
281
|
const language = () => String(ctx.locale?.getSnapshot?.().active || '').startsWith('en') ? 'en' : 'zh';
|
|
267
282
|
const t = (zh, en) => language() === 'en' ? en : zh;
|
|
268
283
|
const preferences = name => state?.preferences.packages[name] || { checkEnabled: true, autoInstall: false, deferredUntil: 0, ignoredVersion: null };
|
|
@@ -387,11 +402,11 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
387
402
|
function Reminder() {
|
|
388
403
|
useSnapshot();
|
|
389
404
|
const row = state?.rows.find(row => { const prefs = preferences(row.name); return row.available && !row.updating && !row.bundledBy && prefs.checkEnabled && prefs.deferredUntil <= Date.now() && prefs.ignoredVersion !== row.release.version && !notified.has(row.name + '@' + row.release.version); });
|
|
390
|
-
if (!row) return null;
|
|
405
|
+
if (!row && !legacyHint) return null;
|
|
391
406
|
let Toast; try { Toast = require('@deepseek-ai/dsh-client-ui-primitives').Toast; } catch { return null; }
|
|
392
407
|
if (!Toast) return null;
|
|
393
|
-
const key = row.name + '@' + row.release.version;
|
|
394
|
-
return h(Toast, { key, text: (language() === 'en' ? row.labelEn : row.label) + t('有新版本,可在页面底部查看。', ' has an update. Review it at the bottom of its page.'), icon: h(W.Icon, { name: 'refresh', size: 18 }), holdMs: 7000, onDone: () => { notified.add(key); notify(); } });
|
|
408
|
+
const hint = legacyHint, key = hint ? 'legacy-' + hint : row.name + '@' + row.release.version;
|
|
409
|
+
return h(Toast, { key, text: hint ? hint + t(':请打开「插件」中的此插件详情页,在底部管理更新。', ': open its details in Plugins to manage updates at the bottom.') : (language() === 'en' ? row.labelEn : row.label) + t('有新版本,可在页面底部查看。', ' has an update. Review it at the bottom of its page.'), icon: h(W.Icon, { name: 'refresh', size: 18 }), holdMs: 7000, onDone: () => { if (hint) legacyHint = null; else notified.add(key); notify(); } });
|
|
395
410
|
}
|
|
396
411
|
function register() {
|
|
397
412
|
if (!alive) return;
|
|
@@ -410,7 +425,7 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
410
425
|
finally { inPoll = false; }
|
|
411
426
|
}
|
|
412
427
|
const timer = setInterval(() => { void poll(); }, 15000), first = setTimeout(() => { void poll(); }, 100);
|
|
413
|
-
const client = { t, Footer: Panel, has: name => registered && !!originalRow(name), row: rowFor, dispose() {
|
|
428
|
+
const client = { t, Footer: Panel, Button: W.Button, open(name) { const footer = [...document.querySelectorAll('[data-plugin-update-footer]')].find(node => node.getAttribute('data-plugin-update-footer') === name); if (footer) footer.scrollIntoView({ block: 'end', behavior: 'smooth' }); else { legacyHint = name; notify(); } }, has: name => registered && !!originalRow(name), row: rowFor, dispose() {
|
|
414
429
|
close(); alive = false; clearTimeout(first); clearInterval(timer); pool.clients.delete(client);
|
|
415
430
|
pool.listeners.delete(guardChanged); listeners.clear();
|
|
416
431
|
for (const event of ['pointerdown', 'keydown', 'input']) document.removeEventListener(event, interaction, true);
|
|
@@ -422,7 +437,7 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
422
437
|
}
|
|
423
438
|
|
|
424
439
|
/* STARDUSTLC_UPDATE_CLIENT_BODY_START */
|
|
425
|
-
window.__ModuleLoader__.load(__stardustUpdatesWrap({id:"@stardustlc/dsh-review",factory:require=>({apply(){}})},{"name":"@stardustlc/dsh-review","version":"0.1.0","hasWorkbench":false,"packageVersion":"0.4.
|
|
440
|
+
window.__ModuleLoader__.load(__stardustUpdatesWrap({id:"@stardustlc/dsh-review",factory:require=>({apply(){}})},{"name":"@stardustlc/dsh-review","version":"0.1.0","hasWorkbench":false,"packageVersion":"0.4.4","label":"代码审阅","labelEn":"Review","suiteComponent":false}));
|
|
426
441
|
|
|
427
442
|
/* STARDUSTLC_UPDATE_CLIENT_BODY_END */
|
|
428
443
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stardustlc/dsh-review",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "以证据为准的代码审阅插件:审 diff、验证结论、记录噪音,让 agent 先读、人只读结论。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -77,6 +77,6 @@
|
|
|
77
77
|
},
|
|
78
78
|
"author": "STARDUSTLC666",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@stardustlc/dsh-updates": "0.1.
|
|
80
|
+
"@stardustlc/dsh-updates": "0.1.3"
|
|
81
81
|
}
|
|
82
82
|
}
|