agentic-flow-kit 1.3.0 → 1.5.0
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 +10 -4
- package/modules/hosts/claude/agents/implementer.md +5 -6
- package/modules/hosts/claude/agents/independent-reviewer.md +6 -6
- package/modules/hosts/claude/agents/ui-verifier.md +5 -5
- package/modules/hosts/claude/commands/wf-build.md +21 -21
- package/modules/hosts/claude/commands/wf-deploy.md +2 -2
- package/modules/hosts/claude/commands/wf-design.md +8 -8
- package/modules/hosts/claude/commands/wf-gate-checklist.md +8 -8
- package/modules/hosts/claude/commands/wf-maintain.md +12 -12
- package/modules/hosts/claude/commands/wf-new-task.md +9 -9
- package/modules/hosts/claude/commands/wf-pipeline-run.md +3 -3
- package/modules/hosts/claude/commands/wf-plan.md +10 -11
- package/modules/hosts/claude/commands/wf-review.md +4 -4
- package/modules/hosts/claude/commands/wf-source-sync-check.md +10 -10
- package/modules/hosts/claude/commands/wf-sync-hosts.md +9 -9
- package/modules/hosts/claude/commands/wf-test.md +6 -7
- package/modules/hosts/codex/agents/implementer.md +5 -6
- package/modules/hosts/codex/agents/independent-reviewer.md +6 -6
- package/modules/hosts/codex/agents/ui-verifier.md +5 -5
- package/modules/hosts/codex/commands/wf-build.md +21 -21
- package/modules/hosts/codex/commands/wf-deploy.md +2 -2
- package/modules/hosts/codex/commands/wf-design.md +8 -8
- package/modules/hosts/codex/commands/wf-gate-checklist.md +8 -8
- package/modules/hosts/codex/commands/wf-maintain.md +12 -12
- package/modules/hosts/codex/commands/wf-new-task.md +9 -9
- package/modules/hosts/codex/commands/wf-pipeline-run.md +3 -3
- package/modules/hosts/codex/commands/wf-plan.md +10 -11
- package/modules/hosts/codex/commands/wf-review.md +4 -4
- package/modules/hosts/codex/commands/wf-source-sync-check.md +10 -10
- package/modules/hosts/codex/commands/wf-sync-hosts.md +9 -9
- package/modules/hosts/codex/commands/wf-test.md +6 -7
- package/modules/hosts/cursor/agents/implementer.md +5 -6
- package/modules/hosts/cursor/agents/independent-reviewer.md +6 -6
- package/modules/hosts/cursor/agents/ui-verifier.md +5 -5
- package/modules/hosts/cursor/commands/wf-build.md +21 -21
- package/modules/hosts/cursor/commands/wf-deploy.md +2 -2
- package/modules/hosts/cursor/commands/wf-design.md +8 -8
- package/modules/hosts/cursor/commands/wf-gate-checklist.md +8 -8
- package/modules/hosts/cursor/commands/wf-maintain.md +12 -12
- package/modules/hosts/cursor/commands/wf-new-task.md +9 -9
- package/modules/hosts/cursor/commands/wf-pipeline-run.md +3 -3
- package/modules/hosts/cursor/commands/wf-plan.md +10 -11
- package/modules/hosts/cursor/commands/wf-review.md +4 -4
- package/modules/hosts/cursor/commands/wf-source-sync-check.md +10 -10
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +9 -9
- package/modules/hosts/cursor/commands/wf-test.md +6 -7
- package/modules/hosts/omp/agents/implementer.md +5 -6
- package/modules/hosts/omp/agents/independent-reviewer.md +6 -6
- package/modules/hosts/omp/agents/ui-verifier.md +5 -5
- package/modules/hosts/opencode/agents/implementer.md +5 -6
- package/modules/hosts/opencode/agents/independent-reviewer.md +6 -6
- package/modules/hosts/opencode/agents/ui-verifier.md +5 -5
- package/modules/hosts/opencode/commands/wf-build.md +21 -21
- package/modules/hosts/opencode/commands/wf-deploy.md +2 -2
- package/modules/hosts/opencode/commands/wf-design.md +8 -8
- package/modules/hosts/opencode/commands/wf-gate-checklist.md +8 -8
- package/modules/hosts/opencode/commands/wf-maintain.md +12 -12
- package/modules/hosts/opencode/commands/wf-new-task.md +9 -9
- package/modules/hosts/opencode/commands/wf-pipeline-run.md +3 -3
- package/modules/hosts/opencode/commands/wf-plan.md +10 -11
- package/modules/hosts/opencode/commands/wf-review.md +4 -4
- package/modules/hosts/opencode/commands/wf-source-sync-check.md +10 -10
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +9 -9
- package/modules/hosts/opencode/commands/wf-test.md +6 -7
- package/modules/hosts/trae/agents/implementer.md +5 -6
- package/modules/hosts/trae/agents/independent-reviewer.md +6 -6
- package/modules/hosts/trae/agents/ui-verifier.md +5 -5
- package/modules/hosts/trae/commands/wf-build.md +21 -21
- package/modules/hosts/trae/commands/wf-deploy.md +2 -2
- package/modules/hosts/trae/commands/wf-design.md +8 -8
- package/modules/hosts/trae/commands/wf-gate-checklist.md +8 -8
- package/modules/hosts/trae/commands/wf-maintain.md +12 -12
- package/modules/hosts/trae/commands/wf-new-task.md +9 -9
- package/modules/hosts/trae/commands/wf-pipeline-run.md +3 -3
- package/modules/hosts/trae/commands/wf-plan.md +10 -11
- package/modules/hosts/trae/commands/wf-review.md +4 -4
- package/modules/hosts/trae/commands/wf-source-sync-check.md +10 -10
- package/modules/hosts/trae/commands/wf-sync-hosts.md +9 -9
- package/modules/hosts/trae/commands/wf-test.md +6 -7
- package/modules/hosts/zcode/agents/implementer.md +5 -6
- package/modules/hosts/zcode/agents/independent-reviewer.md +6 -6
- package/modules/hosts/zcode/agents/ui-verifier.md +5 -5
- package/package.json +7 -2
- package/src/doctor.mjs +1 -1
- package/src/init.test.mjs +1 -1
- package/src/run-tests.mjs +15 -1
- package/src/sync-hosts.test.mjs +4 -4
- package/src/sync.test.mjs +1 -1
- package/templates/_agents/commands/build.md +21 -21
- package/templates/_agents/commands/deploy.md +2 -2
- package/templates/_agents/commands/design.md +8 -8
- package/templates/_agents/commands/gate-checklist.md +8 -8
- package/templates/_agents/commands/maintain.md +12 -12
- package/templates/_agents/commands/new-task.md +9 -9
- package/templates/_agents/commands/pipeline-run.md +3 -3
- package/templates/_agents/commands/plan.md +10 -11
- package/templates/_agents/commands/review.md +4 -4
- package/templates/_agents/commands/source-sync-check.md +10 -10
- package/templates/_agents/commands/sync-hosts.md +9 -9
- package/templates/_agents/commands/test.md +6 -7
- package/templates/_agents/roles/implementer.md +5 -6
- package/templates/_agents/roles/independent-reviewer.md +6 -6
- package/templates/_agents/roles/ui-verifier.md +5 -5
- package/templates/_agents/scripts/agg-delegations.cjs +41 -13
- package/templates/_agents/scripts/agg-delegations.test.mjs +78 -3
- package/templates/_agents/scripts/agg-gate-stats.mjs +113 -0
- package/templates/_agents/scripts/agg-gate-stats.test.mjs +95 -0
- package/templates/_agents/scripts/check-hygiene.mjs +167 -0
- package/templates/_agents/scripts/check-hygiene.test.mjs +182 -0
- package/templates/_agents/scripts/check-ledger-invariant.mjs +0 -1
- package/templates/_agents/scripts/check-loop.mjs +112 -117
- package/templates/_agents/scripts/check-loop.test.mjs +115 -1
- package/templates/_agents/scripts/commit-check-trigger.test.mjs +0 -1
- package/templates/_agents/scripts/confirm-doc.mjs +27 -7
- package/templates/_agents/scripts/confirm-doc.test.mjs +35 -0
- package/templates/_agents/scripts/ensure-board.mjs +2 -2
- package/templates/_agents/scripts/fill-intent.mjs +2 -2
- package/templates/_agents/scripts/fill-plan.mjs +1 -2
- package/templates/_agents/scripts/gate-seg.mjs +54 -0
- package/templates/_agents/scripts/gate-seg.test.mjs +112 -0
- package/templates/_agents/scripts/gen-wiki-board.mjs +1 -1
- package/templates/_agents/scripts/gen-workflow-dashboard.mjs +76 -9
- package/templates/_agents/scripts/gen-workflow-dashboard.test.mjs +64 -3
- package/templates/_agents/scripts/gen-workflow-index.test.mjs +1 -1
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +1 -1
- package/templates/_agents/scripts/kb-search.mjs +1 -2
- package/templates/_agents/scripts/kb-search.test.mjs +1 -1
- package/templates/_agents/scripts/pipeline-run-docs.mjs +76 -0
- package/templates/_agents/scripts/pipeline-run-run.mjs +63 -0
- package/templates/_agents/scripts/pipeline-run.mjs +8 -128
- package/templates/_agents/scripts/policy.mjs +37 -3
- package/templates/_agents/scripts/source-sync-check.mjs +2 -2
- package/templates/_agents/scripts/source-sync-check.test.mjs +1 -1
- package/templates/_agents/scripts/verify-wiki-consistency.mjs +0 -1
- package/templates/_agents/scripts/verify.mjs +27 -2
- package/templates/_agents/scripts/verify.test.mjs +53 -0
- package/templates/_agents/scripts/workflow-board-server.test.mjs +0 -1
- package/templates/_agents/scripts/workflow-enums.test.mjs +0 -1
- package/templates/_agents/scripts-test-exempt.txt +4 -1
|
@@ -22,7 +22,7 @@ next: .agents/commands/build.md(仅 P0 / P1 未清时;清零后经用户确
|
|
|
22
22
|
> 参考 Anthropic REVIEW.md 做法。宗旨是**用户决策 + AI 协作**:AI 跑机器门禁、自查、出分级清单与建议;用户确认问题定性与合入。把"该机器兜底"与"靠 AI 自查"分开列明,避免注意力耗在机械逐行上。
|
|
23
23
|
> 本文件为通用骨架;项目专属红线 / 命名 / 组件约定的具体口径在项目适配区(目录级 `AGENTS.md` 与 `.agents/hooks/`)补充。
|
|
24
24
|
|
|
25
|
-
## P0 必拦(优先机器兜底,hook 覆盖不到的靠 AI 自查)
|
|
25
|
+
## 1. P0 必拦(优先机器兜底,hook 覆盖不到的靠 AI 自查)
|
|
26
26
|
|
|
27
27
|
- **架构红线**:分层依赖方向约束(如领域 / 应用层禁直接引用基础设施实现;豁免清单见目录级 `AGENTS.md` / 项目适配区)
|
|
28
28
|
- 机器兜底:项目自有架构门禁(如有,`.agents/hooks/`)
|
|
@@ -34,7 +34,7 @@ next: .agents/commands/build.md(仅 P0 / P1 未清时;清零后经用户确
|
|
|
34
34
|
- 机器兜底:项目验证测试覆盖(如有) + AI 自查
|
|
35
35
|
- **L2 / L3 改动无 spec**:拒收,先回 `workflow/specs/` 立 spec 确认通过
|
|
36
36
|
|
|
37
|
-
## P1 应拦(自查重点)
|
|
37
|
+
## 2. P1 应拦(自查重点)
|
|
38
38
|
|
|
39
39
|
- **DB 命名与迁移**:遵循项目表 / 字段 / 外键命名规范与 schema 变更流程(见目录级 `AGENTS.md`);不得擅自引入项目未采用的迁移机制
|
|
40
40
|
- **前端形态**:新增 / 编辑与大数据量选择等交互遵循项目组件约定(弹层 vs 跳页、选择器形态、表格与样式统一等)
|
|
@@ -47,14 +47,14 @@ next: .agents/commands/build.md(仅 P0 / P1 未清时;清零后经用户确
|
|
|
47
47
|
- **spec 承诺的断言落地**:spec §测试列出的用例 / 断言须真落到测试或验证脚本;「写进 spec」不等于「跑得起来」,且常驻断言禁写成随时间增长的行数常量
|
|
48
48
|
- **跨宿主薄适配正文漂移**:改 `templates/_agents/{commands,roles}/*.md` 后必须跑 `flow-kit sync-hosts --apply` 单向同步注册表内全部宿主薄适配(`modules/hosts/<h>/{agents,commands}/*.md`);装户视角由 `flow-kit doctor` §6.7 检查(包源环境 §6.7 skipped)
|
|
49
49
|
|
|
50
|
-
## P2 建议(提醒,不拦合入)
|
|
50
|
+
## 3. P2 建议(提醒,不拦合入)
|
|
51
51
|
|
|
52
52
|
- 样式统一性(深色 / 浅色主题、卡片样式)
|
|
53
53
|
- 注释完整性(复杂逻辑处补注释,AGENTS.md 已说的不重复)
|
|
54
54
|
- Conventional Commits 中文(feat / fix / docs / style / refactor / perf)
|
|
55
55
|
- 历史同类 incident 的复盘三件套是否补齐
|
|
56
56
|
|
|
57
|
-
## 审查分工(用户决策 + AI 协作)
|
|
57
|
+
## 4. 审查分工(用户决策 + AI 协作)
|
|
58
58
|
|
|
59
59
|
- **机器兜底**(pre-commit / pre-push / test 自动拦,无需人守):门禁清单与判据以 `.githooks/`、`.agents/hooks/`、`check-loop.sh` 头部注释为准;`项目测试命令` 跑自动化用例。
|
|
60
60
|
- **AI 复核**:机器门禁完成后优先委派 `independent-reviewer`,聚焦 P0 hook 未覆盖项 + 全部 P1(P2 视精力)——产出分级问题清单 + 修复建议。复核方法参考 `code-review` 技能(Standards×Spec 双轴);每条 finding 报告前过 `review-verification-protocol` 防误报门(锚定 file:line、给出证据、校准严重级,不确定就降级为提问)。
|
|
@@ -23,16 +23,16 @@ next: .agents/commands/build.md(漂移属 build 改包源未同步导致的,
|
|
|
23
23
|
> `templates/_agents/` 包源 vs `.agents/` 装副本——三类差异报告:缺失 / 孤儿 / 漂移。
|
|
24
24
|
> managed 文件由 `flow-kit sync` 跟踪;owned 文件由 `flow-kit doctor` §6.6 校验——本工具补"两者都没扫"的真空地带(结构级差异)。
|
|
25
25
|
|
|
26
|
-
## 何时跑
|
|
26
|
+
## 1. 何时跑
|
|
27
27
|
|
|
28
28
|
- 改 `templates/_agents/*` 包源后
|
|
29
29
|
- 怀疑装副本未跟包源更新
|
|
30
30
|
- 体检装副本完整性(清理前 / 发版前)
|
|
31
31
|
- 不跑:仅改装副本 `.agents/*`(B-b 决策「只报告」+ 不反向同步)
|
|
32
32
|
|
|
33
|
-
## 怎么跑
|
|
33
|
+
## 2. 怎么跑
|
|
34
34
|
|
|
35
|
-
### 默认 `--diff`(仅报告)
|
|
35
|
+
### 2.1 默认 `--diff`(仅报告)
|
|
36
36
|
|
|
37
37
|
```
|
|
38
38
|
node .agents/scripts/source-sync-check.mjs --diff
|
|
@@ -49,7 +49,7 @@ node .agents/scripts/source-sync-check.mjs --pkg-root <path> --target <path> #
|
|
|
49
49
|
- `templates/_agents/cache/`(运行时缓存,与 `flow-kit sync` 既有约定一致)
|
|
50
50
|
- `.agents/kit.json` / `.agents/settings.json`(init 渲染产物,不属双源)
|
|
51
51
|
|
|
52
|
-
### 输出示例
|
|
52
|
+
### 2.2 输出示例
|
|
53
53
|
|
|
54
54
|
```
|
|
55
55
|
▶ flow-kit source-sync-check --diff
|
|
@@ -64,7 +64,7 @@ node .agents/scripts/source-sync-check.mjs --pkg-root <path> --target <path> #
|
|
|
64
64
|
- scripts/ensure-board.mjs pkg=e66653b0… tgt=b6f3cc9b…
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
### 自验
|
|
67
|
+
### 2.3 自验
|
|
68
68
|
|
|
69
69
|
```
|
|
70
70
|
node .agents/scripts/source-sync-check.test.mjs # 11 场景全过
|
|
@@ -72,7 +72,7 @@ npm test # 含 source-sync-check 套
|
|
|
72
72
|
flow-kit doctor # 10/0/0
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
## 边界(不要做)
|
|
75
|
+
## 3. 边界(不要做)
|
|
76
76
|
|
|
77
77
|
- 不要自动化同步(B-b 决策「只报告不修复」——与 `gate-checklist` 同源)
|
|
78
78
|
- 不改 managed 台账跟踪逻辑(`sync.mjs` 不动)
|
|
@@ -80,7 +80,7 @@ flow-kit doctor # 10/0/0
|
|
|
80
80
|
- 不反向同步——装副本独自有文件(如 hooks/commit-check.config.json)可能是装户配置,不应被删
|
|
81
81
|
- 不检查注册表内宿主 `modules/hosts/` 薄适配漂移(那是 `flow-kit sync-hosts` 范围)
|
|
82
82
|
|
|
83
|
-
## 当前已识别的真实漂点(首次实测,2026-09-25)
|
|
83
|
+
## 4. 当前已识别的真实漂点(首次实测,2026-09-25)
|
|
84
84
|
|
|
85
85
|
- **缺失**:本工具写完后未同步装副本(预期内——随本次 commit 解决)
|
|
86
86
|
- **孤儿**:`.agents/hooks/commit-check.config.json`(装副本独有,疑似装户配置)
|
|
@@ -88,7 +88,7 @@ flow-kit doctor # 10/0/0
|
|
|
88
88
|
|
|
89
89
|
修复留后续 incident / intent 跟踪(不在本次范围)。
|
|
90
90
|
|
|
91
|
-
## 与既有工具的关系
|
|
91
|
+
## 5. 与既有工具的关系
|
|
92
92
|
|
|
93
93
|
| 工具 | 作用域 | 算法 |
|
|
94
94
|
|---|---|---|
|
|
@@ -98,8 +98,8 @@ flow-kit doctor # 10/0/0
|
|
|
98
98
|
|
|
99
99
|
三者互补,不重叠。
|
|
100
100
|
|
|
101
|
-
## 相关留痕
|
|
101
|
+
## 6. 相关留痕
|
|
102
102
|
|
|
103
103
|
- intent:`workflow/intents/2026-09-25-source-sync-check.md`
|
|
104
104
|
- plan:`workflow/plans/2026-09-25-source-sync-check.md`
|
|
105
|
-
- 父 incident:`workflow/incidents/2026-09-25-wf-runtime.md`(包源改了装副本未同步——本工具预防性体检)
|
|
105
|
+
- 父 incident:`workflow/incidents/2026-09-25-wf-runtime.md`(包源改了装副本未同步——本工具预防性体检)
|
|
@@ -25,16 +25,16 @@ next: .agents/commands/build.md(漂移属 build 改权威源未同步导致的
|
|
|
25
25
|
> 比 `templates/_agents` ↔ `modules/hosts/<宿主键>/`;含 `.agents` → 装户:比 `.agents` ↔ 项目根下 `<宿主点目录>/`),
|
|
26
26
|
> 目标根取 `--dir <目录>` > 当前目录。
|
|
27
27
|
|
|
28
|
-
## 何时跑
|
|
28
|
+
## 1. 何时跑
|
|
29
29
|
|
|
30
30
|
- 改 `templates/_agents/commands/*.md` 正文后(11 个 commands 文件)
|
|
31
31
|
- 改 `templates/_agents/roles/*.md` 正文后(3 个 roles 文件)
|
|
32
32
|
- 装户跑 `flow-kit doctor` 报"跨宿主薄适配正文漂移 N 对" WARN 时
|
|
33
33
|
- 不跑:仅改 frontmatter;改 trae 钩子/规则;改包源其他文件
|
|
34
34
|
|
|
35
|
-
## 怎么跑
|
|
35
|
+
## 2. 怎么跑
|
|
36
36
|
|
|
37
|
-
### 默认 `--diff`(仅报告)
|
|
37
|
+
### 2.1 默认 `--diff`(仅报告)
|
|
38
38
|
|
|
39
39
|
```
|
|
40
40
|
node bin/flow-kit.mjs sync-hosts --diff # 包源仓(在包源根跑)
|
|
@@ -48,7 +48,7 @@ flow-kit sync-hosts --diff # 装户仓(在装户根跑;或
|
|
|
48
48
|
- **⚠️ 权威源声明但薄适配缺失** — `add-host <h>` 接管后跑 `--apply` 才会装(apply 不自动创建)
|
|
49
49
|
- **⚠️ 孤儿薄适配(权威源无对应文件)** — 历史残留或宿主特化,apply 不删
|
|
50
50
|
|
|
51
|
-
### `--apply` 单向同步
|
|
51
|
+
### 2.2 `--apply` 单向同步
|
|
52
52
|
|
|
53
53
|
```
|
|
54
54
|
node bin/flow-kit.mjs sync-hosts --apply
|
|
@@ -56,7 +56,7 @@ node bin/flow-kit.mjs sync-hosts --apply
|
|
|
56
56
|
|
|
57
57
|
按权威源正文覆盖薄适配正文段;薄适配原 frontmatter 保留(trae name: wf-X、opencode 描述、zcode/omp 中文风格各自不动)。apply 不反向同步——薄适配手改了正文也会被覆盖(这是设计选择,避免漂移方向歧义)。
|
|
58
58
|
|
|
59
|
-
### 自验
|
|
59
|
+
### 2.3 自验
|
|
60
60
|
|
|
61
61
|
```
|
|
62
62
|
npm test # 含 sync-hosts.test.mjs 8 场景
|
|
@@ -64,7 +64,7 @@ node bin/flow-kit.mjs doctor # 装户跑 §7.x PASS;包源
|
|
|
64
64
|
sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已探测分流
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
## 边界(不要做)
|
|
67
|
+
## 3. 边界(不要做)
|
|
68
68
|
|
|
69
69
|
- 不要 `--apply` 反向同步(写权威源):权威源是真相,薄适配手改会被覆盖——这是设计,apply 前先看 `--diff`
|
|
70
70
|
- 不要删除孤儿薄适配:可能是宿主特化或历史残留,apply 不动
|
|
@@ -72,14 +72,14 @@ sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已
|
|
|
72
72
|
- 不要把「避免与权威版本漂移」明文加回去——这是旧契约的指针风格,已被 B-b 正文副本取代
|
|
73
73
|
- 装了新宿主后跑 `--apply`:新宿主目录空白,apply 不会自动创建薄适配(薄适配须经 `add-host <h>` 接管)
|
|
74
74
|
|
|
75
|
-
## 不在本次同步范围
|
|
75
|
+
## 4. 不在本次同步范围
|
|
76
76
|
|
|
77
77
|
- trae 钩子(`modules/hosts/trae/hooks/*.cjs`)— 独立演进的工程件
|
|
78
78
|
- trae 规则(`modules/hosts/trae/rules/*.md`)— 同上
|
|
79
79
|
- 包源 .agents/scripts/*.cjs(pre-commit 等钩子)— 同步由 `flow-kit sync` 走 managed 台账负责
|
|
80
80
|
|
|
81
|
-
## 相关留痕
|
|
81
|
+
## 5. 相关留痕
|
|
82
82
|
|
|
83
83
|
- intent:`workflow/intents/2026-09-25-cross-host-sync.md`
|
|
84
84
|
- plan:`workflow/plans/2026-09-25-cross-host-sync.md`(含 B-b 方案拍板)
|
|
85
|
-
- incident:`workflow/incidents/2026-09-25-wf-runtime.md`(双源纪律教训,规范 §7.x 包源环境跳过)
|
|
85
|
+
- incident:`workflow/incidents/2026-09-25-wf-runtime.md`(双源纪律教训,规范 §7.x 包源环境跳过)
|
|
@@ -65,20 +65,19 @@ node bin/flow-kit.mjs doctor # §6.5 delegations + §6.6 o
|
|
|
65
65
|
- 复核者读入口文档(intent / incident) + spec + plan + diff,判断变更意图与风险
|
|
66
66
|
- 复核意见交用户定性(采纳 / 驳回);采纳项回 `build.md` 修改
|
|
67
67
|
|
|
68
|
-
## 子代理调用约定
|
|
68
|
+
## 5. 子代理调用约定
|
|
69
69
|
|
|
70
70
|
- 静态门不委派;UI 实测委派 `ui-verifier`(静态门通过后)、独立复核委派 `independent-reviewer`,均要求读取对应 `.agents/roles/*.md`;宿主不支持时按 frontmatter `fallback`(reviewer 必须另开新会话,不得主智能体自查冒充)。
|
|
71
71
|
- 子智能体只返回证据与结论——失败项修复仍回 `build.md`,不得在 Test 阶段顺手改代码;修复后重跑本阶段,全过后用户确认再关单。
|
|
72
72
|
|
|
73
|
-
##
|
|
73
|
+
## 6. 确认后(关单)
|
|
74
74
|
|
|
75
|
-
- 输出测试报告(通过项 / 失败项)
|
|
76
|
-
- 失败项已修复并复测通过
|
|
75
|
+
- 输出测试报告(通过项 / 失败项);失败项已修复并复测通过。
|
|
77
76
|
- **关单**(日常闭环点,不依赖是否上 prod):
|
|
78
|
-
- 关单前一键过门:`node .agents/scripts/verify.mjs`(npm test + check-loop
|
|
79
|
-
- 新需求:逐条勾验入口 intent「验收标准」,每条补「证据:」(例如:粘贴 CI 运行结果、UI 截图路径、或具体的 commit SHA),intent
|
|
77
|
+
- 关单前一键过门:`node .agents/scripts/verify.mjs --doc workflow/intents/<本单>.md`(npm test + check-loop 固定编排,任一失败非零退出,非绿不关单);**`--doc` 把测试绿凭证绑到本单**——不带它落下的绿行不给任何单背书,confirm-doc 前置与检查 8 对账只认带本单 `--doc` 的绿行(仅 v6+ 生效);**装户仓**(根目录无 `package.json`,工程在子目录)默认 `npm test` 不可跑 → 脚本**显式跳过步骤 1 且不落测试绿凭证**(防假绿)并提示;此时按项目口径手工跑测试,或带 `--test-cmd "<项目测试命令>"` 指定(2026-10-07 papercut)
|
|
78
|
+
- 新需求:逐条勾验入口 intent「验收标准」,每条补「证据:」(例如:粘贴 CI 运行结果、UI 截图路径、或具体的 commit SHA),intent → done;同名 spec/Quick-Plan(若有)仍 approved → done。**注意:勾选但缺证据会被 check-loop 拦截(hard-block)**
|
|
80
79
|
- **approved 留痕提交**(2026-09-30 起):done 确认前确认**本次关单文档**的 approved 态已进 git 历史(越早越好——approved 后即应提交;若尚未,先补提交再 done;门为逐份校验,三件套均关单时逐份各自满足)——confirm-doc 的 done 前置门硬校验(历史未出现「状态: approved」→ 拒绝落账);done 后再提交 done 态与其余改动
|
|
81
|
-
|
|
80
|
+
- **确认落态**:唯一入口 `node .agents/scripts/confirm-doc.mjs <path>`(两形态 / 逐件+逐件原话 / done 内容绑定(关单编辑先于 done 确认、confirm-doc 是最后一次写入)/ 台账对质全口径见根 `AGENTS.md` §1.3 确认门)。
|
|
82
81
|
- 修复:防复发验证已落地,incident → closed(经确认门 confirm-doc:open→fixed / fixed→closed 两跳、无单跳;2026-09-28 起 check-loop 15 对账——关单编辑先于 closed 确认,口径同 done 内容绑定)
|
|
83
82
|
- **同族收尾**:入口置终态时,同名 plan 一并置 `done`(spec 见上条),不留 `approved` 孤儿(口径同看板「入口已 done,本 plan 未终态」告警)
|
|
84
83
|
- 主智能体自做的 L1+ 新需求在 `workflow/delegations.md`「自做任务结果表」记一行(修复类不重复记)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 公共角色契约(本文件):`.agents/roles/implementer.md`。宿主薄适配(各宿主目录下 `agents/implementer.md`)正文段同源本文件,frontmatter 各自保留宿主特化字段(check-loop 检查项 6 按本引用校验适配层不断线)。
|
|
4
4
|
|
|
5
|
-
## 职责
|
|
5
|
+
## 1. 职责
|
|
6
6
|
|
|
7
7
|
执行已经由主智能体和用户确认、范围明确的实现任务。适用范围仅限:
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- 编写或调整任务直接要求的测试
|
|
12
12
|
- 修复与任务直接相关的编译错误
|
|
13
13
|
|
|
14
|
-
## 必需输入
|
|
14
|
+
## 2. 必需输入
|
|
15
15
|
|
|
16
16
|
开始前必须获得:
|
|
17
17
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
任一输入缺失或相互冲突时,停止并向主智能体报告,不自行扩大范围。
|
|
24
24
|
|
|
25
|
-
## 行为边界
|
|
25
|
+
## 3. 行为边界
|
|
26
26
|
|
|
27
27
|
- 只修改明确授权的文件;若必须触及其他文件,先停止并说明原因。
|
|
28
28
|
- 仓库可能有其他智能体或用户同时工作;保留现有改动,不回退、不覆盖无关修改。
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
- 不执行提交、推送、发布、数据迁移或破坏性操作。
|
|
32
32
|
- 不顺手重构、格式化或清理与任务无关的代码。
|
|
33
33
|
|
|
34
|
-
## 验证
|
|
34
|
+
## 4. 验证
|
|
35
35
|
|
|
36
36
|
- 运行任务指定的最小相关检查。
|
|
37
37
|
- 检查失败时只修复由本次改动引起且仍在授权范围内的问题。
|
|
38
38
|
- 同一验证连续失败三次,或继续需要猜测需求时,停止并报告阻塞。
|
|
39
39
|
|
|
40
|
-
## 输出
|
|
40
|
+
## 5. 输出
|
|
41
41
|
|
|
42
42
|
返回给主智能体:
|
|
43
43
|
|
|
@@ -45,4 +45,3 @@
|
|
|
45
45
|
2. 每个文件的改动摘要
|
|
46
46
|
3. 已运行的验证及结果
|
|
47
47
|
4. 未解决的阻塞或剩余风险
|
|
48
|
-
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
> 公共角色契约(本文件):`.agents/roles/independent-reviewer.md`。宿主薄适配(各宿主目录下 `agents/independent-reviewer.md`)正文段同源本文件,frontmatter 各自保留宿主特化字段(check-loop 检查项 6 按本引用校验适配层不断线)。
|
|
4
4
|
|
|
5
|
-
## 职责
|
|
5
|
+
## 1. 职责
|
|
6
6
|
|
|
7
7
|
在独立上下文中对 spec、plan 或代码 diff 做只读复核,发现原作者可能遗漏的正确性、契约、架构、数据安全和回归风险。
|
|
8
8
|
|
|
9
|
-
## 必需输入
|
|
9
|
+
## 2. 必需输入
|
|
10
10
|
|
|
11
11
|
开始前必须获得:
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
输入不足以确定范围时,停止并向主智能体报告。
|
|
19
19
|
|
|
20
|
-
## 行为边界
|
|
20
|
+
## 3. 行为边界
|
|
21
21
|
|
|
22
22
|
- 只读,不修改任何仓库文件。
|
|
23
23
|
- 不替用户决定问题定性、方案取舍、合入或上线。
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
- 不把样式偏好、假设性风险或既有无关问题包装成缺陷。
|
|
27
27
|
- 无法验证的事项明确标为未验证,不声称已经通过。
|
|
28
28
|
|
|
29
|
-
## 复核重点
|
|
29
|
+
## 4. 复核重点
|
|
30
30
|
|
|
31
31
|
1. 实现是否满足入口文档和验收标准
|
|
32
32
|
2. 是否违反根 `AGENTS.md` 与改动域目录级 `AGENTS.md` 的架构、数据和所在域红线
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
4. 是否缺少能防止回归的验证
|
|
35
35
|
5. 是否存在数据丢失、安全、权限或发布风险
|
|
36
36
|
|
|
37
|
-
## 输出
|
|
37
|
+
## 5. 输出
|
|
38
38
|
|
|
39
39
|
按严重度输出问题清单:
|
|
40
40
|
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
- `P1`:功能错误、明确回归或违反项目硬约束
|
|
43
43
|
- `P2`:非阻断但有证据的维护性问题
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
每项必须包含:位置、问题、证据、建议。没有发现时明确输出"未发现阻断问题",并列出未验证范围。
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
> 公共角色契约(本文件):`.agents/roles/ui-verifier.md`。宿主薄适配(各宿主目录下 `agents/ui-verifier.md`)正文段同源本文件,frontmatter 各自保留宿主特化字段(check-loop 检查项 6 按本引用校验适配层不断线)。
|
|
4
4
|
|
|
5
|
-
## 职责
|
|
5
|
+
## 1. 职责
|
|
6
6
|
|
|
7
7
|
对已经实现的 UI 改动执行浏览器实测并收集可复核证据。只验证,不修复。
|
|
8
8
|
|
|
9
|
-
## 必需输入
|
|
9
|
+
## 2. 必需输入
|
|
10
10
|
|
|
11
11
|
开始前必须获得:
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
缺少可观察的预期结果时,停止并向主智能体报告。
|
|
19
19
|
|
|
20
|
-
## 执行
|
|
20
|
+
## 3. 执行
|
|
21
21
|
|
|
22
22
|
1. 读取项目根目录 `AGENTS.md`,以及改动域目录级 `AGENTS.md`(如有,前端改动域)。
|
|
23
23
|
2. 读取并遵循项目 UI 实测技能 `.agents/skills/verify-ui/SKILL.md`(如有)。
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
5. 收集控制台、网络请求、DOM 数据或截图等证据。
|
|
27
27
|
6. 结束时关闭本次启动的后台进程。
|
|
28
28
|
|
|
29
|
-
## 行为边界
|
|
29
|
+
## 4. 行为边界
|
|
30
30
|
|
|
31
31
|
- 不修改代码、配置、测试数据或工作流文档。
|
|
32
32
|
- 不自行修复发现的问题;将失败证据交还主智能体。
|
|
33
33
|
- 不使用生产环境或真实业务数据。
|
|
34
34
|
- 无法启动环境或完成关键路径时,报告阻塞,不把部分验证标记为通过。
|
|
35
35
|
|
|
36
|
-
## 输出
|
|
36
|
+
## 5. 输出
|
|
37
37
|
|
|
38
38
|
返回:
|
|
39
39
|
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
/* agg-delegations: 量化证据聚合
|
|
3
3
|
* 读 workflow/delegations.md 两张结果表(按表头签名识别:委派表含「被委派方」列、自做表=日期+任务一句话;不依赖 ## 节标题)+ 扫 workflow/incidents/ 按月计数,
|
|
4
4
|
* 输出各月指标(一次通过率 / 平均返工次数 / 主兜底占比)、并发扩容门判定、可粘贴的月度快照行。
|
|
5
|
-
* 结果取值:一次通过 | 返工×N | 主兜底 | 返工待修(未闭环,不计入率)。
|
|
5
|
+
* 结果取值:一次通过 | 返工×N | 返工×N(门禁噪声)| 主兜底 | 返工待修(未闭环,不计入率)。
|
|
6
|
+
* 门禁噪声档(2026-10-08 selfmeasure-and-modularize):剥离「返工由门禁面而非设计面触发」的形态——
|
|
7
|
+
* 扩容门第 3 项只对设计返工判 =0,门禁噪声返工单列观测。存量行零回填(旧四档解析逐条不变)。
|
|
8
|
+
* 取值定义与边界(何为门禁噪声 / 不得用于给设计返工贴标签)以 workflow/delegations.md 头部记法为准。
|
|
6
9
|
* 用法:node .agents/scripts/agg-delegations.cjs [--month=YYYY-MM](默认输出全部月份 + 全量累计)
|
|
7
10
|
* 门槛定义见 workflow/delegations.md §并发扩容门槛(doc 为权威,脚本向文档对齐——2026-09-27 board-kb-p1)。
|
|
8
11
|
*/
|
|
@@ -11,7 +14,6 @@ const fs = require('fs');
|
|
|
11
14
|
const path = require('path');
|
|
12
15
|
|
|
13
16
|
const ROOT = path.resolve(__dirname, '..', '..');
|
|
14
|
-
const LEDGER = path.join(ROOT, 'workflow', 'delegations.md');
|
|
15
17
|
const INCIDENTS = path.join(ROOT, 'workflow', 'incidents');
|
|
16
18
|
|
|
17
19
|
const argMonth = (process.argv.find((a) => a.startsWith('--month=')) || '').split('=')[1] || null;
|
|
@@ -29,14 +31,31 @@ function parseTableRows(sectionText) {
|
|
|
29
31
|
.filter((cols) => !/^\s*$/.test(cols[0]) && /^\d{4}-\d{2}-\d{2}$/.test(cols[0])); // 只留数据行(首列是日期;表头/分隔行随之滤除)
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
// parseResult:结果列解析。返回值统一为 { kind, rework, reworkNoise } 两个分量。
|
|
35
|
+
// 三个返工格式(2026-10-08 rework-attribution-split 补第三种):
|
|
36
|
+
// 返工×N → 纯设计返工 { kind:'rework', rework:N, reworkNoise:0 }
|
|
37
|
+
// 返工×N(门禁噪声) → 纯门禁面噪声 { kind:'rework-noise', rework:0, reworkNoise:N }
|
|
38
|
+
// 返工×N + 门禁噪声×M → 行内双值(混合) { kind:'rework-mixed', rework:N, reworkNoise:M }
|
|
39
|
+
// 动机:存量逐行审计(29 行含返工)证实前两种单值格式**无法表达混合归因**——一行只记一个返工
|
|
40
|
+
// 总数时,「1 次设计 + 1 次噪声」只能整行倒向某一侧。行内双值是作者写入时确定已知的归因事实,
|
|
41
|
+
// 不从返工点数量反推(batch-ledger-audit 结论:判据读写入时事实,不猜)。
|
|
42
|
+
// ⚠️ 顺序约束:新分支须排在两个单值分支之前(`$` 锚定使三者互斥,此处按语义就近声明)。
|
|
32
43
|
function parseResult(raw) {
|
|
33
44
|
const r = (raw || '').trim();
|
|
34
|
-
|
|
45
|
+
// 行内双值(混合归因):宽容空格(`返工×1+门禁噪声×1` 亦可解析)
|
|
46
|
+
const mx = r.match(/^返工×(\d+)\s*\+\s*门禁噪声×(\d+)$/);
|
|
47
|
+
if (mx) return { kind: 'rework-mixed', rework: parseInt(mx[1], 10), reworkNoise: parseInt(mx[2], 10) };
|
|
48
|
+
if (/^一次通过$/.test(r)) return { kind: 'pass', rework: 0, reworkNoise: 0 };
|
|
49
|
+
// 门禁噪声档(2026-10-08 selfmeasure-and-modularize):剥离「返工由门禁面(预算超限 / 双源漏刷 /
|
|
50
|
+
// 节名不一致 / 门禁自身误报)触发、而非设计面」的形态。动机:本仓 DASHBOARD 自报质量门连续两月红
|
|
51
|
+
// (一次通过率 55% / 61%,门槛 ≥90%),根因是两档混列——指标永远红且不指示该改什么。
|
|
52
|
+
const mn = r.match(/^返工×(\d+)(门禁噪声)$/);
|
|
53
|
+
if (mn) return { kind: 'rework-noise', rework: 0, reworkNoise: parseInt(mn[1], 10) };
|
|
35
54
|
const m = r.match(/^返工×(\d+)$/);
|
|
36
|
-
if (m) return { kind: 'rework', rework: parseInt(m[1], 10) };
|
|
37
|
-
if (/^主兜底$/.test(r)) return { kind: 'fallback', rework: 1 };
|
|
38
|
-
if (/^返工待修$/.test(r)) return { kind: 'pending', rework: 0 };
|
|
39
|
-
return { kind: 'unknown', rework: 0 };
|
|
55
|
+
if (m) return { kind: 'rework', rework: parseInt(m[1], 10), reworkNoise: 0 };
|
|
56
|
+
if (/^主兜底$/.test(r)) return { kind: 'fallback', rework: 1, reworkNoise: 0 };
|
|
57
|
+
if (/^返工待修$/.test(r)) return { kind: 'pending', rework: 0, reworkNoise: 0 };
|
|
58
|
+
return { kind: 'unknown', rework: 0, reworkNoise: 0 };
|
|
40
59
|
}
|
|
41
60
|
|
|
42
61
|
// splitTables:按表头签名识别两张结果表——节标题只服务人类阅读,表头才是数据边界
|
|
@@ -99,7 +118,7 @@ function countIncidents() {
|
|
|
99
118
|
}
|
|
100
119
|
|
|
101
120
|
// 门槛(2026-09-27 board-kb-p1 对齐 workflow/delegations.md §并发扩容门槛声明——doc 为权威):
|
|
102
|
-
// 月度口径项:一次完成率 ≥90% |
|
|
121
|
+
// 月度口径项:一次完成率 ≥90% | 月度**设计**返工次数 = 0(2026-10-08 起门禁噪声返工剥离单列)| 无主兜底信号(=0)(旧「平均返工≤0.3 / 兜底≤10%」为宽松分叉,退役)
|
|
103
122
|
// 样本护栏项(脚本侧统计可信度门槛,非口径分叉):月样本量 ≥20 | 委派样本 ≥5
|
|
104
123
|
// 连续性:扩容需「本月 + 上一自然月」连续两月月度口径全达标(delegations.md「连续两个月」)
|
|
105
124
|
const GATE = { minSample: 20, minPassRate: 0.9, minDelegated: 5 };
|
|
@@ -110,12 +129,17 @@ function metrics(rows) {
|
|
|
110
129
|
const valid = rows.filter((_, i) => kinds[i] !== 'pending' && kinds[i] !== 'unknown');
|
|
111
130
|
const pending = kinds.filter((k) => k === 'pending').length;
|
|
112
131
|
const unknown = kinds.filter((k) => k === 'unknown').length;
|
|
113
|
-
let pass = 0, reworkSum = 0, fallback = 0;
|
|
132
|
+
let pass = 0, reworkSum = 0, reworkNoiseSum = 0, fallback = 0;
|
|
114
133
|
for (const r of valid) {
|
|
115
134
|
const p = parseResult(r.result);
|
|
116
135
|
if (p.kind === 'pass') pass += 1;
|
|
117
136
|
if (p.kind === 'fallback') fallback += 1;
|
|
118
|
-
|
|
137
|
+
// 双列累计:设计返工与门禁噪声返工分列(2026-10-08 selfmeasure-and-modularize 引入分列,
|
|
138
|
+
// 2026-10-08 rework-attribution-split 加行内混合档)。
|
|
139
|
+
// 显式列 kind 而非 `reworkSum += p.rework`——否则后续新增 kind 会被静默并入设计返工,
|
|
140
|
+
// 且混合档的两个分量必须各走各的累加器(只加 rework 会漏掉噪声)。
|
|
141
|
+
if (p.kind === 'rework' || p.kind === 'rework-mixed') reworkSum += p.rework;
|
|
142
|
+
if (p.kind === 'rework-noise' || p.kind === 'rework-mixed') reworkNoiseSum += p.reworkNoise;
|
|
119
143
|
}
|
|
120
144
|
const delegatedValid = valid.filter((r) => r.scope === '委派');
|
|
121
145
|
return {
|
|
@@ -125,7 +149,8 @@ function metrics(rows) {
|
|
|
125
149
|
pass,
|
|
126
150
|
passRate: valid.length ? pass / valid.length : null,
|
|
127
151
|
reworkSum,
|
|
128
|
-
|
|
152
|
+
reworkNoiseSum,
|
|
153
|
+
avgRework: valid.length ? (reworkSum + reworkNoiseSum) / valid.length : null,
|
|
129
154
|
delegatedValid: delegatedValid.length,
|
|
130
155
|
fallback,
|
|
131
156
|
fallbackRate: delegatedValid.length ? fallback / delegatedValid.length : null,
|
|
@@ -144,7 +169,10 @@ function gateMonth(m) {
|
|
|
144
169
|
const items = [];
|
|
145
170
|
items.push({ no: 1, ok: m.total >= GATE.minSample, desc: `样本量 ${m.total}/${GATE.minSample}`, kind: '样本护栏' });
|
|
146
171
|
items.push({ no: 2, ok: m.passRate != null && m.passRate >= GATE.minPassRate, desc: `一次完成率 ${fmtRate(m.passRate)}≥90%`, kind: '口径' });
|
|
147
|
-
|
|
172
|
+
// 第 3 项判据 2026-10-08 语义变更:只对**设计返工**判 =0;门禁噪声返工单列在描述里(数字仍可见不隐藏,
|
|
173
|
+
// 但不参与 ok 判定——两类混判是本仓质量门连续两月红的根因)。⚠️ 不可据此给设计返工贴噪声标签洗白指标:
|
|
174
|
+
// 该取值由作者手写、机器无法判真伪(同 --delegated 信任边界),口径约束见 delegations.md 头部。
|
|
175
|
+
items.push({ no: 3, ok: m.reworkSum === 0, desc: `月度设计返工 ${m.reworkSum}=0(门禁噪声返工 ${m.reworkNoiseSum || 0} 次已剥离单列)`, kind: '口径' });
|
|
148
176
|
items.push({ no: 4, ok: m.fallback === 0, desc: `主兜底 ${m.fallback}=0(无主兜底信号)`, kind: '口径' });
|
|
149
177
|
items.push({ no: 5, ok: m.delegatedValid >= GATE.minDelegated, desc: `委派样本 ${m.delegatedValid}≥5`, kind: '样本护栏' });
|
|
150
178
|
items.push({ no: 6, ok: null, desc: '门禁不失守(人工对照当月 incident 定性)', kind: '人工' });
|
|
@@ -183,7 +211,7 @@ function main() {
|
|
|
183
211
|
const prevYm = (() => { const [y, mo] = ym.split('-').map(Number); const d = new Date(Date.UTC(y, mo - 2, 1)); return `${d.getUTCFullYear()}-${String(d.getUTCMonth() + 1).padStart(2, '0')}`; })();
|
|
184
212
|
const verdict = expansionVerdict(monthOk, monthResults.get(prevYm), !months.includes(prevYm), items);
|
|
185
213
|
console.log(`## ${ym}`);
|
|
186
|
-
console.log(` 有效任务 ${m.total}(待修 ${m.pending}${m.unknown ? `、未知结果 ${m.unknown}` : ''})|一次通过 ${m.pass}(${fmtRate(m.passRate)}
|
|
214
|
+
console.log(` 有效任务 ${m.total}(待修 ${m.pending}${m.unknown ? `、未知结果 ${m.unknown}` : ''})|一次通过 ${m.pass}(${fmtRate(m.passRate)})|设计返工 ${m.reworkSum} 次 / 门禁噪声返工 ${m.reworkNoiseSum} 次(合计返工 ${m.reworkSum + m.reworkNoiseSum},平均 ${fmtNum(m.avgRework)})|主兜底 ${m.fallback}/${m.delegatedValid}(${fmtRate(m.fallbackRate)})|incident ${incidents[ym] || 0} 起`);
|
|
187
215
|
for (const i of items) console.log(` 门${i.no}[${i.kind}] ${i.ok === null ? '[人工]' : i.ok ? '✅' : '❌'} ${i.desc}`);
|
|
188
216
|
console.log(` 扩容门判定:${verdict}\n`);
|
|
189
217
|
snapshotRows.push(`| ${ym} | ${m.total} | ${fmtRate(m.passRate)} | ${fmtNum(m.avgRework)} | ${fmtRate(m.fallbackRate)} | ${incidents[ym] || 0} | ${verdict} | 样本含待修${m.pending}${m.unknown ? `、未知${m.unknown}` : ''} |`);
|
|
@@ -91,13 +91,13 @@ const runAgg = (root) => spawnSync(process.execPath, [path.join(root, '.agents',
|
|
|
91
91
|
// 纯函数经 module.exports require(isMain 守卫后 import 不执行 main)
|
|
92
92
|
import { createRequire } from 'node:module';
|
|
93
93
|
const requireCjs = createRequire(import.meta.url);
|
|
94
|
-
const { metrics, gateMonth, expansionVerdict } = requireCjs(path.join(SCRIPT_DIR, 'agg-delegations.cjs'));
|
|
94
|
+
const { metrics, gateMonth, expansionVerdict, parseResult } = requireCjs(path.join(SCRIPT_DIR, 'agg-delegations.cjs'));
|
|
95
95
|
|
|
96
96
|
// 场景 4:审查反例——30 任务、2 主兜底、平均返工 0.25(旧口径四门全过,声明口径下必须 ❌)
|
|
97
97
|
{
|
|
98
98
|
const rows = [
|
|
99
|
-
...Array.from({ length: 22 }, (
|
|
100
|
-
...Array.from({ length: 6 }, (
|
|
99
|
+
...Array.from({ length: 22 }, () => ({ scope: '委派', result: '一次通过' })),
|
|
100
|
+
...Array.from({ length: 6 }, () => ({ scope: '委派', result: '返工×1' })),
|
|
101
101
|
{ scope: '委派', result: '主兜底' }, { scope: '委派', result: '主兜底' },
|
|
102
102
|
];
|
|
103
103
|
const m = metrics(rows);
|
|
@@ -119,6 +119,81 @@ const { metrics, gateMonth, expansionVerdict } = requireCjs(path.join(SCRIPT_DIR
|
|
|
119
119
|
check('场景 5:本月未达标 → ❌ 且列出未达标项号', expansionVerdict(false, true, false, [{ no: 3, ok: false }, { no: 4, ok: false }]).match(/❌.*3\+4/));
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
// 场景 6:门禁噪声返工拆分(2026-10-08 selfmeasure-and-modularize)
|
|
123
|
+
// 动机:本仓质量门连续两月红(55% / 61% < 90%),根因是门禁噪声与设计返工同判第 3 项 → 指标不指示改进方向。
|
|
124
|
+
{
|
|
125
|
+
check('场景 6:parseResult 识别门禁噪声档(kind=rework-noise;2026-10-08 rework-attribution-split 更正:rework 分量归 0——噪声不是设计返工;外部行为 metrics/第 3 项不变)',
|
|
126
|
+
parseResult('返工×2(门禁噪声)').kind === 'rework-noise' && parseResult('返工×2(门禁噪声)').reworkNoise === 2
|
|
127
|
+
&& parseResult('返工×2(门禁噪声)').rework === 0, JSON.stringify(parseResult('返工×2(门禁噪声)')));
|
|
128
|
+
check('场景 6:存量四档解析逐条不变(向后兼容钉子)',
|
|
129
|
+
parseResult('一次通过').kind === 'pass' && parseResult('返工×2').kind === 'rework'
|
|
130
|
+
&& parseResult('返工×2').rework === 2 && parseResult('主兜底').kind === 'fallback'
|
|
131
|
+
&& parseResult('返工待修').kind === 'pending' && parseResult('乱填').kind === 'unknown');
|
|
132
|
+
check('场景 6:新旧形态互不误吞($ 锚定;半角括号不认)',
|
|
133
|
+
parseResult('返工×1(门禁噪声)').kind !== 'rework' && parseResult('返工×1(门禁噪声)').kind === 'unknown');
|
|
134
|
+
|
|
135
|
+
const rows = [
|
|
136
|
+
{ scope: '自做', result: '返工×2(门禁噪声)' }, // 噪声
|
|
137
|
+
{ scope: '自做', result: '返工×3(门禁噪声)' }, // 噪声
|
|
138
|
+
{ scope: '自做', result: '一次通过' },
|
|
139
|
+
];
|
|
140
|
+
const m = metrics(rows);
|
|
141
|
+
check('场景 6:双列累计分离(设计返工 0 / 噪声 5)',
|
|
142
|
+
m.reworkSum === 0 && m.reworkNoiseSum === 5, JSON.stringify({ reworkSum: m.reworkSum, noise: m.reworkNoiseSum }));
|
|
143
|
+
check('场景 6:平均返工仍含噪声(快照行口径不变,delegations.md 表结构零改动)',
|
|
144
|
+
Math.abs(m.avgRework - 5 / 3) < 1e-9, String(m.avgRework));
|
|
145
|
+
const g = gateMonth(m);
|
|
146
|
+
const i3 = g.items.find((i) => i.no === 3);
|
|
147
|
+
check('场景 6:扩容门第 3 项只对设计返工判 ok=true(噪声不计入)', i3.ok === true, JSON.stringify(i3));
|
|
148
|
+
check('场景 6:噪声数字在描述里显式可见(不隐藏)', /门禁噪声返工 5 次已剥离单列/.test(i3.desc), i3.desc);
|
|
149
|
+
|
|
150
|
+
// 反向:设计返工不得因存在噪声档而被放过
|
|
151
|
+
const mixed = metrics([{ scope: '自做', result: '返工×1' }, { scope: '自做', result: '返工×1(门禁噪声)' }]);
|
|
152
|
+
check('场景 6:反例——设计返工 1 + 噪声 1 → 门 3 ❌(噪声标签不能洗白设计返工)',
|
|
153
|
+
gateMonth(mixed).items.find((i) => i.no === 3).ok === false, JSON.stringify(gateMonth(mixed).items[2]));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 场景 7:行内双值归因(2026-10-08 rework-attribution-split)
|
|
157
|
+
// 动机:存量逐行审计(29 行含返工)证实单值格式无法表达混合归因——一行只记一个返工总数时,
|
|
158
|
+
// 「1 次设计 + 1 次噪声」只能整行倒向某一侧。行内双值是作者写入时确定已知的归因事实,不反推。
|
|
159
|
+
{
|
|
160
|
+
const mixed = parseResult('返工×1 + 门禁噪声×1');
|
|
161
|
+
check('场景 7:行内双值解析出两个分量(kind=rework-mixed)',
|
|
162
|
+
mixed.kind === 'rework-mixed' && mixed.rework === 1 && mixed.reworkNoise === 1, JSON.stringify(mixed));
|
|
163
|
+
check('场景 7:宽容空格(无空格变体亦可解析)',
|
|
164
|
+
parseResult('返工×2+门禁噪声×3').rework === 2 && parseResult('返工×2+门禁噪声×3').reworkNoise === 3);
|
|
165
|
+
check('场景 7:四个返工格式互不误吞',
|
|
166
|
+
parseResult('返工×2').kind === 'rework' && parseResult('返工×2').reworkNoise === 0
|
|
167
|
+
&& parseResult('返工×2(门禁噪声)').kind === 'rework-noise'
|
|
168
|
+
&& parseResult('返工×2(门禁噪声)').rework === 0
|
|
169
|
+
&& parseResult('一次通过').kind === 'pass' && parseResult('乱填').kind === 'unknown');
|
|
170
|
+
check('场景 7:非法数字落 unknown(记录本身有问题,不混进待修)',
|
|
171
|
+
parseResult('返工×a + 门禁噪声×1').kind === 'unknown');
|
|
172
|
+
|
|
173
|
+
// 不变量①:任务总数不虚增——一行仍是一个任务,两个数字不拆成两个任务
|
|
174
|
+
const rows = [
|
|
175
|
+
{ scope: '自做', result: '返工×1 + 门禁噪声×2' },
|
|
176
|
+
{ scope: '自做', result: '返工×1 + 门禁噪声×2' },
|
|
177
|
+
{ scope: '自做', result: '一次通过' },
|
|
178
|
+
];
|
|
179
|
+
const m = metrics(rows);
|
|
180
|
+
check('场景 7:不变量①——total 按行计 1(行内双值不虚增任务数 / 不抬高 passRate 分母)',
|
|
181
|
+
m.total === 3, `total=${m.total}`);
|
|
182
|
+
check('场景 7:双列准确累计(设计返工 2 / 门禁噪声 4)',
|
|
183
|
+
m.reworkSum === 2 && m.reworkNoiseSum === 4, JSON.stringify({ r: m.reworkSum, n: m.reworkNoiseSum }));
|
|
184
|
+
check('场景 7:一次通过率分母不变(1/3,与若拆成两行的结果不同——这是选行内双值而非拆行的理由)',
|
|
185
|
+
Math.abs(m.passRate - 1 / 3) < 1e-9, String(m.passRate));
|
|
186
|
+
|
|
187
|
+
// 混合行的门 3 判定:设计返工 0 + 噪声 4 → ok;设计返工 2 → ❌
|
|
188
|
+
const onlyNoise = metrics([{ scope: '自做', result: '返工×0 + 门禁噪声×3' }, { scope: '自做', result: '一次通过' }]);
|
|
189
|
+
const i3ok = gateMonth(onlyNoise).items.find((i) => i.no === 3);
|
|
190
|
+
check('场景 7:纯噪声混合行 → 门 3 ✅ 且描述带噪声数',
|
|
191
|
+
i3ok.ok === true && /门禁噪声返工 3 次已剥离单列/.test(i3ok.desc), JSON.stringify(i3ok));
|
|
192
|
+
const withDesign = gateMonth(m).items.find((i) => i.no === 3);
|
|
193
|
+
check('场景 7:含设计返工的混合行 → 门 3 ❌(噪声分量不能洗白设计分量)',
|
|
194
|
+
withDesign.ok === false, JSON.stringify(withDesign));
|
|
195
|
+
}
|
|
196
|
+
|
|
122
197
|
console.log(`\n合计: PASS ${pass} / FAIL ${fail}`);
|
|
123
198
|
if (fail) {
|
|
124
199
|
console.log(`\n${USAGE}`);
|