@feng0531/dsh-code-review 0.29.1 → 0.29.2

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.29.2
4
+
5
+ - Git工作副本基线捕获不再全HEAD枚举,仅可审查变更基线路径literal非递归lookup,改名使用oldPath,删除/子模块边界不变。
6
+ - 11000无关文件大树4Shader工作变更及稳定hash/status不改回归,282测试通过;自动上下文tracked索引仍另行有界规划。
7
+
3
8
  ## 0.29.1
4
9
 
5
10
  - 参考核心selection核实新增凭据路径不可覆盖门禁:.env家族模板例外、.ssh/私钥/包管理凭据纯路径排除。
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 当前状态
6
6
 
7
- 当前代码版本为 0.29.1
7
+ 当前代码版本为 0.29.2
8
8
 
9
9
  凭据路径硬排除:.env及其后缀(.env.example/.env.sample/.env.template例外)、.ssh目录、SSH私钥及.netrc/_netrc/.npmrc/.pypirc/.dockercfg,大小写无关;显式选择不可绕过,上下文/规则同样拒绝。仅路径策略,不保证普通文件无秘密。
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.29.1",
3
+ "version": "0.29.2",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
package/src/git.mjs CHANGED
@@ -22,14 +22,7 @@ export async function captureGit(cwd, options = {}) {
22
22
  if (ref.code !== 1) throw new Error('Cannot resolve Git HEAD');
23
23
  }
24
24
  const base = new Map();
25
- if (head) {
26
- const tree = text(await git(root, ['ls-tree', '-rz', '--full-tree', head], options));
27
- for (const record of tree.split('\0').filter(Boolean)) {
28
- const tab = record.indexOf('\t');
29
- const [mode, type, oid] = record.slice(0, tab).split(' ');
30
- base.set(record.slice(tab + 1), { mode, type, oid });
31
- }
32
- }
25
+ // Resolve only reviewable changed baselines below; never enumerate the HEAD tree.
33
26
  const records = text(before).split('\0');
34
27
  const changes = [];
35
28
  for (let i = 0; i < records.length; i++) {
@@ -42,6 +35,18 @@ export async function captureGit(cwd, options = {}) {
42
35
  if (changes.length > maxFiles) throw new Error('Change count limit exceeded; narrow repository scope');
43
36
  const known = new Set(changes.map(c => c.path));
44
37
  if (selectedPaths?.some(p => !known.has(p))) throw new Error('Selected path is not a current change');
38
+ if (head) {
39
+ const requested = [...new Set(changes.filter(c => !isSecretPath(c.path) && !isSecretPath(c.oldPath) && (!selectedPaths || selectedPaths.includes(c.path)) && (c.rawStatus !== '??' || selectedPaths?.includes(c.path))).map(c => relativePath(c.oldPath ?? c.path)))];
40
+ for (const name of requested) {
41
+ signal?.throwIfAborted();
42
+ const records = text(await git(root, ['--literal-pathspecs','ls-tree','-z','--full-tree',head,'--',name], options)).split('\0').filter(Boolean);
43
+ for (const record of records) {
44
+ const m = /^(\d{6}) (blob|tree|commit) ([a-f0-9]{40}|[a-f0-9]{64})\t([\s\S]+)$/.exec(record);
45
+ if (!m || m[4] !== name || base.has(name)) throw new Error('Invalid changed baseline lookup');
46
+ base.set(name,{mode:m[1],type:m[2],oid:m[3]});
47
+ }
48
+ }
49
+ }
45
50
  const files = [];
46
51
  for (const change of changes) {
47
52
  signal?.throwIfAborted();