taskboard-workbench 0.2.0 → 0.3.1
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 +321 -0
- package/README.md +95 -0
- package/package.json +20 -6
- package/scripts/tb-flow.mjs +86 -0
- package/skills/taskboard-flow/SKILL.md +89 -0
- package/skills/taskboard-flow/references/errors.md +61 -0
- package/skills/taskboard-flow/references/injection.md +76 -0
- package/skills/taskboard-flow/references/steps/S0.md +31 -0
- package/skills/taskboard-flow/references/steps/S1.md +28 -0
- package/skills/taskboard-flow/references/steps/S2.md +31 -0
- package/skills/taskboard-flow/references/steps/S3.md +22 -0
- package/skills/taskboard-flow/references/steps/S4.md +25 -0
- package/skills/taskboard-flow/references/steps/S5.md +36 -0
- package/skills/taskboard-flow/references/steps/S6.md +30 -0
- package/skills/taskboard-flow/references/steps/S7.md +23 -0
- package/spec/norms/acceptance.md +36 -0
- package/spec/norms/card-update.md +39 -0
- package/spec/norms/doc-editing.md +30 -0
- package/spec/norms/flow.md +45 -0
- package/spec/norms/manifest.json +41 -0
- package/spec/norms/project-defaults.md +33 -0
- package/src/core/acceptance.mjs +62 -0
- package/src/core/contract.mjs +287 -0
- package/src/core/errors.mjs +3 -0
- package/src/core/evidence.mjs +86 -0
- package/src/core/intake.mjs +87 -24
- package/src/core/requirements.mjs +31 -1
- package/src/core/store.mjs +376 -6
- package/src/core/ticket-stage.mjs +162 -0
- package/src/mcp/flow-block.mjs +173 -0
- package/src/mcp/server.mjs +175 -0
- package/src/mcp/tools.mjs +769 -0
- package/src/server/api.mjs +128 -30
- package/src/server/server.mjs +3 -0
- package/web/app.js +162 -34
- package/web/tokens.css +12 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"note": "由 node tools/build-norms.mjs 生成;正文变了必须 bump version(否则 tests/norms-parity.test.mjs 报红)",
|
|
4
|
+
"norms": [
|
|
5
|
+
{
|
|
6
|
+
"norm_id": "acceptance",
|
|
7
|
+
"version": 2,
|
|
8
|
+
"updated": "2026-10-29",
|
|
9
|
+
"digest": "1d91f555c46ecfb122f85e20c3a5ca9c0f37c7f8d2422ed08ce071b25fd98613",
|
|
10
|
+
"file": "spec/norms/acceptance.md"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"norm_id": "card-update",
|
|
14
|
+
"version": 1,
|
|
15
|
+
"updated": "2026-10-29",
|
|
16
|
+
"digest": "1d590cbacca29765f129f742a7137c0bdc80e916b8fca69fdb05a5289b5e1f24",
|
|
17
|
+
"file": "spec/norms/card-update.md"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"norm_id": "doc-editing",
|
|
21
|
+
"version": 1,
|
|
22
|
+
"updated": "2026-10-29",
|
|
23
|
+
"digest": "4e3ca702e45f3dc3f1072be2f4685ca5490dea0dd9a1d753e75ae609c8beaf5f",
|
|
24
|
+
"file": "spec/norms/doc-editing.md"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"norm_id": "flow",
|
|
28
|
+
"version": 1,
|
|
29
|
+
"updated": "2026-10-29",
|
|
30
|
+
"digest": "3b7596bf7bd8c21367e80bc08da6fe332d35ff4faf73f570ae8982c6fdb76371",
|
|
31
|
+
"file": "spec/norms/flow.md"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"norm_id": "project-defaults",
|
|
35
|
+
"version": 1,
|
|
36
|
+
"updated": "2026-10-29",
|
|
37
|
+
"digest": "0afa06d35abda598cb1ef5d94d1d6cfbc061620b664e6adb279f78829ba1d1ad",
|
|
38
|
+
"file": "spec/norms/project-defaults.md"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
norm_id: project-defaults
|
|
3
|
+
version: 1
|
|
4
|
+
updated: 2026-10-29
|
|
5
|
+
applies_to: ["*"]
|
|
6
|
+
---
|
|
7
|
+
# project-defaults · 项目可覆盖项(机器版)
|
|
8
|
+
|
|
9
|
+
## 只允许这 3 类覆盖(其余键一律 `NORM_OVERRIDE_FORBIDDEN`)
|
|
10
|
+
|
|
11
|
+
| 键 | 例 | 为什么允许 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `verifyCommand` | `mvn -q test` / `pytest -q` | 技术栈不同,这是**事实**不是标准 |
|
|
14
|
+
| `workspacePath` | `/path/to/repo` | 同上 |
|
|
15
|
+
| `notApplicable` | `["S4"]` + **必填理由** | 有些项目不派发团队;须写理由并落审计 |
|
|
16
|
+
|
|
17
|
+
## 禁止覆盖(硬拒)
|
|
18
|
+
|
|
19
|
+
- 八步的**顺序**;
|
|
20
|
+
- 四道门:人工校验 / 归因 / 授权 / 评审;
|
|
21
|
+
- `done` 只能由人置;
|
|
22
|
+
- 「回填必须带证据」。
|
|
23
|
+
|
|
24
|
+
## 项目自有规范怎么叠加
|
|
25
|
+
|
|
26
|
+
项目可以在 `<workspace>/AGENTS.md` 写**自己的约定**,加载顺序是:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
spec/norms/*.md(随包,唯一真源) → <workspace>/AGENTS.md(只能追加/参数化)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- 追加的条目**不得**与上面的禁止项冲突;冲突即 `NORM_CONFLICT`(开发期红,不是运行期出事)。
|
|
33
|
+
- 加载块里固定带 `norm_notice`:告诉人「当前用的哪份规范、什么版本、怎么查看/替换」。
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* acceptance.mjs —— 「验收标准缺省」的**唯一**口径入口(卡 `-176` / `-177`,2026-10-29)。
|
|
3
|
+
*
|
|
4
|
+
* 背景(口径 **X**,人拍板于 2026-10-29):`requirement_items.acceptance` **不做必填、不改 schema**。
|
|
5
|
+
* 实测 129 条里 **99 条 acceptance 为空**,而「空」与「当初没收集」不可辨 —— 强制必填会一刀切破
|
|
6
|
+
* 「改标题」这类无关操作;schema 迁移不可逆,审计 join 可查。故取**显式缺口标记**:
|
|
7
|
+
*
|
|
8
|
+
* · 回包 `acceptanceSet:false` —— 调用方一眼看出「这条没有验收口径」,而不是拿到一个看似成功的 201;
|
|
9
|
+
* · 缺省落一条 `governance_audit`(`action = requirement-acceptance-missing`)
|
|
10
|
+
* —— 「当初给没给验收」可事后按 `target = 条目编号` 查审计,不必加列。
|
|
11
|
+
*
|
|
12
|
+
* 纪律来源(产品内既有先例):`-172` 把「失败被包装成成功」改成显式
|
|
13
|
+
* (`AI_UNAVAILABLE` / `fallback:"rule"` / `dryRun`)—— 同一纪律套到 acceptance 上就是「显式缺口」。
|
|
14
|
+
*
|
|
15
|
+
* **HTTP 与 MCP 必须共用本文件**:两条写入口各写一份判断必然漂移 —— `-176` / `-177` 本来就是
|
|
16
|
+
* 「同一个缺口的两半」,各修各的就会长出两个口径。
|
|
17
|
+
*
|
|
18
|
+
* 落审计的**边界**(刻意如此,防审计洪水):只有**这次写入碰了 `acceptance`** 才落审计
|
|
19
|
+
* (新建条目 = 每次;改条目 = 仅当 patch 里带 `acceptance`)。`acceptanceSet` 则**永远**反映写入后的
|
|
20
|
+
* 真实状态 —— 于是一条 99/129 的空验收条目改标题时,回包照样会诚实告诉你 `acceptanceSet:false`,
|
|
21
|
+
* 但不会给审计表再添一行。
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export const ACCEPTANCE_MISSING_ACTION = "requirement-acceptance-missing";
|
|
25
|
+
|
|
26
|
+
/** 「没给验收」的判定:`null` / `undefined` / 纯空白都算缺省(与 store 侧清空语义一致)。 */
|
|
27
|
+
export function isAcceptanceMissing(value) {
|
|
28
|
+
return value == null || String(value).trim() === "";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 给一次需求条目写入打「验收缺口」标记。
|
|
33
|
+
*
|
|
34
|
+
* @param {{recordAudit:Function}} store
|
|
35
|
+
* @param {{identifier?:string|null, acceptance?:any, actor?:string, entry?:string, detail?:object|null}} opts
|
|
36
|
+
* `entry` 必填语义上是「哪条写路径」(如 `mcp:requirement_upsert` / `http:POST /api/requirements/items`),
|
|
37
|
+
* 进 `governance_audit.reason`,便于按入口统计缺口。
|
|
38
|
+
* @returns {{acceptanceSet:boolean, auditId:string|null}}
|
|
39
|
+
*/
|
|
40
|
+
export function markAcceptance(store, { identifier = null, acceptance = null, actor = "human", entry = "unknown", detail = null } = {}) {
|
|
41
|
+
if (!isAcceptanceMissing(acceptance)) return { acceptanceSet: true, auditId: null };
|
|
42
|
+
let auditId = null;
|
|
43
|
+
try {
|
|
44
|
+
auditId = store.recordAudit({
|
|
45
|
+
actor,
|
|
46
|
+
action: ACCEPTANCE_MISSING_ACTION,
|
|
47
|
+
target: identifier,
|
|
48
|
+
allowed: true,
|
|
49
|
+
reason: entry,
|
|
50
|
+
detail: JSON.stringify({ entry, identifier, ...(detail && typeof detail === "object" ? detail : {}) }),
|
|
51
|
+
});
|
|
52
|
+
} catch { auditId = null; } // 审计是旁证不是阻断:写审计失败不得让业务写入失败(与 contract-warn 同口径)
|
|
53
|
+
return { acceptanceSet: false, auditId };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 只读版:给「这次写入没碰 acceptance」的路径算回包标记(**不落审计**)。
|
|
58
|
+
* @returns {{acceptanceSet:boolean, auditId:null}}
|
|
59
|
+
*/
|
|
60
|
+
export function acceptanceFlag(acceptance) {
|
|
61
|
+
return { acceptanceSet: !isAcceptanceMissing(acceptance), auditId: null };
|
|
62
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* contract.mjs —— 契约快照(P1 · 2026-10-29)
|
|
3
|
+
*
|
|
4
|
+
* 方案依据:`docs/设计/技能化与MCP契约-架构变更方案-2026-10-28.md`
|
|
5
|
+
* §6.4 契约版本与规范摘要校验 · §7.1 frontmatter 契约 · §8 数据模型 · §17.3.1 D4 最终裁定。
|
|
6
|
+
*
|
|
7
|
+
* 一句话:**把「规范读了就算」变成「用旧规范干活会显性失败」**。
|
|
8
|
+
*
|
|
9
|
+
* contract_version = f(需求文档 digest, 机器规范 digest×版本, 门配置)
|
|
10
|
+
*
|
|
11
|
+
* 三条设计约束(都是被踩出来的):
|
|
12
|
+
* ① **本模块不写库、不改状态** —— 纯计算 + 纯读文件,谁都能安全调(HTTP / MCP / CLI 同一份实现,
|
|
13
|
+
* 防「六个入口两种语义」);
|
|
14
|
+
* ② **机器规范唯一真源是 `spec/norms/*.md`**(随包分发);`docs/规范/*.md` 是给人读的开发文档,
|
|
15
|
+
* 永不入 git,**不作为任何运行时真源**(D4 用户二次拍板,不可改变);
|
|
16
|
+
* ③ **正文变了但 version 没 bump ⇒ 守卫报红**(`tests/norms-parity.test.mjs`)——
|
|
17
|
+
* 否则「悄悄改规范」就是下一个不可追的漂移源。
|
|
18
|
+
*/
|
|
19
|
+
import { createHash } from "node:crypto";
|
|
20
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
|
|
23
|
+
import { TbError } from "./errors.mjs";
|
|
24
|
+
|
|
25
|
+
/** 随包分发的五份机器规范(缺一份即 `NORM_NOT_FOUND`)。 */
|
|
26
|
+
export const NORM_IDS = Object.freeze(["flow", "card-update", "doc-editing", "acceptance", "project-defaults"]);
|
|
27
|
+
|
|
28
|
+
/** 参与 contract_version 的门配置项(顺序固定 ⇒ 可复现)。 */
|
|
29
|
+
export const GATE_NAMES = Object.freeze(["attribution", "authorization", "review", "humanReview"]);
|
|
30
|
+
|
|
31
|
+
export const CONTRACT_VERSION_PREFIX = "v1-";
|
|
32
|
+
|
|
33
|
+
export function sha256(text) {
|
|
34
|
+
return createHash("sha256").update(String(text ?? ""), "utf8").digest("hex");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 解析带 frontmatter 的规范正文。
|
|
39
|
+
*
|
|
40
|
+
* 只认最小 YAML 子集(`key: value` / `key: [a, b]` / 数字 / 引号串)——本仓规范就是这么写的,
|
|
41
|
+
* 引完整 YAML 解析器会把「机器规范的形状」变成第三方依赖的版本风险。
|
|
42
|
+
*
|
|
43
|
+
* @returns {{meta:{norm_id:string,version:number,updated:string,applies_to:string[]}, body:string, digest:string}}
|
|
44
|
+
*/
|
|
45
|
+
export function parseNormDoc(text, file = "<norm>") {
|
|
46
|
+
const raw = String(text ?? "").replace(/^\uFEFF/, "").replace(/\r\n/g, "\n");
|
|
47
|
+
if (!raw.startsWith("---\n")) throw new TbError("NORM_INVALID", `规范缺 frontmatter:${file}`, { file });
|
|
48
|
+
const end = raw.indexOf("\n---\n", 4);
|
|
49
|
+
if (end < 0) throw new TbError("NORM_INVALID", `规范 frontmatter 未闭合:${file}`, { file });
|
|
50
|
+
const head = raw.slice(4, end);
|
|
51
|
+
const body = raw.slice(end + 5);
|
|
52
|
+
const meta = {};
|
|
53
|
+
for (const line of head.split("\n")) {
|
|
54
|
+
if (line.trim() === "" || line.trim().startsWith("#")) continue;
|
|
55
|
+
const idx = line.indexOf(":");
|
|
56
|
+
if (idx <= 0) throw new TbError("NORM_INVALID", `规范 frontmatter 行无法解析:${file} · ${line}`, { file });
|
|
57
|
+
const key = line.slice(0, idx).trim();
|
|
58
|
+
meta[key] = parseScalar(line.slice(idx + 1).trim());
|
|
59
|
+
}
|
|
60
|
+
const normId = String(meta.norm_id ?? "");
|
|
61
|
+
if (!NORM_IDS.includes(normId)) {
|
|
62
|
+
throw new TbError("NORM_INVALID", `规范 norm_id 非法:${file} · ${JSON.stringify(meta.norm_id)}`, { file, allowed: NORM_IDS });
|
|
63
|
+
}
|
|
64
|
+
if (!Number.isInteger(meta.version) || meta.version < 1) {
|
|
65
|
+
throw new TbError("NORM_INVALID", `规范 version 必须是 ≥1 的整数:${file}`, { file });
|
|
66
|
+
}
|
|
67
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(String(meta.updated ?? ""))) {
|
|
68
|
+
throw new TbError("NORM_INVALID", `规范 updated 必须是 YYYY-MM-DD:${file}`, { file });
|
|
69
|
+
}
|
|
70
|
+
const appliesTo = Array.isArray(meta.applies_to) ? meta.applies_to : [String(meta.applies_to ?? "")].filter(Boolean);
|
|
71
|
+
if (appliesTo.length === 0) throw new TbError("NORM_INVALID", `规范 applies_to 不能为空:${file}`, { file });
|
|
72
|
+
return { meta: { norm_id: normId, version: meta.version, updated: String(meta.updated), applies_to: appliesTo }, body, digest: sha256(body) };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function parseScalar(value) {
|
|
76
|
+
const v = String(value ?? "").trim();
|
|
77
|
+
if (v.startsWith("[") && v.endsWith("]")) {
|
|
78
|
+
return v.slice(1, -1).split(",").map((s) => s.trim()).filter(Boolean).map(stripQuotes);
|
|
79
|
+
}
|
|
80
|
+
if (/^-?\d+$/.test(v)) return Number(v);
|
|
81
|
+
if (v === "true") return true;
|
|
82
|
+
if (v === "false") return false;
|
|
83
|
+
return stripQuotes(v);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function stripQuotes(s) {
|
|
87
|
+
const v = String(s).trim();
|
|
88
|
+
if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) return v.slice(1, -1);
|
|
89
|
+
return v;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 读一个规范目录(`spec/norms/*.md`)。
|
|
94
|
+
*
|
|
95
|
+
* @param {string} dir
|
|
96
|
+
* @param {{requireAll?: boolean}} [opts] `requireAll`(默认 true)=五份必须齐;单测造夹具时可关。
|
|
97
|
+
*/
|
|
98
|
+
export function loadNorms(dir, { requireAll = true } = {}) {
|
|
99
|
+
if (!dir || !existsSync(dir)) throw new TbError("NORM_NOT_FOUND", `机器规范目录不存在:${dir}`, { dir });
|
|
100
|
+
const files = readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
101
|
+
const norms = [];
|
|
102
|
+
const seen = new Map();
|
|
103
|
+
for (const file of files) {
|
|
104
|
+
const abs = path.join(dir, file);
|
|
105
|
+
const parsed = parseNormDoc(readFileSync(abs, "utf8"), abs);
|
|
106
|
+
const prev = seen.get(parsed.meta.norm_id);
|
|
107
|
+
if (prev) throw new TbError("NORM_INVALID", `norm_id 重复:${parsed.meta.norm_id}(${prev} / ${abs})`, { normId: parsed.meta.norm_id });
|
|
108
|
+
seen.set(parsed.meta.norm_id, abs);
|
|
109
|
+
norms.push({ id: parsed.meta.norm_id, version: parsed.meta.version, updated: parsed.meta.updated, appliesTo: parsed.meta.applies_to, digest: parsed.digest, file: abs, relPath: `spec/norms/${file}`, body: parsed.body });
|
|
110
|
+
}
|
|
111
|
+
if (requireAll) {
|
|
112
|
+
const missing = NORM_IDS.filter((id) => !seen.has(id));
|
|
113
|
+
if (missing.length) throw new TbError("NORM_NOT_FOUND", `机器规范缺文件:${missing.join(" / ")}`, { dir, missing });
|
|
114
|
+
}
|
|
115
|
+
return norms;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** 门配置归一化(缺项取默认值;未知键忽略,避免把 UI 状态算进版本)。 */
|
|
119
|
+
export function normalizeGates(gates = {}) {
|
|
120
|
+
const out = {};
|
|
121
|
+
for (const name of GATE_NAMES) out[name] = String(gates?.[name] ?? "n/a");
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 计算契约快照(纯函数,可无限重算)。
|
|
127
|
+
*
|
|
128
|
+
* @param {{requirementsText?: string, norms: Array<{id,version,digest,relPath?}>, gates?: object, docVersion?: number|null}} input
|
|
129
|
+
* @returns {{contractVersion:string, docDigest:string, docVersion:number|null, norms:Array, gates:object, material:string}}
|
|
130
|
+
*/
|
|
131
|
+
export function computeContract({ requirementsText = "", norms = [], gates = {}, docVersion = null } = {}) {
|
|
132
|
+
const docDigest = sha256(requirementsText);
|
|
133
|
+
const normRows = [...norms]
|
|
134
|
+
.map((n) => ({ id: n.id, version: n.version, digest: n.digest, file: n.relPath ?? n.file ?? null }))
|
|
135
|
+
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
136
|
+
const gateRows = normalizeGates(gates);
|
|
137
|
+
const material = JSON.stringify({ doc: docDigest, norms: normRows.map((n) => [n.id, n.version, n.digest]), gates: GATE_NAMES.map((g) => [g, gateRows[g]]) });
|
|
138
|
+
return {
|
|
139
|
+
contractVersion: `${CONTRACT_VERSION_PREFIX}${sha256(material).slice(0, 12)}`,
|
|
140
|
+
docDigest,
|
|
141
|
+
docVersion,
|
|
142
|
+
norms: normRows,
|
|
143
|
+
gates: gateRows,
|
|
144
|
+
material,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 两次快照之间「到底哪份文件变了」——`CONTRACT_STALE` 必须能报出来(D5 硬要求 ②)。
|
|
150
|
+
*
|
|
151
|
+
* @returns {{versionChanged:boolean, docChanged:boolean, normChanges:Array<{norm,from,to,file}>, gateChanges:Array<{gate,from,to}>, changedFiles:string[]}}
|
|
152
|
+
*/
|
|
153
|
+
export function diffContract(prev, next) {
|
|
154
|
+
const before = new Map((prev?.norms ?? []).map((n) => [n.id, n]));
|
|
155
|
+
const normChanges = [];
|
|
156
|
+
for (const n of next?.norms ?? []) {
|
|
157
|
+
const old = before.get(n.id);
|
|
158
|
+
if (!old) {
|
|
159
|
+
normChanges.push({ norm: n.id, from: null, to: n.version, file: n.file });
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (old.version !== n.version || old.digest !== n.digest) {
|
|
163
|
+
normChanges.push({ norm: n.id, from: old.version, to: n.version, file: n.file ?? old.file ?? null });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const gateChanges = [];
|
|
167
|
+
for (const g of GATE_NAMES) {
|
|
168
|
+
const from = prev?.gates?.[g] ?? null;
|
|
169
|
+
const to = next?.gates?.[g] ?? null;
|
|
170
|
+
if (from !== to) gateChanges.push({ gate: g, from, to });
|
|
171
|
+
}
|
|
172
|
+
const docChanged = Boolean(prev) && prev?.docDigest !== next?.docDigest;
|
|
173
|
+
const changedFiles = [
|
|
174
|
+
...(docChanged ? ["requirement-doc"] : []),
|
|
175
|
+
...normChanges.map((c) => c.file).filter(Boolean),
|
|
176
|
+
];
|
|
177
|
+
return {
|
|
178
|
+
versionChanged: Boolean(prev) && prev?.contractVersion !== next?.contractVersion,
|
|
179
|
+
docChanged,
|
|
180
|
+
normChanges,
|
|
181
|
+
gateChanges,
|
|
182
|
+
changedFiles,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* P1.5 · D2 `warn` 档的**纯判据**:把「调用方用的契约」与「当前契约」比一比。
|
|
188
|
+
*
|
|
189
|
+
* **不抛错、不写库** —— 阻断与否由调用方决定(warn 档:只记审计、照常写入)。
|
|
190
|
+
* 老客户端 / Web 不带 `contract` 字段 ⇒ `skipped`,零打扰(向后兼容)。
|
|
191
|
+
*
|
|
192
|
+
* @param {object} current `computeContract()` 的结果
|
|
193
|
+
* @param {{version?:string, contractVersion?:string, normDigest?:string, normDigests?:Record<string,string>}} submitted
|
|
194
|
+
* @returns {{verdict:"skipped"|"unknown"|"ok"|"warn", problems:Array<object>}}
|
|
195
|
+
*/
|
|
196
|
+
export function evaluateSubmittedContract(current, submitted) {
|
|
197
|
+
if (!submitted || typeof submitted !== "object") return { verdict: "skipped", problems: [] };
|
|
198
|
+
if (!current || typeof current.contractVersion !== "string") return { verdict: "unknown", problems: [] };
|
|
199
|
+
const problems = [];
|
|
200
|
+
const version = submitted.version ?? submitted.contractVersion ?? null;
|
|
201
|
+
if (version != null && String(version) !== "" && String(version) !== current.contractVersion) {
|
|
202
|
+
problems.push({ kind: "version", yours: String(version), current: current.contractVersion });
|
|
203
|
+
}
|
|
204
|
+
const norms = Array.isArray(current.norms) ? current.norms : [];
|
|
205
|
+
const single = submitted.normDigest ?? null;
|
|
206
|
+
if (single != null && String(single) !== "" && !norms.some((n) => n.digest === String(single))) {
|
|
207
|
+
problems.push({ kind: "norm_digest", norm: null, yours: String(single), current: null });
|
|
208
|
+
}
|
|
209
|
+
const map = submitted.normDigests && typeof submitted.normDigests === "object" ? submitted.normDigests : null;
|
|
210
|
+
if (map) {
|
|
211
|
+
for (const [id, digest] of Object.entries(map)) {
|
|
212
|
+
const hit = norms.find((n) => n.id === id);
|
|
213
|
+
if (!hit) problems.push({ kind: "norm_unknown", norm: id, yours: String(digest), current: null });
|
|
214
|
+
else if (hit.digest !== String(digest)) problems.push({ kind: "norm_digest", norm: id, yours: String(digest), current: hit.digest });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (problems.length > 0) return { verdict: "warn", problems };
|
|
218
|
+
const touched = version != null || single != null || map != null;
|
|
219
|
+
return { verdict: touched ? "ok" : "skipped", problems };
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** `409 CONTRACT_STALE` 的返回体(形状固定:agent 拿到就能自纠偏重试)。 */
|
|
223
|
+
export function staleError({ yours, current, changed }) {
|
|
224
|
+
const files = changed?.changedFiles ?? [];
|
|
225
|
+
return new TbError(
|
|
226
|
+
"CONTRACT_STALE",
|
|
227
|
+
`契约已更新:你用 ${yours ?? "(未提供)"},当前 ${current.contractVersion}${files.length ? `;变化来自 ${files.join(" / ")}` : ""}`,
|
|
228
|
+
{
|
|
229
|
+
your_version: yours ?? null,
|
|
230
|
+
current_version: current.contractVersion,
|
|
231
|
+
changed: changed ?? null,
|
|
232
|
+
digest: current.docDigest,
|
|
233
|
+
snapshot: current,
|
|
234
|
+
remedy: "用返回体里的 snapshot.contractVersion 重试(无需人确认)",
|
|
235
|
+
},
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* 比对「当前规范文件」与「已提交的 manifest」。
|
|
241
|
+
*
|
|
242
|
+
* 这是「**正文变了但 version 没 bump**」的唯一拦截点(§7.1):
|
|
243
|
+
* `digest 变了 && version 没变` ⇒ `NORM_VERSION_NOT_BUMPED`(守卫红),
|
|
244
|
+
* 否则「悄悄改规范」会让所有 agent 的 `norm_digest` 校验形同虚设。
|
|
245
|
+
*
|
|
246
|
+
* @param {Array} norms `loadNorms()` 的结果
|
|
247
|
+
* @param {{norms?: Array}} manifest `spec/norms/manifest.json` 的内容
|
|
248
|
+
*/
|
|
249
|
+
export function diffNormsManifest(norms, manifest) {
|
|
250
|
+
const listed = new Map(((manifest?.norms) ?? []).map((n) => [n.norm_id ?? n.id, n]));
|
|
251
|
+
const issues = [];
|
|
252
|
+
const current = new Map();
|
|
253
|
+
for (const n of norms) {
|
|
254
|
+
current.set(n.id, n);
|
|
255
|
+
const old = listed.get(n.id);
|
|
256
|
+
if (!old) {
|
|
257
|
+
issues.push({ code: "NORM_UNLISTED", norm: n.id, file: n.relPath, message: `manifest 里没有 ${n.id}(新规范?跑 build-norms 生成)` });
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (Number(n.version) < Number(old.version)) {
|
|
261
|
+
issues.push({ code: "NORM_DOWNGRADE", norm: n.id, file: n.relPath, from: old.version, to: n.version, message: `${n.id} 版本回退:${old.version} → ${n.version}` });
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (Number(n.version) === Number(old.version) && n.digest !== old.digest) {
|
|
265
|
+
issues.push({ code: "NORM_VERSION_NOT_BUMPED", norm: n.id, file: n.relPath, version: n.version, message: `${n.id} 正文变了但 version 仍是 ${n.version} —— 必须 bump 版本` });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
for (const [id, old] of listed) {
|
|
269
|
+
if (!current.has(id)) issues.push({ code: "NORM_MISSING", norm: id, file: old.file ?? null, message: `manifest 登记了 ${id},但目录里没有这份文件` });
|
|
270
|
+
}
|
|
271
|
+
const needsWrite = norms.some((n) => {
|
|
272
|
+
const old = listed.get(n.id);
|
|
273
|
+
return !old || Number(old.version) !== Number(n.version) || old.digest !== n.digest;
|
|
274
|
+
});
|
|
275
|
+
return { ok: issues.length === 0, issues, needsWrite };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** 生成 manifest(稳定顺序,不含时间戳 ⇒ 可幂等 `--check`)。 */
|
|
279
|
+
export function buildNormsManifest(norms) {
|
|
280
|
+
return {
|
|
281
|
+
schemaVersion: 1,
|
|
282
|
+
note: "由 node tools/build-norms.mjs 生成;正文变了必须 bump version(否则 tests/norms-parity.test.mjs 报红)",
|
|
283
|
+
norms: [...norms]
|
|
284
|
+
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
|
|
285
|
+
.map((n) => ({ norm_id: n.id, version: n.version, updated: n.updated, digest: n.digest, file: n.relPath })),
|
|
286
|
+
};
|
|
287
|
+
}
|
package/src/core/errors.mjs
CHANGED
|
@@ -28,6 +28,9 @@ export const ERROR_CATEGORY = Object.freeze({
|
|
|
28
28
|
UNKNOWN_OPTION: EXIT.USAGE,
|
|
29
29
|
// FR-03:删除项目必须先显式确认(缺确认 ⇒ 用法错误,避免误触删掉项目)
|
|
30
30
|
PROJECT_DELETE_UNCONFIRMED: EXIT.USAGE,
|
|
31
|
+
// FR-57(2026-10-29 修订 · A):资料引入**只建索引、不产生条目**。
|
|
32
|
+
// 旧 `mode:"items"/"both"` 显式拒绝(不静默降级成 doc-only)——「那条路不存在」要在契约层成立。
|
|
33
|
+
INTAKE_ITEMS_DISABLED: EXIT.USAGE,
|
|
31
34
|
|
|
32
35
|
// 存储不可用
|
|
33
36
|
STORE_UNAVAILABLE: EXIT.SERVICE,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 交付物证据的**规则层**(FR-106 / 卡 `-197` · 0-B)。
|
|
3
|
+
*
|
|
4
|
+
* 这一层只做「判」,不碰库:四字段齐不齐、`artifact_refs` 解不解得开。
|
|
5
|
+
* 为什么单独成模块:核验规则要被单测逐条钉住,也要能被将来的 Router / 看护复用,
|
|
6
|
+
* 塞进 store 里就只能靠"跑一遍看板"验证。
|
|
7
|
+
*/
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
|
|
12
|
+
export const EVIDENCE_FIELDS = Object.freeze(["verdict", "deviation", "boundary", "artifacts"]);
|
|
13
|
+
export const EVIDENCE_REF_KINDS = Object.freeze(["commit", "file"]);
|
|
14
|
+
|
|
15
|
+
const text = (v) => (typeof v === "string" ? v.trim() : "");
|
|
16
|
+
|
|
17
|
+
/** 四字段缺什么就报什么(**门在事务前**:调用方拿到非空数组就不许落库)。 */
|
|
18
|
+
export function evidenceProblems(input = {}) {
|
|
19
|
+
const problems = [];
|
|
20
|
+
for (const f of ["verdict", "deviation", "boundary"]) {
|
|
21
|
+
if (text(input[f]) === "") problems.push({ field: f, reason: "empty" });
|
|
22
|
+
}
|
|
23
|
+
const arts = Array.isArray(input.artifacts) ? input.artifacts.filter((a) => text(a) !== "") : [];
|
|
24
|
+
if (arts.length === 0) problems.push({ field: "artifacts", reason: "empty" });
|
|
25
|
+
return problems;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 统一形状:`[{kind, ref, note?}]`;非法 kind 直接丢弃(不猜)。 */
|
|
29
|
+
export function normalizeArtifactRefs(refs) {
|
|
30
|
+
if (!Array.isArray(refs)) return [];
|
|
31
|
+
const out = [];
|
|
32
|
+
for (const r of refs) {
|
|
33
|
+
const kind = text(r?.kind);
|
|
34
|
+
const ref = text(r?.ref);
|
|
35
|
+
if (!ref || !EVIDENCE_REF_KINDS.includes(kind)) continue;
|
|
36
|
+
const note = text(r?.note);
|
|
37
|
+
out.push(note ? { kind, ref, note } : { kind, ref });
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 核验 `artifact_refs`:任一解不开即整体 `unresolved`(不"部分通过")。
|
|
44
|
+
* `resolve({kind, ref})` 由调用方注入 —— 默认实现见 `makeResolver`。
|
|
45
|
+
*/
|
|
46
|
+
export function verifyArtifactRefs(refs = [], resolve) {
|
|
47
|
+
const list = normalizeArtifactRefs(refs);
|
|
48
|
+
if (list.length === 0) return { state: "unchecked", unresolved: [] };
|
|
49
|
+
if (typeof resolve !== "function") return { state: "unchecked", unresolved: [] };
|
|
50
|
+
const unresolved = [];
|
|
51
|
+
for (const r of list) {
|
|
52
|
+
let ok = false;
|
|
53
|
+
try { ok = resolve(r) === true; } catch { ok = false; }
|
|
54
|
+
if (!ok) unresolved.push(r);
|
|
55
|
+
}
|
|
56
|
+
return { state: unresolved.length ? "unresolved" : "resolved", unresolved };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `format_ok` 的**唯一**判据(0-A 的 `ticketStage()` 直接调用这里,别在别处再写一份):
|
|
61
|
+
* 四字段齐 **且** refs 不是 `unresolved`。
|
|
62
|
+
* `unchecked` 可以进 format_ok —— 没给 refs 就不假装校验过;"格式合格" ≠ "内容已判"(那是 ready 的事)。
|
|
63
|
+
*/
|
|
64
|
+
export function evidenceFormatOk(evidence) {
|
|
65
|
+
if (!evidence) return false;
|
|
66
|
+
if (evidenceProblems(evidence).length) return false;
|
|
67
|
+
return evidence.refsState !== "unresolved";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 默认解析器:`file` 走 `fs.existsSync`(相对仓库根),`commit` 走 `git cat-file -e <sha>^{commit}`。
|
|
72
|
+
* 刻意**不抛**:核验失败是数据问题,不是程序异常。
|
|
73
|
+
*/
|
|
74
|
+
export function makeResolver({ root, execFileSyncImpl = execFileSync, existsSyncImpl = fs.existsSync } = {}) {
|
|
75
|
+
const base = root ?? process.cwd();
|
|
76
|
+
return (r) => {
|
|
77
|
+
if (r.kind === "file") return existsSyncImpl(path.resolve(base, r.ref));
|
|
78
|
+
if (r.kind === "commit") {
|
|
79
|
+
try {
|
|
80
|
+
execFileSyncImpl("git", ["-C", base, "cat-file", "-e", `${r.ref}^{commit}`], { stdio: "ignore" });
|
|
81
|
+
return true;
|
|
82
|
+
} catch { return false; }
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
};
|
|
86
|
+
}
|
package/src/core/intake.mjs
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* **没有被引入**,导致"需求文档为空、团队/需求像摆设"。本模块把项目文件夹扫一遍,
|
|
6
6
|
* 汇总成"资料索引"写入需求文档,并可按文档生成需求条目(可判定的初始资料引入)。
|
|
7
7
|
*/
|
|
8
|
-
import { readdir, readFile, stat } from "node:fs/promises";
|
|
9
|
-
import { join, relative, extname, basename } from "node:path";
|
|
8
|
+
import { readdir, readFile, stat, realpath, readlink } from "node:fs/promises";
|
|
9
|
+
import { join, relative, extname, basename, sep } from "node:path";
|
|
10
10
|
|
|
11
11
|
/** 默认可引入的文档后缀(文本类可读,二进制类只登记)。 */
|
|
12
12
|
export const DEFAULT_DOC_EXTS = [".md", ".markdown", ".txt", ".rst", ".doc", ".docx", ".pdf"];
|
|
@@ -16,7 +16,15 @@ const SKIP_DIRS = new Set(["node_modules", ".git", ".data", ".archify", ".cache"
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* 递归扫描项目文件夹中的文档。
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* **符号链接(2026-10-29 · 卡 `-175`)**:此前的判据是 `entry.isFile()` / `entry.isDirectory()`,
|
|
21
|
+
* 而 `Dirent.isFile()` 对**符号链接恒为 false** ⇒ 软链文档被**静默跳过**(无告警、无计数)。
|
|
22
|
+
* 本仓 `docs/团队agent.md → ../spec/团队agent.md` 因此一直没进索引(`docsTotal` 少 1)。
|
|
23
|
+
* 现在按软链处理:`stat` 跟随判类型 → 环路保护(`realpath` 去重)→ 越界判定(`realpath` 必须仍在 root 内),
|
|
24
|
+
* 跳过的每一条都进 `symlinks.skipped`(带 reason),**不再静默**。
|
|
25
|
+
*
|
|
26
|
+
* @returns {{ root:string, files:Array, count:number, truncated:boolean,
|
|
27
|
+
* symlinks:{ followed:number, skipped:Array<{relPath:string,target:string|null,reason:string}> } }}
|
|
20
28
|
*/
|
|
21
29
|
export async function scanProjectMaterials(rootDir, { maxFiles = 500, maxDepth = 8, exts = DEFAULT_DOC_EXTS, include = null, exclude = null } = {}) {
|
|
22
30
|
const allowed = new Set(exts.map((e) => e.toLowerCase()));
|
|
@@ -26,34 +34,89 @@ export async function scanProjectMaterials(rootDir, { maxFiles = 500, maxDepth =
|
|
|
26
34
|
const under = (rel, prefixes) => prefixes.some((p) => rel === p || rel.startsWith(`${p}/`));
|
|
27
35
|
const files = [];
|
|
28
36
|
let truncated = false;
|
|
37
|
+
const symlinks = { followed: 0, skipped: [] };
|
|
38
|
+
let rootReal = rootDir;
|
|
39
|
+
try { rootReal = await realpath(rootDir); } catch { /* root 不可解析时退回字面路径 */ }
|
|
40
|
+
const insideRoot = (real) => real === rootReal || real.startsWith(rootReal + sep);
|
|
41
|
+
/**
|
|
42
|
+
* 环路保护用**祖先链**,不用全局 seen 集合。
|
|
43
|
+
* 全局去重会让「同一真目录被两条路径引用」时后者凭空消失(example:`alias/ → real/sub`,两个 relPath 只留一个),
|
|
44
|
+
* 那不是防环,那是悄悄丢文件。祖先链只挡「指回自己祖先/自身」,两个别名各走各的。
|
|
45
|
+
*/
|
|
46
|
+
const chain = [];
|
|
47
|
+
const skipLink = (relPath, target, reason) => symlinks.skipped.push({ relPath, target, reason });
|
|
29
48
|
async function walk(dir, depth) {
|
|
30
49
|
if (files.length >= maxFiles) { truncated = true; return; }
|
|
31
50
|
if (depth > maxDepth) return;
|
|
32
|
-
let
|
|
33
|
-
try {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
let dirReal = dir;
|
|
52
|
+
try { dirReal = await realpath(dir); } catch { /* 保持字面路径 */ }
|
|
53
|
+
if (chain.includes(dirReal)) {
|
|
54
|
+
// 指回祖先(软链最常见的自环形态):记账后返回,不递归
|
|
55
|
+
if (depth > 0) skipLink(relative(rootDir, dir) || ".", dirReal, "loop");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
chain.push(dirReal);
|
|
59
|
+
// push/pop 必须由 walk 自己配对(try/finally)。此前由调用方 `chain.pop()`:
|
|
60
|
+
// 一旦被调方在 push 之前早退(maxDepth / maxFiles / 指回祖先),调用方就会把**自家**条目弹掉,
|
|
61
|
+
// 祖先链随之损坏 ⇒ 后面的兄弟软链不再被识别为环,同一批文件被重复收进索引。测试 ⑦ 是这条的反证。
|
|
62
|
+
try {
|
|
63
|
+
let entries;
|
|
64
|
+
try { entries = await readdir(dir, { withFileTypes: true }); } catch { return; }
|
|
65
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
if (files.length >= maxFiles) { truncated = true; return; }
|
|
68
|
+
if (entry.name.startsWith(".")) continue; // 跳过隐藏文件/目录
|
|
69
|
+
const absPath = join(dir, entry.name);
|
|
70
|
+
const relPath = relative(rootDir, absPath);
|
|
71
|
+
if (entry.isSymbolicLink()) {
|
|
72
|
+
let info;
|
|
73
|
+
try { info = await stat(absPath); } catch {
|
|
74
|
+
let target = null;
|
|
75
|
+
try { target = await readlink(absPath); } catch { /* 读不到目标 */ }
|
|
76
|
+
skipLink(relPath, target, "broken");
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
let real;
|
|
80
|
+
try { real = await realpath(absPath); } catch { skipLink(relPath, null, "unreadable"); continue; }
|
|
81
|
+
if (!insideRoot(real)) { skipLink(relPath, real, "outside-root"); continue; }
|
|
82
|
+
if (info.isDirectory()) {
|
|
83
|
+
if (SKIP_DIRS.has(entry.name)) { skipLink(relPath, real, "skip-dir"); continue; }
|
|
84
|
+
if (under(relPath, exc)) { skipLink(relPath, real, "excluded"); continue; }
|
|
85
|
+
symlinks.followed += 1;
|
|
86
|
+
await walk(absPath, depth + 1);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (!info.isFile()) { skipLink(relPath, real, "not-a-file"); continue; }
|
|
90
|
+
const ext = extname(entry.name).toLowerCase();
|
|
91
|
+
if (!allowed.has(ext)) { skipLink(relPath, real, "ext-not-allowed"); continue; }
|
|
92
|
+
if (inc && !under(relPath, inc)) { skipLink(relPath, real, "not-included"); continue; }
|
|
93
|
+
if (under(relPath, exc)) { skipLink(relPath, real, "excluded"); continue; }
|
|
94
|
+
let bytes = 0;
|
|
95
|
+
try { bytes = (await stat(absPath)).size; } catch { /* ignore */ }
|
|
96
|
+
files.push({ absPath, relPath, ext, name: entry.name, bytes, readable: TEXT_EXTS.has(ext), symlink: true });
|
|
97
|
+
symlinks.followed += 1;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (entry.isDirectory()) {
|
|
101
|
+
if (SKIP_DIRS.has(entry.name)) continue;
|
|
102
|
+
if (under(relPath, exc)) continue;
|
|
103
|
+
await walk(absPath, depth + 1);
|
|
104
|
+
} else if (entry.isFile()) {
|
|
105
|
+
const ext = extname(entry.name).toLowerCase();
|
|
106
|
+
if (!allowed.has(ext)) continue;
|
|
107
|
+
if (inc && !under(relPath, inc)) continue;
|
|
108
|
+
if (under(relPath, exc)) continue;
|
|
109
|
+
let bytes = 0;
|
|
110
|
+
try { bytes = (await stat(absPath)).size; } catch { /* ignore */ }
|
|
111
|
+
files.push({ absPath, relPath, ext, name: entry.name, bytes, readable: TEXT_EXTS.has(ext) });
|
|
112
|
+
}
|
|
52
113
|
}
|
|
114
|
+
} finally {
|
|
115
|
+
chain.pop();
|
|
53
116
|
}
|
|
54
117
|
}
|
|
55
118
|
await walk(rootDir, 0);
|
|
56
|
-
return { root: rootDir, files, count: files.length, truncated };
|
|
119
|
+
return { root: rootDir, files, count: files.length, truncated, symlinks };
|
|
57
120
|
}
|
|
58
121
|
|
|
59
122
|
/**
|