dsh-git-push 2.9.4 → 2.9.9
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 +21 -25
- package/lib/app/apply.js +8 -1
- package/lib/app/audit-api.js +4 -1
- package/lib/app/command-registry.js +17 -11
- package/lib/app/handlers/meta.js +38 -0
- package/lib/app/handlers/repo-actions.js +3 -1
- package/lib/app/handlers/settings.js +0 -0
- package/lib/app/http-handlers.js +3 -1
- package/lib/app/schema.js +0 -0
- package/lib/app/settings-bridge.js +0 -0
- package/lib/app/tool-call.js +26 -21
- package/lib/ast/control-flow.js +12 -3
- package/lib/ast/size.js +5 -2
- package/lib/audit/audit-file.js +4 -2
- package/lib/audit/file-context.js +89 -0
- package/lib/audit/finding.js +16 -2
- package/lib/audit/index.js +2 -2
- package/lib/checks/button-bind.js +25 -2
- package/lib/commit-push.js +20 -2
- package/lib/core/exec.js +6 -4
- package/lib/exempt/tool.js +198 -0
- package/lib/git/clone-history-mode.js +24 -5
- package/lib/git/push.js +28 -13
- package/lib/git/transport.js +49 -17
- package/lib/git/visibility.js +93 -9
- package/lib/npm/publish.js +27 -0
- package/lib/npm/registry.js +5 -2
- package/lib/self/index.js +1 -1
- package/package.json +2 -4
- package/skills/dev/dsh-git-push.md +1 -2
- package/skills/guide/guide-cli-scripts.md +3 -3
- package/skills/guide/guide-inject-ui.md +4 -4
- package/assets/minihost.sh +0 -35
- package/assets/preview.html +0 -36703
- package/lib/fs/edit-after-read.js +0 -142
- package/scripts/frontend-preview-check.mjs +0 -124
- package/scripts/preview-gen.mjs +0 -489
- package/scripts/preview-local-runner.mjs +0 -55
- package/scripts/preview-server-direct.mjs +0 -116
- package/scripts/preview-server.mjs +0 -305
- package/scripts/preview-slot-data.mjs +0 -123
- package/scripts/sync-plugin-install.mjs +0 -286
- package/scripts/sync-plugin.mjs +0 -284
|
@@ -33,6 +33,95 @@ export function hasMkdirInSameFunction(lines, lineIdx) {
|
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 写目标是否「来自调用方」——若是,则目录创建责任不在本函数,mkdir-before-write 应豁免。
|
|
38
|
+
*
|
|
39
|
+
* 背景(2026-10-17 ZipCalm 反馈:robustness 槽位 4 条里 3 条跨界误报):
|
|
40
|
+
* 上一档 hasMkdirInSameFunction 只看**同函数**,而这些站点把写目标交给调用方准备:
|
|
41
|
+
* · store.js `const tmpPath = `${ctx.historyFile}.tmp`; fs.writeFile(tmpPath, …)`
|
|
42
|
+
* · writer.js `fs.createWriteStream(ctx.tempPath)`
|
|
43
|
+
* · tarFamily.js `fs.createWriteStream(plannedEntry.targetPath)`
|
|
44
|
+
* · zip/index.js `openArchivePipeline(tempPath, level)` ⇒ `fs.createWriteStream(tempPath)`
|
|
45
|
+
* 目标要么是**形参**、要么是形参的成员/由形参派生的临时路径 ⇒ 目录由调用方(或临时目录
|
|
46
|
+
* 提供方)负责建 ⇒ 规则说的「直接 writeFile 而不 mkdir ⇒ ENOENT」在本站点**不成立**
|
|
47
|
+
* (判错事实 = 真误报 ✓,不是"不想改")。
|
|
48
|
+
*
|
|
49
|
+
* 判据(保守,只认能静态确认的归属):
|
|
50
|
+
* ① 取下写调用的首参表达式,取它的**根标识符**;
|
|
51
|
+
* ② 根标识符若在**所属函数的形参列表**里 ⇒ 外来目标 ⇒ 豁免;
|
|
52
|
+
* ③ 根标识符是局部变量时,看它的赋值 RHS 是否**以形参为根**(如 `${ctx.x}.tmp`)⇒ 豁免;
|
|
53
|
+
* ④ 其余(本地字面量 / join(...) 现场拼路径 / 无赋值可查)⇒ **不豁免**,交给同函数档判定 ✓
|
|
54
|
+
* @param {string[]} lines 文件全部行
|
|
55
|
+
* @param {number} lineIdx 命中行索引(0 基)
|
|
56
|
+
* @returns {boolean} true=写目标来自调用方(应豁免)
|
|
57
|
+
*/
|
|
58
|
+
export function hasForeignWriteTarget(lines, lineIdx) {
|
|
59
|
+
const line = String(lines[lineIdx] || '');
|
|
60
|
+
// 取写调用的首参(到第一个逗号/右括号为止;模板串与成员链都吃)
|
|
61
|
+
const m = line.match(/(?:writeFile|writeFileSync|createWriteStream|appendFile|appendFileSync|createWriteStreamSync)\s*\(\s*([^,)]+)/);
|
|
62
|
+
if (!m) return false;
|
|
63
|
+
const target = m[1].trim();
|
|
64
|
+
const rootMatch = target.match(/^[$A-Za-z_][\w$]*/);
|
|
65
|
+
if (!rootMatch) return false;
|
|
66
|
+
const root = rootMatch[0];
|
|
67
|
+
const params = enclosingParams(lines, lineIdx);
|
|
68
|
+
if (params.has(root)) return true;
|
|
69
|
+
// 局部变量:查它的赋值 RHS 是否以形参为根(`${ctx.historyFile}.tmp` 这类临时路径)
|
|
70
|
+
const assignRe = new RegExp(`(?:const|let|var)\\s+${root}\\s*=\\s*([^;]+)`);
|
|
71
|
+
for (let i = lineIdx - 1; i >= Math.max(0, lineIdx - 40); i--) {
|
|
72
|
+
const mm = String(lines[i] || '').match(assignRe);
|
|
73
|
+
if (!mm) continue;
|
|
74
|
+
const rhs = mm[1];
|
|
75
|
+
// ⚠️ 只认「同目录派生」:模板串/字符串拼接(`${ctx.x}.tmp`、x + '.tmp')与成员传递;
|
|
76
|
+
// join(...) / resolve(...) 会**新增路径段**(join(dir,'sub','a.json'))⇒ 目录可能还没建,
|
|
77
|
+
// 仍由本函数负责 ⇒ 不豁免 ✓(否则会把真命中一起修掉 ✗,实测过一轮)
|
|
78
|
+
if (/\bjoin\s*\(|\bresolve\s*\(/.test(rhs)) return false;
|
|
79
|
+
const ids = rhs.match(/[$A-Za-z_][\w$]*/g) || [];
|
|
80
|
+
return ids.some((id) => params.has(id)); // 由形参派生 ⇒ 目录由调用方负责
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 取「所属函数」的形参名集合(向上找最近的函数签名;找不到返回空集)。
|
|
87
|
+
* 支持 function 声明/表达式、方法简写、箭头函数与 async 变体;
|
|
88
|
+
* 默认值、类型注解、解构都做保守处理(解构里的标识符也算形参 ✓)。
|
|
89
|
+
* @param {string[]} lines 文件全部行
|
|
90
|
+
* @param {number} lineIdx 命中行索引(0 基)
|
|
91
|
+
* @returns {Set<string>} 形参名集合
|
|
92
|
+
*/
|
|
93
|
+
function enclosingParams(lines, lineIdx) {
|
|
94
|
+
const out = new Set();
|
|
95
|
+
// ⚠️ 控制流行不是函数签名:`if (cond) {` / `for (…) {` / `while (…) {` / `catch (e) {` 等
|
|
96
|
+
// 都能被 `(…)\s*{` 匹配上 ⇒ 会把判定用的花括号误当函数体、参数集取成条件里的标识符 ✗
|
|
97
|
+
// (2026-10-17 实测:正是这一条让 hasForeignWriteTarget 对 ZipCalm 三处全部返回 false)
|
|
98
|
+
const CTRL_RE = /^\s*(?:\}\s*)?(?:if|for|while|switch|catch|do|else|return|with)\b/;
|
|
99
|
+
// ⚠️ 第二个实测坑:**行内回调**里的 `=>` 也会被当成函数头 ✗
|
|
100
|
+
// store.js 的 `const body = … ? \`${entries.map((item) => JSON.stringify(item))…` 与
|
|
101
|
+
// writer.js 的 `createThrottledReporter(ctx.onProgress || (() => {}), {`
|
|
102
|
+
// 都被扫成"签名" ⇒ 参数集 {item} / 空 ⇒ ctx 不在其中 ⇒ 判不出来 ✓(已修:箭头必须**以 => 结尾**)
|
|
103
|
+
// ③ 嵌套回调里写的目标,其目录往往由**外层函数**的形参决定(tarFamily 的 planned 来自外层)⇒
|
|
104
|
+
// 向外收集多层作用域的形参并集(上限 4 层,避免过度收集削弱规则)
|
|
105
|
+
const MAX_SCOPE_HEADS = 4;
|
|
106
|
+
for (let i = lineIdx, heads = 0; i >= Math.max(0, lineIdx - FUNC_START_SCAN_BACK) && heads < MAX_SCOPE_HEADS; i--) {
|
|
107
|
+
const text = String(lines[i] || '');
|
|
108
|
+
if (CTRL_RE.test(text)) continue;
|
|
109
|
+
const isDecl = /(?:^|\s)(?:async\s+)?function\b/.test(text);
|
|
110
|
+
const isArrowHead = /(?:\([^()]*\)|[$A-Za-z_][\w$]*)\s*=>\s*\{?\s*$/.test(text);
|
|
111
|
+
const isMethod = !/=>/.test(text) && /^\s*(?:export\s+)?(?:async\s+)?[$A-Za-z_][\w$]*\s*\([^)]*\)\s*\{/.test(text);
|
|
112
|
+
if (!isDecl && !isArrowHead && !isMethod) continue;
|
|
113
|
+
const sig = text.match(/(?:function\s*[$A-Za-z_][\w$]*\s*|(?:async\s+)?)(\([^)]*\))/)
|
|
114
|
+
|| (isArrowHead ? text.match(/(\([^)]*\))\s*=>/) : null);
|
|
115
|
+
if (!sig) continue;
|
|
116
|
+
for (const part of sig[1].replace(/[()]/g, '').split(',')) {
|
|
117
|
+
const name = (part.split(/[=:]/)[0].match(/[$A-Za-z_][\w$]*/g) || []).pop();
|
|
118
|
+
if (name) out.add(name);
|
|
119
|
+
}
|
|
120
|
+
heads += 1;
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
|
|
36
125
|
/**
|
|
37
126
|
* 外部 API 调用超时语义豁免:
|
|
38
127
|
* robustness/timeout-on-external-api 规则用纯 regex 匹配 `fetch(`/`axios.(` 等调用,
|
package/lib/audit/finding.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { exemptHintForFinding, exemptMarkerCovers } from '../exempt/index.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* 是否「拦截级」finding —— **统一定义**(severity 为 blocker 或 error)。
|
|
5
|
+
*
|
|
6
|
+
* 为什么必须有这个函数(2026-10-17 由反馈「summary.blocker(10) vs 枚举(7)」触发):
|
|
7
|
+
* summarize 把 error 计入 blocker(见下方 1.1.0 修复),但各处枚举 blocked[] 只筛
|
|
8
|
+
* `severity === 'blocker'` ⇒ 同一个「拦截级」两套口径 ⇒ 出现 10 vs 7 的差额
|
|
9
|
+
* (差的正是 3 条 error 级:圈复杂度等)。凡需要枚举/判定拦截级的地方一律调本函数 ✓
|
|
10
|
+
*/
|
|
11
|
+
export function isBlockerFinding(f) {
|
|
12
|
+
const sev = (f && f.severity) || 'warning';
|
|
13
|
+
return sev === 'blocker' || sev === 'error';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 统一问题对象构造器(所有审计检查的出口)。 */
|
|
4
18
|
export function makeFinding({ file, line, rule, kind, severity = 'warning', message, dimensions = [], exemptHint = '', scoreImpact = 0 }) {
|
|
5
19
|
return { file, line, rule, kind, severity, message, dimensions, exemptHint, scoreImpact };
|
|
6
20
|
}
|
|
@@ -68,7 +82,7 @@ export function summarize(findings = []) {
|
|
|
68
82
|
let blocker = 0, warning = 0, notice = 0;
|
|
69
83
|
for (const f of findings) {
|
|
70
84
|
const sev = f.severity || 'warning';
|
|
71
|
-
if (
|
|
85
|
+
if (isBlockerFinding(f)) blocker++; // error=拦截级(凭据泄露/语法错误等)
|
|
72
86
|
else if (sev === 'notice' || sev === 'info') notice++;
|
|
73
87
|
else warning++;
|
|
74
88
|
}
|
package/lib/audit/index.js
CHANGED
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
|
|
25
25
|
import '../rule/compilers.js'; // 副作用:注册 13 种编译函数
|
|
26
26
|
|
|
27
|
-
export { makeFinding, decorateTestExemptHint, normalizeExemptHints, summarize, CODE_EXTS } from './finding.js';
|
|
27
|
+
export { makeFinding, decorateTestExemptHint, normalizeExemptHints, isBlockerFinding, summarize, CODE_EXTS } from './finding.js';
|
|
28
28
|
export { slotStatsFromFindings, buildRuleSlotMap, countRulesBySlot } from './slot.js';
|
|
29
29
|
export { repoLevelSemanticRuleIds, pickRepoLevelAnchorFile } from './repo-level.js';
|
|
30
|
-
export { hasMkdirInSameFunction, hasExternalCallTimeout, detectRepoJsYamlImport, isVersionInPathContext } from './file-context.js';
|
|
30
|
+
export { hasMkdirInSameFunction, hasForeignWriteTarget, hasExternalCallTimeout, detectRepoJsYamlImport, isVersionInPathContext } from './file-context.js';
|
|
31
31
|
export { auditFile } from './audit-file.js';
|
|
32
32
|
export { capScanFiles, auditFull, auditChanged, auditWithScope } from './orchestrate.js';
|
|
33
33
|
export { findingsToYaml } from './report-yaml.js';
|
|
@@ -159,6 +159,14 @@ export function checkButtonBindings({ file, text, rules }) {
|
|
|
159
159
|
const btnRe = /<button\b([^>]*)>([\s\S]*?)<\/button\s*>|<input\b[^>]*type\s*=\s*['"](?:button|submit)['"][^>]*>/gi;
|
|
160
160
|
// JSX/React 事件属性(onClick=/onChange= 等驼峰 on[A-Z])→ 声明式绑定,视为已绑定(防 React 代码误报 unbound)
|
|
161
161
|
const jsxEventRe = /\bon[A-Z][\w]*\s*=\s*[\{'"`]/;
|
|
162
|
+
// Vue/声明式模板事件属性:@click / @click.self|stop|prevent|once / v-on:click(含修饰符)/ @[click]
|
|
163
|
+
// 2026-10-17 由 ZipCalm 反馈修复:该项目的 .vue 按钮**全部**写作
|
|
164
|
+
// `<button … data-testid="compress-close" @click="emit('close')">关闭</button>`,
|
|
165
|
+
// 而旧判据只认 React 的 onClick ⇒ 同一元素上的绑定看不见 ⇒ 16 条全部误报
|
|
166
|
+
// (判据说"未找到绑定证据",但绑定就写在按钮元素自己身上 ✗ 属判错事实)。
|
|
167
|
+
// 注意只认 click 类事件:Vue 的 @click 是绑定证据,与 HTML 字符串里的 inline onclick 不同,
|
|
168
|
+
// 不产生 button/inline-binding-in-string 提示(那是 DOM0 内联写法的问题)。
|
|
169
|
+
const vueEventRe = /(?:@click(?:\.\w+)*|v-on:click(?:\.\w+)*|@\[click\])\s*=/;
|
|
162
170
|
for (const chunk of htmlChunks.concat(tplChunks)) {
|
|
163
171
|
let bm;
|
|
164
172
|
while ((bm = btnRe.exec(chunk.html)) !== null) {
|
|
@@ -171,6 +179,11 @@ export function checkButtonBindings({ file, text, rules }) {
|
|
|
171
179
|
text: (bm[2] || '').replace(/<[^>]*>/g, '').trim().slice(0, 30),
|
|
172
180
|
hasInline: /\bonclick\s*=/.test(attrs),
|
|
173
181
|
jsxBound: jsxEventRe.test(attrs), // React 声明式事件(onClick 等驼峰)
|
|
182
|
+
vueBound: vueEventRe.test(attrs), // Vue 声明式事件(@click / v-on:click)
|
|
183
|
+
// 静态 disabled 按钮:永远不会被点击 ⇒ 无需绑定(2026-10-17 ZipCalm 反馈:
|
|
184
|
+
// `<button type="button" disabled title="任务未结束…">删除</button>` 被判 unbound 属
|
|
185
|
+
// 判据不适配 ✓)。只认静态属性:`:disabled="cond"` 是动态的,可能可点 ⇒ 不在此列 ✓
|
|
186
|
+
staticDisabled: /(?:^|\s)disabled(?:\s|$)/.test(attrs),
|
|
174
187
|
});
|
|
175
188
|
}
|
|
176
189
|
}
|
|
@@ -228,7 +241,9 @@ export function checkButtonBindings({ file, text, rules }) {
|
|
|
228
241
|
// 3b. HTML 字符串里的按钮
|
|
229
242
|
for (const btn of btns) {
|
|
230
243
|
// JSX/React 声明式事件:onClick 等驼峰属性 = 已绑定(React 虚拟 DOM 内声明式,非油猴场景)
|
|
231
|
-
|
|
244
|
+
// Vue 同理:@click / v-on:click 写在按钮元素上 = 已绑定(2026-10-17 修复,见 vueEventRe 注释)
|
|
245
|
+
if (btn.jsxBound || btn.vueBound) continue;
|
|
246
|
+
if (btn.staticDisabled) continue; // 静态禁用按钮:不可点 ⇒ 无绑定诉求 ✓
|
|
232
247
|
// inline onclick:有绑定但建议改(info)
|
|
233
248
|
if (btn.hasInline) {
|
|
234
249
|
findings.push(makeFinding({
|
|
@@ -272,5 +287,13 @@ export function checkButtonBindings({ file, text, rules }) {
|
|
|
272
287
|
dimensions: ['可维护性'], exemptHint: HINT_QUALITY, scoreImpact: 1,
|
|
273
288
|
}));
|
|
274
289
|
}
|
|
275
|
-
|
|
290
|
+
// 去重:同一按钮可能被多路提取命中(innerHTML 片段 + 反引号模板 + JSX 工厂)⇒ 同一行只留一条
|
|
291
|
+
// (2026-10-17 实测:`el.innerHTML = \`<button…>\`` 会同时进 htmlChunks 与 tplChunks ⇒ 重复报 2 条 ✗)
|
|
292
|
+
const seenKey = new Set();
|
|
293
|
+
return findings.filter((f) => {
|
|
294
|
+
const k = `${f.rule}|${f.line}`;
|
|
295
|
+
if (seenKey.has(k)) return false;
|
|
296
|
+
seenKey.add(k);
|
|
297
|
+
return true;
|
|
298
|
+
});
|
|
276
299
|
}
|
package/lib/commit-push.js
CHANGED
|
@@ -30,7 +30,7 @@ import { resolveRepoVisibility } from './git/index.js';
|
|
|
30
30
|
* (README「④ 私有库豁免」);缺省按 origin 探测,探测失败按 unknown(保守拦截)。
|
|
31
31
|
* 显式传入可免网络探测(测试/已知场景)。
|
|
32
32
|
*/
|
|
33
|
-
export async function runAudit({ repoPath = '', audit, rulesetDir, slots, cfg: extCfg, visibility: extVisibility } = {}) {
|
|
33
|
+
export async function runAudit({ repoPath = '', audit, rulesetDir, slots, cfg: extCfg, visibility: extVisibility, exemptPaths = [], exemptReason = '' } = {}) {
|
|
34
34
|
const cfg = extCfg || defaultConfig();
|
|
35
35
|
const doAudit = audit ?? cfg.auditEnabled;
|
|
36
36
|
if (!doAudit) return { ok: true, audit: null };
|
|
@@ -58,9 +58,27 @@ export async function runAudit({ repoPath = '', audit, rulesetDir, slots, cfg: e
|
|
|
58
58
|
// 审计输出改为「级别数量 + 评分 + API 查询用法」——审计明细由聚合 API
|
|
59
59
|
// (/api/git-push/audit)查询,不再内联 findings 全文;blocked 摘要保留(拦截必需)。
|
|
60
60
|
auditOut.apiGuide = buildAuditApiGuide(repoPath, { scope: auditRes.scope, summary: auditRes.summary, quality: auditOut.quality });
|
|
61
|
+
// 本次提交的按文件临时豁免(auditExemptPaths):列入的文件 finding 一律不参与拦截判定(含 blocker),
|
|
62
|
+
// 仅本次有效、不落盘、不改 .auditignore;评分仍用全量 findings(豁免不影响打分基数)。
|
|
63
|
+
// 语义按需求方定稿:豁免即豁免,不设「只允许 warning/notice」的限制,也不按规则类别过滤。
|
|
64
|
+
const exemptSet = new Set((Array.isArray(exemptPaths) ? exemptPaths : [])
|
|
65
|
+
.map((p) => String(p || '').replace(/\\/g, '/').replace(/^\.\//, '').trim())
|
|
66
|
+
.filter(Boolean));
|
|
67
|
+
const isExemptFile = (f) => exemptSet.size > 0 && exemptSet.has(String(f.file || '').replace(/\\/g, '/').replace(/^\.\//, ''));
|
|
68
|
+
const exemptFindings = exemptSet.size ? auditRes.findings.filter((f) => isExemptFile(f)) : [];
|
|
61
69
|
// 只算非示例目录的 blocker(示例目录内的 blocker 是规则演示,不拦真实提交)
|
|
62
|
-
const blocked = auditRes.findings.filter((f) => f.severity === 'blocker' && !isSampleExemptDir(repoPath || '.', f.file));
|
|
70
|
+
const blocked = auditRes.findings.filter((f) => f.severity === 'blocker' && !isSampleExemptDir(repoPath || '.', f.file) && !isExemptFile(f));
|
|
63
71
|
auditOut.blocked = blocked.map((f) => ({ file: f.file, line: f.line, rule: f.rule, message: (f.message || '').slice(0, MAX_MSG_PREVIEW) }));
|
|
72
|
+
if (exemptSet.size) {
|
|
73
|
+
// 回显(记录而非判断):本次豁免了哪些文件、命中哪些规则、共几条 finding
|
|
74
|
+
auditOut.exempt = {
|
|
75
|
+
files: [...exemptSet],
|
|
76
|
+
count: exemptFindings.length,
|
|
77
|
+
rules: [...new Set(exemptFindings.map((f) => f.rule).filter(Boolean))],
|
|
78
|
+
...(exemptReason ? { reason: String(exemptReason) } : {}),
|
|
79
|
+
note: '本次提交临时豁免(不落盘、不影响后续提交);评分仍按全量 findings 计算',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
64
82
|
if (blocked.length > 0) {
|
|
65
83
|
// 【修复】私有库豁免(README「④ 私有库豁免」):远端可见性 = private → 审计只报告不拦截。
|
|
66
84
|
// 修复背景:私有库被拦的回归——
|
package/lib/core/exec.js
CHANGED
|
@@ -84,14 +84,15 @@ export const GIT_READ_VERBS = new Set(['fetch', 'clone', 'pull', 'ls-remote', 's
|
|
|
84
84
|
export const GIT_GLOBAL_ARGS = ['-c', 'safe.directory=*', '-c', 'core.filemode=false', '-c', 'core.quotepath=false'];
|
|
85
85
|
|
|
86
86
|
/** 统一 git 执行(数组参数,零注入面;stderr 保留供排障)。 */
|
|
87
|
-
export function runGit(args, { cwd = '', timeoutMs = 120_000, env = {} } = {}) {
|
|
87
|
+
export function runGit(args, { cwd = '', timeoutMs = 120_000, env = {}, noMirror = false } = {}) {
|
|
88
88
|
const base = GIT_GLOBAL_ARGS;
|
|
89
89
|
const bin = resolveGitBin();
|
|
90
90
|
if (!bin) return { ok: false, stdout: '', stderr: GIT_MISSING_MSG };
|
|
91
91
|
// 只读的网络动词注入镜像(与 http 层同口径:默认走 gh-proxy);
|
|
92
92
|
// 写操作(push 等)不在集合里 ⇒ 不注入 ⇒ 推送一律直连(凭据与写入不经第三方)。
|
|
93
|
+
// noMirror:调用方已判定目标仓库是私有/未知 ⇒ 不注入——镜像看不到私有库,注入必失败。
|
|
93
94
|
const mirrorEnv = {};
|
|
94
|
-
if (GIT_READ_VERBS.has(String(args[0] || ''))) mirrorGitConfigEnv(mirrorEnv, { mode: 'read' });
|
|
95
|
+
if (!noMirror && GIT_READ_VERBS.has(String(args[0] || ''))) mirrorGitConfigEnv(mirrorEnv, { mode: 'read' });
|
|
95
96
|
try {
|
|
96
97
|
const out = execFileSync(bin, cwd ? base.concat(['-C', cwd], args) : base.concat(args), {
|
|
97
98
|
encoding: 'utf8',
|
|
@@ -139,14 +140,15 @@ export function gitRaw(args, { cwd = '', timeoutMs = 600_000 } = {}) {
|
|
|
139
140
|
* 实测 6 仓「并发」仍要 13s(≈ 串行)。改用本函数后各 worker 的子进程才能真正并行等待。
|
|
140
141
|
* 语义与 runGit 保持一致:stdout 同样 trim,失败返回 {ok:false, error} 而不抛。
|
|
141
142
|
*/
|
|
142
|
-
export function runGitAsync(args, { cwd = '', timeoutMs = 120_000, env = {} } = {}) {
|
|
143
|
+
export function runGitAsync(args, { cwd = '', timeoutMs = 120_000, env = {}, noMirror = false } = {}) {
|
|
143
144
|
const base = GIT_GLOBAL_ARGS;
|
|
144
145
|
const bin = resolveGitBin();
|
|
145
146
|
if (!bin) return Promise.resolve({ ok: false, stdout: '', stderr: GIT_MISSING_MSG });
|
|
146
147
|
// 与 runGit 同口径:只读网络动词注入镜像,push 等写操作不注入(见 GIT_READ_VERBS)。
|
|
147
148
|
// 此前只有同步版注入,异步版仍直连 ⇒ 并发探测远端那类调用绕过镜像。
|
|
149
|
+
// noMirror:目标仓库私有/未知时不注入(镜像看不到私有库)。
|
|
148
150
|
const mirrorEnv = {};
|
|
149
|
-
if (GIT_READ_VERBS.has(String(args[0] || ''))) mirrorGitConfigEnv(mirrorEnv, { mode: 'read' });
|
|
151
|
+
if (!noMirror && GIT_READ_VERBS.has(String(args[0] || ''))) mirrorGitConfigEnv(mirrorEnv, { mode: 'read' });
|
|
150
152
|
return new Promise((resolve) => {
|
|
151
153
|
execFile(bin, cwd ? base.concat(['-C', cwd], args) : base.concat(args), {
|
|
152
154
|
encoding: 'utf8',
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 注释豁免工具(exempt):把「手写 dsh-skip-* 注释」变成工具操作。
|
|
3
|
+
*
|
|
4
|
+
* 解决的问题(历史痛点):
|
|
5
|
+
* ① 记不住哪个 finding 该写哪个标记、写文件头还是行尾;
|
|
6
|
+
* ② 写了标记却不生效(提示与实际行为不符,曾一次查出 24 种组合);
|
|
7
|
+
* ③ 标记散落各文件,无法盘点/清理。
|
|
8
|
+
*
|
|
9
|
+
* 动作:add(加)/ remove(删)/ list(盘点)/ check(校验真生效)。
|
|
10
|
+
* 标记映射单一真源:直接读同进程 lib/exempt/index.js 的 EXEMPT_MARKERS,不复制。
|
|
11
|
+
*
|
|
12
|
+
* 写入格式与手写完全一致(审计侧零改动):
|
|
13
|
+
* header → 文件头前 3 行内追加 `// dsh-skip-<x>: <reason>`
|
|
14
|
+
* line → 该行行尾追加 ` // dsh-skip-<x>`
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs';
|
|
17
|
+
import { join, relative, resolve, sep, dirname } from 'node:path';
|
|
18
|
+
|
|
19
|
+
import { EXEMPT_MARKERS, exemptHintForFinding, exemptMarkerCovers } from './index.js';
|
|
20
|
+
import { auditFull } from '../audit/orchestrate.js';
|
|
21
|
+
|
|
22
|
+
/** 跑一次审计找 rule 对应的 finding kind(豁免判定按 kind,如 max-nesting-depth → max-depth)。 */
|
|
23
|
+
async function findRuleKind(repoPath, ruleId) {
|
|
24
|
+
try {
|
|
25
|
+
const full = await auditFull(repoPath, { scope: 'full', maxScanFiles: 2000 });
|
|
26
|
+
const hit = (full.findings || []).find((f) => f.rule === ruleId);
|
|
27
|
+
return hit ? String(hit.kind || '') : '';
|
|
28
|
+
} catch {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 读文件(UTF-8);不存在返回 null。 */
|
|
34
|
+
function readText(file) {
|
|
35
|
+
try { return existsSync(file) ? readFileSync(file, 'utf8') : null; } catch { return null; }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 路径归一:相对仓库根、去 ./、防越界。返回 { ok, abs?, rel?, error? }。 */
|
|
39
|
+
function resolveTarget(repoPath, p) {
|
|
40
|
+
const root = resolve(repoPath);
|
|
41
|
+
const rel = String(p || '').replace(/\\/g, '/').replace(/^\.\//, '').trim();
|
|
42
|
+
if (!rel) return { ok: false, error: '缺少 path' };
|
|
43
|
+
if (rel.startsWith('/') || /^[A-Za-z]:/.test(rel)) return { ok: false, error: `path 必须是相对仓库根(收到绝对路径:${rel})` };
|
|
44
|
+
const abs = resolve(root, rel);
|
|
45
|
+
if (abs !== root && !abs.startsWith(root + sep)) return { ok: false, error: `path 越界(解析后不在仓库内:${rel})` };
|
|
46
|
+
return { ok: true, abs, rel };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 由 rule/marker 推导写入参数;返回 { ok, marker?, scope?, reason?, error? }。 */
|
|
50
|
+
function resolveMarker({ rule = '', marker = '', scope = '', kind = '' }) {
|
|
51
|
+
const wantMarker = String(marker || '').trim();
|
|
52
|
+
const wantRule = String(rule || '').trim();
|
|
53
|
+
if (!wantMarker && !wantRule) return { ok: false, error: '需要 rule(用于推导标记)或显式 marker' };
|
|
54
|
+
// 反查「真能豁免该 rule 的标记」(与豁免判定同一口径)
|
|
55
|
+
// 豁免判定按 finding 的 kind(如 max-nesting-depth → max-depth)——kind 由 addExempt 跑审计拿到;
|
|
56
|
+
// 拿不到时退回 id 最后一段(仅兜底,可能对不上,会如实报「没有标记能豁免」)。
|
|
57
|
+
const kindUsed = kind || (wantRule ? String(wantRule).split('/').pop() : '');
|
|
58
|
+
const hint = wantRule ? exemptHintForFinding({ rule: wantRule, kind: kindUsed }) : null;
|
|
59
|
+
const resolved = wantMarker || (hint && hint.marker) || '';
|
|
60
|
+
if (!resolved) return { ok: false, error: `没有任何标记能豁免 rule「${wantRule}」(应改代码,或走 .auditignore / 豁免槽位)` };
|
|
61
|
+
const meta = EXEMPT_MARKERS[resolved];
|
|
62
|
+
if (!meta) return { ok: false, error: `未知标记「${resolved}」;可用:${Object.keys(EXEMPT_MARKERS).join(', ')}` };
|
|
63
|
+
// 显式 marker 与 rule 推导冲突 ⇒ 以推导为准并报错(防写错标记)
|
|
64
|
+
if (wantMarker && hint && hint.marker !== wantMarker) {
|
|
65
|
+
return { ok: false, error: `标记「${wantMarker}」不能豁免 rule「${wantRule}」,正确标记是「${hint.marker}」` };
|
|
66
|
+
}
|
|
67
|
+
// 显式 marker 但没给 rule:用 marker 的元数据判定范围
|
|
68
|
+
const finalScope = String(scope || '').trim() || (meta.lineLevel ? 'header' : 'header');
|
|
69
|
+
if (finalScope === 'line' && meta.lineLevel !== true) {
|
|
70
|
+
return { ok: false, error: `标记「${resolved}」不支持行级(lineLevel=false),只能用 scope=header` };
|
|
71
|
+
}
|
|
72
|
+
if (finalScope !== 'header' && finalScope !== 'line') {
|
|
73
|
+
return { ok: false, error: `scope 只能是 header 或 line(收到 ${finalScope})` };
|
|
74
|
+
}
|
|
75
|
+
return { ok: true, marker: resolved, scope: finalScope, hint: hint ? hint.hint : (meta.hint || '') };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 是否已有同一标记(header:前 3 行;line:指定行)。 */
|
|
79
|
+
function hasMarker(lines, marker, scope, line) {
|
|
80
|
+
const re = new RegExp(`dsh-skip-${marker.replace(/^dsh-skip-/, '')}\\b`);
|
|
81
|
+
if (scope === 'header') return lines.slice(0, 3).some((l) => re.test(l));
|
|
82
|
+
const idx = Number(line) - 1;
|
|
83
|
+
return idx >= 0 && idx < lines.length && re.test(lines[idx]);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** 生成 header 注释行。 */
|
|
87
|
+
function headerComment(marker, reason) {
|
|
88
|
+
return `// ${marker}${reason ? `: ${String(reason).replace(/\s+/g, ' ').trim()}` : ''}`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* add:给指定文件(或行)加豁免注释。
|
|
93
|
+
* @returns {{ok, results?:Array, error?}}
|
|
94
|
+
*/
|
|
95
|
+
export async function addExempt({ repoPath = '', path: p, line, scope = '', rule = '', marker = '', reason = '', dryRun = false } = {}) {
|
|
96
|
+
const paths = Array.isArray(p) ? p : [p];
|
|
97
|
+
if (!paths.length) return { ok: false, error: '缺少 path' };
|
|
98
|
+
if (paths.length > 1 && line !== undefined) return { ok: false, error: '多文件时不允许 line(行号无法跨文件对齐)——改用 scope=header 或逐个调用' };
|
|
99
|
+
// 先跑一次审计拿 rule 的 finding kind(豁免判定按 kind,如 max-nesting-depth → max-depth)
|
|
100
|
+
const kind = String(rule || '').trim() ? await findRuleKind(repoPath, String(rule).trim()) : '';
|
|
101
|
+
const m = resolveMarker({ rule, marker, scope, kind });
|
|
102
|
+
if (!m.ok) return { ok: false, error: m.error };
|
|
103
|
+
if (m.scope === 'line' && line === undefined) return { ok: false, error: 'scope=line 时必须给 line(1-based 行号)' };
|
|
104
|
+
|
|
105
|
+
// ① 先全部校验(原子:任一失败则一个都不写)
|
|
106
|
+
const plans = [];
|
|
107
|
+
const results = [];
|
|
108
|
+
for (const one of paths) {
|
|
109
|
+
const t = resolveTarget(repoPath, one);
|
|
110
|
+
if (!t.ok) { results.push({ path: String(one), ok: false, error: t.error }); continue; }
|
|
111
|
+
const text = readText(t.abs);
|
|
112
|
+
if (text === null) { results.push({ path: t.rel, ok: false, error: '文件不存在' }); continue; }
|
|
113
|
+
const lines = text.split('\n');
|
|
114
|
+
if (m.scope === 'line') {
|
|
115
|
+
const idx = Number(line) - 1;
|
|
116
|
+
if (!Number.isInteger(idx) || idx < 0 || idx >= lines.length) { results.push({ path: t.rel, ok: false, error: `line ${line} 越界(文件共 ${lines.length} 行)` }); continue; }
|
|
117
|
+
const row = lines[idx];
|
|
118
|
+
if (/\/\*/.test(row) && !/\*\//.test(row)) { results.push({ path: t.rel, ok: false, error: '该行在块注释内,建议 scope=header' }); continue; }
|
|
119
|
+
if (/^\s*(\/\/|\*)/.test(row)) { results.push({ path: t.rel, ok: false, error: '该行是注释行,无法行尾追加,建议 scope=header' }); continue; }
|
|
120
|
+
if (hasMarker(lines, m.marker, 'line', line)) { results.push({ path: t.rel, ok: true, unchanged: true }); continue; }
|
|
121
|
+
const next = [...lines];
|
|
122
|
+
next[idx] = `${row} // ${m.marker}`;
|
|
123
|
+
plans.push({ abs: t.abs, rel: t.rel, next: next.join('\n') });
|
|
124
|
+
results.push({ path: t.rel, ok: true, changed: true, line: Number(line), marker: m.marker });
|
|
125
|
+
} else {
|
|
126
|
+
if (hasMarker(lines, m.marker, 'header')) { results.push({ path: t.rel, ok: true, unchanged: true }); continue; }
|
|
127
|
+
const next = [headerComment(m.marker, reason), ...lines];
|
|
128
|
+
plans.push({ abs: t.abs, rel: t.rel, next: next.join('\n') });
|
|
129
|
+
results.push({ path: t.rel, ok: true, changed: true, marker: m.marker, scope: 'header' });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const failed = results.filter((r) => r.ok === false);
|
|
133
|
+
if (failed.length) return { ok: false, error: `校验失败(${failed.length} 个文件),未写入任何文件`, results };
|
|
134
|
+
// ② 统一写盘
|
|
135
|
+
if (dryRun) return { ok: true, dryRun: true, results };
|
|
136
|
+
for (const plan of plans) writeFileSync(plan.abs, plan.next, 'utf8');
|
|
137
|
+
return { ok: true, results };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** remove:移除指定文件的豁免(指定 marker 或该文件全部 dsh-skip)。 */
|
|
141
|
+
export function removeExempt({ repoPath = '', path: p, marker = '', dryRun = false } = {}) {
|
|
142
|
+
const paths = Array.isArray(p) ? p : [p];
|
|
143
|
+
const results = [];
|
|
144
|
+
for (const one of paths) {
|
|
145
|
+
const t = resolveTarget(repoPath, one);
|
|
146
|
+
if (!t.ok) { results.push({ path: String(one), ok: false, error: t.error }); continue; }
|
|
147
|
+
const text = readText(t.abs);
|
|
148
|
+
if (text === null) { results.push({ path: t.rel, ok: false, error: '文件不存在' }); continue; }
|
|
149
|
+
const re = marker ? new RegExp(`\\s*//\\s*dsh-skip-${marker.replace(/^dsh-skip-/, '')}(?::[^\\n]*)?`, 'g') : /\s*\/\/\s*dsh-skip-[a-z]+(?::[^\n]*)?/g;
|
|
150
|
+
const next = text.replace(re, '');
|
|
151
|
+
if (next === text) { results.push({ path: t.rel, ok: true, unchanged: true }); continue; }
|
|
152
|
+
if (!dryRun) writeFileSync(t.abs, next, 'utf8');
|
|
153
|
+
results.push({ path: t.rel, ok: true, changed: true });
|
|
154
|
+
}
|
|
155
|
+
const failed = results.filter((r) => r.ok === false);
|
|
156
|
+
if (failed.length) return { ok: false, error: `校验失败(${failed.length} 个文件)`, results };
|
|
157
|
+
return { ok: true, dryRun, results };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** list:盘点仓库内所有 dsh-skip 标记(按文件 × 标记 × 位置)。 */
|
|
161
|
+
export function listExempt({ repoPath = '', root = '' } = {}) {
|
|
162
|
+
const base = resolve(root || repoPath);
|
|
163
|
+
const out = [];
|
|
164
|
+
const walk = (dir, depth) => {
|
|
165
|
+
if (depth > 8) return;
|
|
166
|
+
let entries = [];
|
|
167
|
+
try { entries = readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
168
|
+
for (const e of entries) {
|
|
169
|
+
if (e.name === 'node_modules' || e.name === '.git' || e.name === '.trash') continue;
|
|
170
|
+
const full = join(dir, e.name);
|
|
171
|
+
if (e.isDirectory()) { walk(full, depth + 1); continue; }
|
|
172
|
+
if (!/\.(js|mjs|cjs|ts|tsx|jsx|py|md)$/.test(e.name)) continue;
|
|
173
|
+
const text = readText(full);
|
|
174
|
+
if (!text) continue;
|
|
175
|
+
const lines = text.split('\n');
|
|
176
|
+
lines.forEach((row, i) => {
|
|
177
|
+
const m = row.match(/dsh-skip-([a-z]+)/);
|
|
178
|
+
if (!m) return;
|
|
179
|
+
out.push({ file: relative(base, full).split(sep).join('/'), line: i + 1, marker: `dsh-skip-${m[1]}`, scope: i < 3 ? 'header' : 'line' });
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
walk(base, 0);
|
|
184
|
+
return { ok: true, total: out.length, items: out };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** check:校验每条标记是否真的能豁免(用同一判定器对 rule 反查,识别死标记/写错标记)。 */
|
|
188
|
+
export function checkExempt({ repoPath = '', root = '' } = {}) {
|
|
189
|
+
const listed = listExempt({ repoPath, root });
|
|
190
|
+
const issues = [];
|
|
191
|
+
for (const it of listed.items) {
|
|
192
|
+
const meta = EXEMPT_MARKERS[it.marker];
|
|
193
|
+
if (!meta) { issues.push({ ...it, issue: 'unknown-marker', hint: '标记不在注册表里(拼写错误?)' }); continue; }
|
|
194
|
+
// 用标记的 blocked 反查:该标记能豁免哪些 rule 前缀——至少应有一个(否则标记形同虚设)
|
|
195
|
+
if (!Array.isArray(meta.blocked) || !meta.blocked.length) issues.push({ ...it, issue: 'dead-marker', hint: '该标记没有可豁免的 blocked 类型' });
|
|
196
|
+
}
|
|
197
|
+
return { ok: issues.length === 0, total: listed.total, issues };
|
|
198
|
+
}
|
|
@@ -16,6 +16,8 @@ import { fetchCommitChain } from './clone-history.js';
|
|
|
16
16
|
import { replayHistory } from './clone-replay.js';
|
|
17
17
|
import { createReplayIo } from './clone-replay-io.js';
|
|
18
18
|
import { runGit } from './exec.js';
|
|
19
|
+
import { resolveOwnerVisibility, accessPlan, sshGitUrl } from './visibility.js';
|
|
20
|
+
import { resolveSshKeys } from './credentials.js';
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* 取某分支的 HEAD sha。
|
|
@@ -105,12 +107,26 @@ export async function cloneWithHistory({
|
|
|
105
107
|
* @returns {Promise<{ok:boolean,headSha:string,depth:number,truncated:boolean,steps:Array<object>,error?:string}>}
|
|
106
108
|
*/
|
|
107
109
|
export async function cloneWithGitFetch({
|
|
108
|
-
owner = '', repo = '', branch = '', repoPath = '', depth, deps = {},
|
|
110
|
+
owner = '', repo = '', branch = '', repoPath = '', depth, deps = {}, token = '',
|
|
109
111
|
} = {}) {
|
|
110
112
|
const git = deps.runGit || runGit;
|
|
111
|
-
|
|
113
|
+
// 统一前置判断:私有/未知仓库不走第三方镜像——镜像看不到私有库,经它 fetch 必然认证失败。
|
|
114
|
+
// deps.visibility 供离线测试直接指定结果('public' | 'private' | 'unknown')。
|
|
115
|
+
const vis = deps.visibility ? { visibility: deps.visibility } : await resolveOwnerVisibility({ owner, repo, token });
|
|
116
|
+
const plan = accessPlan(vis.visibility);
|
|
117
|
+
// 私有/未知:远端用 SSH 形态(ssh.github.com:443),并注入插件 SSH 密钥;
|
|
118
|
+
// 公开:维持 https + 镜像加速(本机 github.com:443 直连不通,公开库靠镜像)。
|
|
119
|
+
const remoteUrl = plan.transport === 'ssh' ? sshGitUrl(owner, repo) : `https://github.com/${owner}/${repo}.git`;
|
|
120
|
+
const sshEnv = {};
|
|
121
|
+
if (plan.transport === 'ssh') {
|
|
122
|
+
const keyPath = (deps.sshKeyPath || resolveSshKeys()[0]?.keyPath || '');
|
|
123
|
+
if (keyPath) {
|
|
124
|
+
sshEnv.GIT_SSH_COMMAND = `ssh -i "${keyPath}" -p 443 -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new -o BatchMode=yes -o ConnectTimeout=8`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const gitOpts = { cwd: repoPath, noMirror: !plan.useMirror, env: sshEnv };
|
|
112
128
|
const steps = [];
|
|
113
|
-
const fail = (error) => ({ ok: false, headSha: '', depth: Number(depth) || 0, truncated: false, steps, error });
|
|
129
|
+
const fail = (error) => ({ ok: false, headSha: '', depth: Number(depth) || 0, truncated: false, steps, error, visibility: vis.visibility, transport: plan.transport });
|
|
114
130
|
const run = (args) => {
|
|
115
131
|
const r = git(args, gitOpts);
|
|
116
132
|
steps.push({ cmd: args.join(' '), ok: !!r?.ok });
|
|
@@ -123,7 +139,10 @@ export async function cloneWithGitFetch({
|
|
|
123
139
|
// 不支持 mode 的卷(CIFS)上抑制权限噪音——与 API 路径同口径
|
|
124
140
|
run(['config', 'core.fileMode', 'false']);
|
|
125
141
|
if (!git(['remote', 'get-url', 'origin'], gitOpts)?.ok) {
|
|
126
|
-
run(['remote', 'add', 'origin',
|
|
142
|
+
run(['remote', 'add', 'origin', remoteUrl]);
|
|
143
|
+
} else {
|
|
144
|
+
// 已存在 origin(续跑):按本次判断纠正,避免上次留下的 https 形态继续走镜像
|
|
145
|
+
run(['remote', 'set-url', 'origin', remoteUrl]);
|
|
127
146
|
}
|
|
128
147
|
|
|
129
148
|
// 显式 refspec:同时写入 refs/remotes/origin/<branch>,后续可据此建本地分支并设上游
|
|
@@ -139,5 +158,5 @@ export async function cloneWithGitFetch({
|
|
|
139
158
|
if (!co?.ok) return fail(`checkout 失败:${co?.stderr || '未知'}`);
|
|
140
159
|
run(['branch', `--set-upstream-to=origin/${branch}`, branch]);
|
|
141
160
|
|
|
142
|
-
return { ok: true, headSha: sha, depth: n, truncated: n > 0, steps };
|
|
161
|
+
return { ok: true, headSha: sha, depth: n, truncated: n > 0, steps, visibility: vis.visibility, transport: plan.transport };
|
|
143
162
|
}
|