@stardustlc/dsh-review 0.4.3 → 0.4.5

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,15 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.4.5 (2026-10-29)
4
+
5
+ - 同步仓库与 npm 的简明介绍、中英文 README 和反馈入口;本次为文档与包元数据更新。
6
+ - Sync npm descriptions and both README guides with the repository, including issue and pull-request links.
7
+
8
+ ## 0.4.4 (2026-10-28)
9
+
10
+ - 隔离 Git 的工作区/全局属性转换,避免仓库 clean 过滤器执行并隐藏真实改动;固定补丁前后缀和行首格式。
11
+ - 对无法隔离的 info/attributes 规则明确报告审查未完成,不把空补丁误报为通过;linked worktree 同样检查 common Git 目录。
12
+
3
13
  ## 0.4.3 (2026-10-27)
4
14
 
5
15
  - 修复分批更新时的新旧更新控件混用:保留原页面、草稿与安装保护,空闲后接管旧控制器,兼容旧入口。
package/README.en.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  [中文](README.md)
4
4
 
5
- Independent code review for DeepSeek Harness: find concrete defects, verify them separately, preserve evidence and disclose unfinished work. Inspired by [the Claude Code team's workflow](https://claude.dev/blog/solving-code-review-at-anthropic/).
5
+ Review Git changes with independent defect discovery, cross-checked source evidence, fix tracking and an explicit review gate. Keeps unfinished work and human decisions visible, with quick, standard and deep modes. Inspired by [the Claude Code team's workflow](https://claude.dev/blog/solving-code-review-at-anthropic/).
6
6
 
7
- Requires Git, Node.js 22.19+ or 24+, and the official DSH services for tools, subagents, permission presets and jobs. Runtime acceptance targets DSH 0.2.1-rc.1. Start the conversation at the Git repository root.
7
+ Feedback and contributions are welcome: report [issues](https://github.com/STARDUSTLC666/dsh-review/issues) or submit [pull requests](https://github.com/STARDUSTLC666/dsh-review/pulls).
8
+
9
+ Requires Git, Node.js 22.19+ or 24+, and the official DSH services for tools, subagents, permission presets and jobs. Requires DSH 0.2.1-rc.3 or newer; [this validation round](docs/validation-0.4.4.md) uses official 0.2.1-rc.4. Start the conversation at the Git repository root.
8
10
 
9
11
  ```bash
10
12
  dsh plugin --profile web add @stardustlc/dsh-review
@@ -26,6 +28,8 @@ Every mode includes two separate risk classifications. Sensitive changes cannot
26
28
 
27
29
  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
30
 
31
+ 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.
32
+
29
33
  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
34
 
31
35
  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
@@ -2,13 +2,13 @@
2
2
 
3
3
  [English](README.en.md)
4
4
 
5
- 提交代码前,让独立审阅者找出具体缺陷,再交给另一组审阅者复核。你看到的是经过验证的问题、明确的未完成项和仍需人工决定的事。
5
+ 面向 Git 改动的代码审阅插件:独立查找缺陷、交叉复核证据、跟踪修复,并给出明确的审阅门禁。保留未完成项和需人工决定的结论,支持 quick、standard、deep 三种模式。
6
6
 
7
7
  参考 [Claude Code 团队的审阅流程](https://claude.dev/blog/solving-code-review-at-anthropic/),实现其中可在 DSH 内完成的审阅环节。它不授予人工批准,也不会自动发评论或合并代码。
8
8
 
9
9
  ## 使用
10
10
 
11
- 需要 Git、Node.js 22.19+ / 24+,以及提供子智能体、权限预设和作业管理服务的官方 DSH 运行环境。适配验收使用 DSH 0.2.1-rc.1。在 Git 仓库根目录创建会话后,让 DSH:
11
+ 需要 Git、Node.js 22.19+ / 24+,以及提供子智能体、权限预设和作业管理服务的官方 DSH 运行环境。当前最低要求为 DSH 0.2.1-rc.3;[本轮验收](docs/validation-0.4.4.md)使用官方 0.2.1-rc.4。在 Git 仓库根目录创建会话后,让 DSH:
12
12
 
13
13
  > 审阅当前改动,运行 dsh-review。只报告有具体触发条件、代码证据和独立复核的问题。审查没完成时不要说通过。
14
14
 
@@ -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.5","label":"代码审阅","labelEn":"Review","suiteComponent":false}));
441
441
 
442
442
  /* STARDUSTLC_UPDATE_CLIENT_BODY_END */
443
443
  })();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stardustlc/dsh-review",
3
- "version": "0.4.3",
4
- "description": "以证据为准的代码审阅插件:审 diff、验证结论、记录噪音,让 agent 先读、人只读结论。",
3
+ "version": "0.4.5",
4
+ "description": "DSH 代码审阅:独立发现缺陷、证据复核、修复跟踪与门禁;支持三种审阅模式。欢迎提交 issues 和 PR。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",