@stardustlc/dsh-review 0.4.3 → 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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.4.4 (2026-10-28)
4
+
5
+ - 隔离 Git 的工作区/全局属性转换,避免仓库 clean 过滤器执行并隐藏真实改动;固定补丁前后缀和行首格式。
6
+ - 对无法隔离的 info/attributes 规则明确报告审查未完成,不把空补丁误报为通过;linked worktree 同样检查 common Git 目录。
7
+
3
8
  ## 0.4.3 (2026-10-27)
4
9
 
5
10
  - 修复分批更新时的新旧更新控件混用:保留原页面、草稿与安装保护,空闲后接管旧控制器,兼容旧入口。
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 轮起,新问题限定在相对上轮的实际新增改动;旧问题继续复核,新文件不会漏掉。
@@ -1,5 +1,9 @@
1
1
  # 验证记录
2
2
 
3
+ ## 2026-10-28:0.4.4
4
+
5
+ [本次修复与验收边界](validation-0.4.4.md)。
6
+
3
7
  ## 2026-10-26:0.3.1
4
8
 
5
9
  [本次修复、回归与未验收范围](validation-0.3.1.md)。
@@ -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
- return run('git', ['-c', 'core.quotepath=false', '-c', 'color.ui=false', '-c', 'core.fsmonitor=false', ...args], { cwd, timeoutMs, maxOutputBytes, signal });
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,4 @@
1
+ export declare function prepareRawDiff(read: (args: string[]) => Promise<string>): Promise<{
2
+ option: string;
3
+ verify(): void;
4
+ }>;
@@ -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
@@ -131,7 +131,7 @@ export declare class Ledger {
131
131
  id: string;
132
132
  targetId: string;
133
133
  status: RunStatus;
134
- stage: "find" | "verify" | "arbiter" | "done";
134
+ stage: "verify" | "find" | "arbiter" | "done";
135
135
  calls: number;
136
136
  errors: string[];
137
137
  }[];
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: "find" | "verify" | "arbiter" | "done";
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);
@@ -437,7 +437,7 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
437
437
  }
438
438
 
439
439
  /* STARDUSTLC_UPDATE_CLIENT_BODY_START */
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.3","label":"代码审阅","labelEn":"Review","suiteComponent":false}));
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}));
441
441
 
442
442
  /* STARDUSTLC_UPDATE_CLIENT_BODY_END */
443
443
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stardustlc/dsh-review",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "以证据为准的代码审阅插件:审 diff、验证结论、记录噪音,让 agent 先读、人只读结论。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",