flow-comet 1.7.0 → 1.8.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/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
- package/.flow-comet/skills/flow-comet/SKILL.md +16 -14
- package/.flow-comet/skills/flow-comet/reference/commit-discipline.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/decision-points.md +5 -5
- package/.flow-comet/skills/flow-comet/reference/dirty-worktree.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/entry-detail.md +9 -9
- package/.flow-comet/skills/flow-comet/reference/fix-loop.md +4 -4
- package/.flow-comet/skills/flow-comet/reference/init-detection.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/platform-facts.md +2 -2
- package/.flow-comet/skills/flow-comet/reference/post-archive-handoff.md +264 -0
- package/.flow-comet/skills/flow-comet/reference/recovery.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/replan.md +1 -1
- package/.flow-comet/skills/flow-comet/scripts/comet-check.mjs +1 -0
- package/.flow-comet/skills/flow-comet/scripts/comet-hook-guard.mjs +270 -30
- package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +25 -8
- package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +41 -38
- package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +11 -9
- package/.flow-comet/skills/flow-comet/scripts/items/e.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/items/f.mjs +1 -1
- package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +112 -53
- package/.flow-comet/skills/flow-comet/scripts/items/k.mjs +357 -3
- package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +24 -1
- package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +9 -10
- package/.flow-comet/skills/flow-comet/scripts/lib/ac-coverage.mjs +8 -8
- package/.flow-comet/skills/flow-comet/scripts/lib/fix-loop-node.mjs +4 -15
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +79 -107
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +183 -232
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +91 -14
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-template-fidelity.mjs +20 -32
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +10 -19
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-admin.mjs +27 -17
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +240 -87
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-recovery.mjs +15 -22
- package/.flow-comet/skills/flow-comet/scripts/lib/state-determine.mjs +11 -4
- package/.flow-comet/skills/flow-comet/scripts/lib/state-io.mjs +192 -24
- package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +55 -44
- package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +2 -4
- package/.flow-comet/skills/flow-comet/scripts/lib/test-assertions.mjs +0 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +191 -17
- package/.flow-comet/skills/flow-comet/scripts/lib/test-helpers.mjs +3 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +23 -5
- package/.flow-comet/skills/flow-comet/scripts/lib/wave-projection.mjs +10 -11
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +40 -3
- package/.flow-comet/skills/flow-comet/scripts/route-node.mjs +12 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +193 -111
- package/.flow-comet/skills/flow-comet/scripts/scenarios/b.mjs +314 -57
- package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +311 -216
- package/.flow-comet/skills/flow-comet/scripts/scenarios/d.mjs +33 -62
- package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +188 -91
- package/.flow-comet/skills/flow-comet/scripts/scenarios/f.mjs +94 -37
- package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +36 -27
- package/.flow-comet/skills/flow-comet/scripts/scenarios/h.mjs +285 -9
- package/.flow-comet/skills/flow-comet/scripts/scenarios/i.mjs +2 -6
- package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +5 -15
- package/.flow-comet/skills/flow-comet/scripts/scenarios/k.mjs +6 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +40 -36
- package/.flow-comet/skills/flow-comet/scripts/scenarios/m.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +346 -25
- package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +0 -2
- package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +41 -54
- package/.flow-comet/skills/flow-comet-archive/SKILL.md +33 -11
- package/.flow-comet/skills/flow-comet-change/SKILL.md +1 -1
- package/.flow-comet/skills/flow-comet-design/SKILL.md +5 -3
- package/.flow-comet/skills/flow-comet-dev/SKILL.md +2 -2
- package/.flow-comet/skills/flow-comet-execute/SKILL.md +11 -11
- package/.flow-comet/skills/flow-comet-integration/SKILL.md +10 -4
- package/.flow-comet/skills/flow-comet-plan/GUIDANCE.md +1 -1
- package/.flow-comet/skills/flow-comet-plan/SKILL.md +8 -8
- package/.flow-comet/skills/flow-comet-review/SKILL.md +8 -8
- package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +1 -1
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +14 -14
- package/.flow-comet/skills/flow-comet-task/SKILL.md +3 -2
- package/.flow-comet/skills/flow-comet-ui-design/SKILL.md +2 -2
- package/.flow-comet/skills/flow-comet-verify/SKILL.md +1 -1
- package/README.md +2 -2
- package/package.json +1 -1
- package/scripts/dsh-bridge.mjs +238 -21
|
@@ -30,6 +30,9 @@ import {
|
|
|
30
30
|
engineScriptFiles,
|
|
31
31
|
engineScriptTexts,
|
|
32
32
|
handoffFor,
|
|
33
|
+
intakeChangeText,
|
|
34
|
+
intakeDesignText,
|
|
35
|
+
intakeRequirementText,
|
|
33
36
|
strictSummary,
|
|
34
37
|
summaryContent,
|
|
35
38
|
timeUtilsModule,
|
|
@@ -70,8 +73,12 @@ export const ENTRIES = [
|
|
|
70
73
|
const st = baseState('open');
|
|
71
74
|
st.evidence.open = { summary: 'intake complete' };
|
|
72
75
|
writeState(dir, st);
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
writeNodeDeclarationMarkers(dir, 'open');
|
|
77
|
+
// 单轨:模板保真对一切 change 生效 → 夹具给出标题形态 + 首部字段 + 非空正文
|
|
78
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/CHANGE.md',
|
|
79
|
+
'# CHANGE: 夹具\n\n- **Change ID**: ' + CHANGE_ID + '\n\n## Why(为什么做)\n\n夹具。\n\n## 范围(Scope)\n\n夹具。\n');
|
|
80
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md',
|
|
81
|
+
'# REQUIREMENT: 夹具\n\n- **Change ID**: ' + CHANGE_ID + '\n\n## 用户故事(User Story)\n\n- US-1\n\n## 验收准则(AC)\n\n- Given a When b Then c\n\n## 非目标(Non-Goals)\n\n- 无\n');
|
|
75
82
|
const res = runGuard(['exit', 'open'], dir);
|
|
76
83
|
assertExit(res, 0);
|
|
77
84
|
assertOut(res, 'ALL CHECKS PASSED');
|
|
@@ -88,8 +95,12 @@ export const ENTRIES = [
|
|
|
88
95
|
const st = baseState('open');
|
|
89
96
|
st.evidence.open = { summary: 'intake complete' };
|
|
90
97
|
writeState(dir, st);
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
writeNodeDeclarationMarkers(dir, 'open');
|
|
99
|
+
// 标题形态与首部字段来自登记表(不依赖模板),夹具按合规形态给;缺的是模板段名(Why)
|
|
100
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/CHANGE.md',
|
|
101
|
+
'# CHANGE: 夹具\n\n- **Change ID**: ' + CHANGE_ID + '\n\n## 变更目标\n\n夹具。\n\n## 方案\n\n夹具。\n');
|
|
102
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md',
|
|
103
|
+
'# REQUIREMENT: 夹具\n\n- **Change ID**: ' + CHANGE_ID + '\n\n## 用户故事\n\n- US-1\n\n## 验收准则(AC)\n\n- Given a When b Then c\n');
|
|
93
104
|
const res = runGuard(['exit', 'open'], dir);
|
|
94
105
|
assertExit(res, 0);
|
|
95
106
|
assertOut(res, '未校验(模板缺失): CHANGE.md');
|
|
@@ -109,6 +120,7 @@ export const ENTRIES = [
|
|
|
109
120
|
const st = baseState('open');
|
|
110
121
|
st.evidence.open = { summary: 'intake complete' };
|
|
111
122
|
writeState(dir, st);
|
|
123
|
+
writeNodeDeclarationMarkers(dir, 'open');
|
|
112
124
|
writeFile(dir, '.specs/' + CHANGE_ID + '/CHANGE.md', '# CHANGE\n\n## Why\n');
|
|
113
125
|
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md', '# REQUIREMENT\n\n## 用户故事\n\n## 需求分析\n');
|
|
114
126
|
const res = runGuard(['exit', 'open'], dir);
|
|
@@ -126,7 +138,9 @@ export const ENTRIES = [
|
|
|
126
138
|
const st = baseState('design');
|
|
127
139
|
st.evidence.design = { summary: 'design done' };
|
|
128
140
|
writeState(dir, st);
|
|
129
|
-
|
|
141
|
+
writeNodeDeclarationMarkers(dir, 'design');
|
|
142
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/DESIGN.md',
|
|
143
|
+
'# DESIGN: 夹具\n\n- **Change ID**: ' + CHANGE_ID + '\n\n## 0. 技术栈选型\n\nNode.js(ESM)\n\n## 1. 技术决策清单\n\n- D1 夹具决策\n\n## 2. 数据流\n\n夹具:无数据流。\n');
|
|
130
144
|
const res = runGuard(['exit', 'design'], dir);
|
|
131
145
|
assertExit(res, 0);
|
|
132
146
|
assertOut(res, 'ALL CHECKS PASSED');
|
|
@@ -158,9 +172,10 @@ export const ENTRIES = [
|
|
|
158
172
|
const st = baseState('plan');
|
|
159
173
|
st.evidence.plan = { summary: 'plan done' };
|
|
160
174
|
writeState(dir, st);
|
|
161
|
-
const newChangeState = { ...baseState('plan'),
|
|
175
|
+
const newChangeState = { ...baseState('plan'), enteredNodes: ['plan'] };
|
|
162
176
|
newChangeState.evidence.plan = { summary: 'plan done' };
|
|
163
177
|
writeState(dir, newChangeState);
|
|
178
|
+
writeNodeDeclarationMarkers(dir, 'plan');
|
|
164
179
|
// ① 缺 write_files → 预检 BLOCKED,且 state 字节零改写
|
|
165
180
|
const missingFieldTask =
|
|
166
181
|
'<task id="T01" status="pending"><name>任务一</name><read_files>src/*</read_files>'
|
|
@@ -213,6 +228,7 @@ export const ENTRIES = [
|
|
|
213
228
|
const st = baseState('execute');
|
|
214
229
|
st.evidence.execute = { summary: 'executed' };
|
|
215
230
|
writeState(dir, st);
|
|
231
|
+
writeNodeDeclarationMarkers(dir, 'execute');
|
|
216
232
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + TASK_DONE);
|
|
217
233
|
// enter 时脚本自动记录 taskHash(写回 state)
|
|
218
234
|
const entryView = runGuard(['entry', 'execute'], dir);
|
|
@@ -230,7 +246,7 @@ export const ENTRIES = [
|
|
|
230
246
|
}
|
|
231
247
|
assertNotOut(entryView, '只能通过 Agent 工具 worktree isolation 委托子代理');
|
|
232
248
|
// exit 前补 SUMMARY + handoff(不碰 TASK.md)
|
|
233
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md',
|
|
249
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md', strictSummary('T01'));
|
|
234
250
|
const st2 = JSON.parse(fs.readFileSync(path.join(dir, '.flow-comet', 'flow-comet-state.json'), 'utf8'));
|
|
235
251
|
st2.evidence['subagent-execute'] = { handoffResult: handoffFor(['T01']) };
|
|
236
252
|
writeState(dir, st2);
|
|
@@ -260,7 +276,9 @@ export const ENTRIES = [
|
|
|
260
276
|
}));
|
|
261
277
|
const resVariantNeg = runGuard(['exit', 'execute'], dir);
|
|
262
278
|
assertExit(resVariantNeg, 1);
|
|
263
|
-
|
|
279
|
+
// 单轨下方法门对一切 change 生效:「段内无方法声明」由 6 维自查段的同一判据先报出
|
|
280
|
+
// (措辞与旧口径不同,判据相同——都是「没有声明自检方法」)
|
|
281
|
+
assertOut(resVariantNeg, '6 维自查未声明使用 /brooks-review');
|
|
264
282
|
|
|
265
283
|
// ---------- 节点视图收敛(in-place 扩展) ----------
|
|
266
284
|
// 构造「execute 已 entry 未 exit、产物推导已指向其后继 review」的态:此前 status 只报
|
|
@@ -343,6 +361,7 @@ export const ENTRIES = [
|
|
|
343
361
|
// 两个输出面同形:同一节点下 handoff result 打印的同一条命令必须逐字相同(不是各写一份)。
|
|
344
362
|
// handoff 侧的路由视图要解析协议(与 next 同一判定),而 runHandoff 默认不注入协议副本——
|
|
345
363
|
// 显式传入场景协议路径(与 runState 的默认注入同源)。
|
|
364
|
+
assertExit(runHandoff(['request', 'T01', 'delegate T01'], dir, { FLOW_COMET_PROTOCOL: scenarioProtocolPath(dir) }), 0);
|
|
346
365
|
const handoffPre = runHandoff(['result', 'T01', '{"greenEvidence":{"command":"node --check src/t1.mjs"},"redEvidence":{"command":"node --check src/t1.mjs"}}'], dir, {
|
|
347
366
|
FLOW_COMET_PROTOCOL: scenarioProtocolPath(dir),
|
|
348
367
|
});
|
|
@@ -508,7 +527,6 @@ export const ENTRIES = [
|
|
|
508
527
|
verifyFailures: 0,
|
|
509
528
|
executionMode: 'subagent',
|
|
510
529
|
directOverride: false,
|
|
511
|
-
newChange: true,
|
|
512
530
|
};
|
|
513
531
|
writeFile(dir, fixTaskPath, fixBatchTaskText('pending'));
|
|
514
532
|
writeFile(dir, '.specs/' + CHANGE_ID + '/REVIEW.md', '# REVIEW\n\n## 结论\n\n修复任务已追加,待归位 execute 跑完其出口。\n');
|
|
@@ -672,7 +690,6 @@ export const ENTRIES = [
|
|
|
672
690
|
verifyFailures: 0,
|
|
673
691
|
executionMode: 'subagent',
|
|
674
692
|
directOverride: false,
|
|
675
|
-
newChange: true,
|
|
676
693
|
});
|
|
677
694
|
const behindBytes = readStateBytes(dir);
|
|
678
695
|
const behindStatus = runState(['status'], dir);
|
|
@@ -715,7 +732,7 @@ export const ENTRIES = [
|
|
|
715
732
|
// 撞 BLOCKED,「同一状态同一答案」在这两种态上不成立。修复后 status 输出 routeNode=null 且
|
|
716
733
|
// ROUTE: 行写明「next 将 BLOCKED:<原因>」,与 next 的实际行为一致;判定是 state 副本上的
|
|
717
734
|
// 只读预演(真实字节零改写、不计轮次)。
|
|
718
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md',
|
|
735
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md', strictSummary('T01'));
|
|
719
736
|
writeFile(dir, fixTaskPath, fixBatchTaskText('pending'));
|
|
720
737
|
writeState(dir, { ...fixState, fixRoundsByChange: { [CHANGE_ID]: 3 } });
|
|
721
738
|
const blockedFixBytes = readStateBytes(dir);
|
|
@@ -873,9 +890,10 @@ export const ENTRIES = [
|
|
|
873
890
|
},
|
|
874
891
|
},
|
|
875
892
|
|
|
876
|
-
// 9: execute exit BLOCKED——6
|
|
893
|
+
// 9: execute exit BLOCKED——6 维自查段内无方法声明(单轨:方法门对一切 change 生效;
|
|
894
|
+
// 旧口径下这一格先被「无实质内容」拦,现在由同一族的方法声明判据先报出——判据相同、措辞不同)
|
|
877
895
|
{
|
|
878
|
-
name: '09 execute exit BLOCKED:6
|
|
896
|
+
name: '09 execute exit BLOCKED:6 维自查无方法声明',
|
|
879
897
|
run: (dir) => {
|
|
880
898
|
const st = baseState('execute');
|
|
881
899
|
st.evidence.execute = { summary: 'executed' };
|
|
@@ -887,7 +905,7 @@ export const ENTRIES = [
|
|
|
887
905
|
}));
|
|
888
906
|
const res = runGuard(['exit', 'execute'], dir);
|
|
889
907
|
assertExit(res, 1);
|
|
890
|
-
assertOut(res, '
|
|
908
|
+
assertOut(res, '6 维自查未声明使用 /brooks-review');
|
|
891
909
|
},
|
|
892
910
|
},
|
|
893
911
|
|
|
@@ -901,18 +919,19 @@ export const ENTRIES = [
|
|
|
901
919
|
writeState(dir, st);
|
|
902
920
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + TASK_DONE);
|
|
903
921
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md', summaryContent({
|
|
904
|
-
sixDim: '## 6 维自查\n\n- 功能:
|
|
922
|
+
sixDim: '## 6 维自查\n\n- 功能: 通过(brooks-review 已跑)\n- 性能: 无影响\n- 安全: 无影响\n- 兼容: 通过\n- 可观测: 通过\n- 可维护: 通过',
|
|
905
923
|
method: '',
|
|
906
924
|
}));
|
|
907
925
|
const res = runGuard(['exit', 'execute'], dir);
|
|
908
926
|
assertExit(res, 1);
|
|
927
|
+
// 6 维段声明了方法(方法门通过)→ 由「## 自检方法 段必须在场」这一判据拦下
|
|
909
928
|
assertOut(res, '自检方法');
|
|
910
929
|
},
|
|
911
930
|
},
|
|
912
931
|
|
|
913
|
-
// 11: execute exit
|
|
932
|
+
// 11: execute exit——旧格式无 ## 自检方法 段但 6 维含 brooks-review → 段标题必须在场(BLOCKED)
|
|
914
933
|
{
|
|
915
|
-
name: '11 execute exit
|
|
934
|
+
name: '11 execute exit BLOCKED:旧格式缺 ## 自检方法 段',
|
|
916
935
|
run: (dir) => {
|
|
917
936
|
const st = baseState('execute');
|
|
918
937
|
st.evidence.execute = { summary: 'executed' };
|
|
@@ -921,8 +940,8 @@ export const ENTRIES = [
|
|
|
921
940
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + TASK_DONE);
|
|
922
941
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md', summaryContent({ method: '' }));
|
|
923
942
|
const res = runGuard(['exit', 'execute'], dir);
|
|
924
|
-
assertExit(res,
|
|
925
|
-
assertOut(res, '
|
|
943
|
+
assertExit(res, 1);
|
|
944
|
+
assertOut(res, '自检方法');
|
|
926
945
|
},
|
|
927
946
|
},
|
|
928
947
|
|
|
@@ -948,12 +967,14 @@ export const ENTRIES = [
|
|
|
948
967
|
{
|
|
949
968
|
name: '13 execute exit BLOCKED:parallel done 无 handoffResult(越俎代庖)',
|
|
950
969
|
run: (dir) => {
|
|
970
|
+
writeNodeDeclarationMarkers(dir, 'execute');
|
|
971
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/P02-SUMMARY.md', strictSummary('P02'));
|
|
951
972
|
const st = baseState('execute');
|
|
952
973
|
st.evidence.execute = { summary: 'executed' };
|
|
953
974
|
st.evidence['subagent-execute'] = { handoffResult: handoffFor(['T01']) }; // P02 无 handoff
|
|
954
975
|
writeState(dir, st);
|
|
955
976
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + TASK_DONE + TASK_P2);
|
|
956
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md',
|
|
977
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md', strictSummary('T01'));
|
|
957
978
|
const res = runGuard(['exit', 'execute'], dir);
|
|
958
979
|
assertExit(res, 1);
|
|
959
980
|
assertOut(res, '越俎代庖');
|
|
@@ -995,7 +1016,6 @@ export const ENTRIES = [
|
|
|
995
1016
|
'',
|
|
996
1017
|
].join('\n'));
|
|
997
1018
|
const st = baseState('execute');
|
|
998
|
-
st.newChange = true;
|
|
999
1019
|
st.enteredNodes = ['execute'];
|
|
1000
1020
|
st.evidence.execute = { summary: 'executed' };
|
|
1001
1021
|
st.evidence['subagent-execute'] = { handoffResult: handoffFor(['P02']) };
|
|
@@ -1005,7 +1025,22 @@ export const ENTRIES = [
|
|
|
1005
1025
|
// 坏 SUMMARY:关键段齐(关键段门能过),但段形不合模板——标题缺 `# SUMMARY:`
|
|
1006
1026
|
// 前缀、首部四字段缺席、段序偏离、缺「是否触发新工作」「完成判定」。这正是只有模板保真门
|
|
1007
1027
|
// 才判、因而被更早的进展门挡住的结构问题。
|
|
1008
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md',
|
|
1028
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md', [
|
|
1029
|
+
'# T01-SUMMARY',
|
|
1030
|
+
'',
|
|
1031
|
+
'## 做了什么(一段话)', '', '实现 T01。',
|
|
1032
|
+
'## 改动文件', '', '- src/t1.mjs',
|
|
1033
|
+
'## verify 输出(必填)', '', '```', 'node --check src/t1.mjs', '```',
|
|
1034
|
+
'## 6 维自查(生产代码改动必填 · 来自 4-dev 步骤 4)', '', '- 功能: 通过(brooks-review 已跑)',
|
|
1035
|
+
'### 已知接受 + 理由(🟡 Major 项不修的)', '', '- 无。',
|
|
1036
|
+
'### 已知小问题(🟢 Minor 项可省的)', '', '- 无。',
|
|
1037
|
+
'## 数据库迁移(涉及 schema 变更必填 · 来自 4-dev 步骤 1.7 / R4.5)', '', 'N/A',
|
|
1038
|
+
'## 越界检查(必填 · 来自 4-dev 步骤 5 / R6.5 / B3 老项目护栏)', '', '无越界。',
|
|
1039
|
+
'## 破坏性变更(涉及破坏性改动必填 · 来自 4-dev 步骤 1.8 / R4.6 / B4 老项目护栏)', '', 'N/A',
|
|
1040
|
+
'## 决策与偏离(如有)', '', '无。',
|
|
1041
|
+
'## 自检方法', '', 'brooks-review',
|
|
1042
|
+
'## LESSONS 扫描', '', '无 active 条目命中(夹具)。',
|
|
1043
|
+
].join('\n'));
|
|
1009
1044
|
const serialExit = runGuard(['exit', 'execute'], dir);
|
|
1010
1045
|
assertExit(serialExit, 1);
|
|
1011
1046
|
assertOut(serialExit, '串行 pending');
|
|
@@ -1027,12 +1062,13 @@ export const ENTRIES = [
|
|
|
1027
1062
|
'--preflight 不得写模板提示账本(.template-hints.json)');
|
|
1028
1063
|
|
|
1029
1064
|
// ② 分级不变:同一坏 SUMMARY 在旧 change 只 WARN 不阻断(预检不得把旧 change 升级成 BLOCK)
|
|
1030
|
-
writeState(dir, { ...st
|
|
1065
|
+
writeState(dir, { ...st });
|
|
1031
1066
|
const oldChangeBytes = readStateBytes(dir);
|
|
1032
1067
|
const oldChangePre = runGuard(['exit', 'execute', '--preflight'], dir);
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1068
|
+
// 单轨:段形不符一律 BLOCKED(不再有旧 change 渐进 WARN 这一侧)
|
|
1069
|
+
assertExit(oldChangePre, 1);
|
|
1070
|
+
assertOut(oldChangePre, 'BLOCKED');
|
|
1071
|
+
assertOut(oldChangePre, 'T01-SUMMARY.md 模板结构校验失败');
|
|
1036
1072
|
assertStateBytesUnchanged(dir, oldChangeBytes, '旧 change 预检同样只读');
|
|
1037
1073
|
writeState(dir, st);
|
|
1038
1074
|
const restoredBytes = readStateBytes(dir);
|
|
@@ -1109,7 +1145,7 @@ export const ENTRIES = [
|
|
|
1109
1145
|
// REQUIREMENT.md。改前结构子集只查「在场者」⇒ 一件都没查、打印 ALL CHECKS PASSED(假绿)。
|
|
1110
1146
|
// 本节点声明的 file 类工件(open: CHANGE.md + REQUIREMENT.md)是否在场是**结构事实**,不是
|
|
1111
1147
|
// 进展判定:缺失必须 BLOCK,逐项给路径,并给一句「先创建该工件(按模板路径)」的指引。
|
|
1112
|
-
const openState = { ...baseState('open'),
|
|
1148
|
+
const openState = { ...baseState('open'), enteredNodes: ['open'] };
|
|
1113
1149
|
fs.rmSync(path.join(dir, '.specs', CHANGE_ID), { recursive: true, force: true });
|
|
1114
1150
|
writeState(dir, openState);
|
|
1115
1151
|
const emptyOpenBytes = readStateBytes(dir);
|
|
@@ -1208,6 +1244,9 @@ export const ENTRIES = [
|
|
|
1208
1244
|
{
|
|
1209
1245
|
name: '15 subagent-execute exit 三态(在飞委托 BLOCK·全部收工放行·无证据零输出)+ 留痕嵌套锚',
|
|
1210
1246
|
run: (dir) => {
|
|
1247
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/P02-SUMMARY.md', strictSummary('P02'));
|
|
1248
|
+
writeNodeDeclarationMarkers(dir, 'subagent-execute');
|
|
1249
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/P01-SUMMARY.md', strictSummary('P01'));
|
|
1211
1250
|
const st = baseState('subagent-execute');
|
|
1212
1251
|
st.evidence['subagent-execute'] = {
|
|
1213
1252
|
summary: 'delegated and collected',
|
|
@@ -1253,7 +1292,7 @@ export const ENTRIES = [
|
|
|
1253
1292
|
assertOut(unqualifiedExit, '缺 commitHash');
|
|
1254
1293
|
|
|
1255
1294
|
// ② 在飞委托(有 request 无对应 result)⇒ 新 change BLOCKED,报文点名未收工任务并给恢复指引
|
|
1256
|
-
const inFlight = { ...baseState('subagent-execute')
|
|
1295
|
+
const inFlight = { ...baseState('subagent-execute') };
|
|
1257
1296
|
inFlight.enteredNodes = ['subagent-execute'];
|
|
1258
1297
|
inFlight.evidence['subagent-execute'] = {
|
|
1259
1298
|
summary: 'delegated, one writer still running',
|
|
@@ -1273,13 +1312,12 @@ export const ENTRIES = [
|
|
|
1273
1312
|
assertOut(blocked, '待写入者收工后重跑');
|
|
1274
1313
|
assertOut(blocked, 'P03');
|
|
1275
1314
|
assertNotOut(blocked, 'P01(');
|
|
1276
|
-
// ②b
|
|
1315
|
+
// ②b 同一形态(无任何新旧标记字段)⇒ 同判 BLOCKED(单轨,无渐进侧),指引仍在
|
|
1277
1316
|
const inFlightOld = { ...inFlight };
|
|
1278
|
-
delete inFlightOld.newChange;
|
|
1279
1317
|
writeState(dir, inFlightOld);
|
|
1280
1318
|
const warned = runGuard(['exit', 'subagent-execute'], dir);
|
|
1281
|
-
assertExit(warned,
|
|
1282
|
-
assertOut(warned, '
|
|
1319
|
+
assertExit(warned, 1);
|
|
1320
|
+
assertOut(warned, 'BLOCKED');
|
|
1283
1321
|
assertOut(warned, '在飞委托');
|
|
1284
1322
|
assertOut(warned, '待写入者收工后重跑');
|
|
1285
1323
|
// ③ 无该证据对象(从未进入委托节点)⇒ 零输出:判据不得在无证据形态下制造噪音
|
|
@@ -1300,7 +1338,7 @@ export const ENTRIES = [
|
|
|
1300
1338
|
P01: { writeFiles: ['src/p1.mjs'] },
|
|
1301
1339
|
P02: { writeFiles: ['src/p2.mjs'], requestedAt: '2026-10-07T00:00:00.000Z' },
|
|
1302
1340
|
});
|
|
1303
|
-
const withdrawCase = { ...baseState('subagent-execute')
|
|
1341
|
+
const withdrawCase = { ...baseState('subagent-execute') };
|
|
1304
1342
|
withdrawCase.enteredNodes = ['subagent-execute'];
|
|
1305
1343
|
withdrawCase.evidence['subagent-execute'] = {
|
|
1306
1344
|
summary: 'delegated, one request abandoned',
|
|
@@ -1549,19 +1587,19 @@ export const ENTRIES = [
|
|
|
1549
1587
|
},
|
|
1550
1588
|
},
|
|
1551
1589
|
|
|
1552
|
-
// 20: exit open——CONTEXT.md 孤立追加段 →
|
|
1590
|
+
// 20: exit open——CONTEXT.md 孤立追加段 → BLOCKED(结构段必须在场,单一等级)
|
|
1553
1591
|
{
|
|
1554
|
-
name: '20 exit open
|
|
1592
|
+
name: '20 exit open BLOCKED:CONTEXT.md 孤立追加段',
|
|
1555
1593
|
run: (dir) => {
|
|
1556
1594
|
const st = baseState('open');
|
|
1557
1595
|
st.evidence.open = { summary: 'intake complete' };
|
|
1558
1596
|
writeState(dir, st);
|
|
1559
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/CHANGE.md',
|
|
1560
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md',
|
|
1597
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/CHANGE.md', intakeChangeText());
|
|
1598
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md', intakeRequirementText());
|
|
1561
1599
|
writeFile(dir, '.specs/CONTEXT.md', '# CONTEXT\n\n## 术语(test-change 追加)\n\n某术语\n');
|
|
1562
1600
|
const res = runGuard(['exit', 'open'], dir);
|
|
1563
|
-
assertExit(res,
|
|
1564
|
-
assertOut(res, '
|
|
1601
|
+
assertExit(res, 1);
|
|
1602
|
+
assertOut(res, 'BLOCKED: CONTEXT.md 检测到孤立追加段');
|
|
1565
1603
|
},
|
|
1566
1604
|
},
|
|
1567
1605
|
|
|
@@ -1575,6 +1613,8 @@ export const ENTRIES = [
|
|
|
1575
1613
|
{
|
|
1576
1614
|
name: '21 exit verify WARN:LESSONS.md 编号乱序 + verify timeout env 覆盖 + AC 覆盖(新 change BLOCK / 旧 change WARN / 判不了按成因二分)',
|
|
1577
1615
|
run: async (dir) => {
|
|
1616
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md', intakeRequirementText());
|
|
1617
|
+
writeNodeDeclarationMarkers(dir, 'verify');
|
|
1578
1618
|
const st = baseState('verify');
|
|
1579
1619
|
st.evidence.verify = { summary: 'verified' };
|
|
1580
1620
|
writeState(dir, st);
|
|
@@ -1582,8 +1622,8 @@ export const ENTRIES = [
|
|
|
1582
1622
|
writeFile(dir, '.specs/' + CHANGE_ID + '/UAT.md', '# UAT\n\n通过\n');
|
|
1583
1623
|
writeFile(dir, '.specs/LESSONS.md', '# LESSONS\n\n## 条目区\n\n### L-002: b\n### L-001: a\n');
|
|
1584
1624
|
const res = runGuard(['exit', 'verify'], dir);
|
|
1585
|
-
assertExit(res,
|
|
1586
|
-
assertOut(res, '
|
|
1625
|
+
assertExit(res, 1);
|
|
1626
|
+
assertOut(res, 'BLOCKED: LESSONS.md 条目编号乱序');
|
|
1587
1627
|
// 子断言:无区外条目时不得打印"条目在条目区外"WARN(误报修复——修复前
|
|
1588
1628
|
// console.error 在 if(outside) 之外无条件执行,每次 exit 都刷一条空 WARN)
|
|
1589
1629
|
assertNotOut(res, '条目在条目区外');
|
|
@@ -1593,10 +1633,10 @@ export const ENTRIES = [
|
|
|
1593
1633
|
writeFile(dir, '.specs/LESSONS.md', '# LESSONS\n\n## 条目区\n\n### L-002: b\n\n'
|
|
1594
1634
|
+ '```md\n## 写法样例(围栏内的标题不结束条目区)\n```\n\n### L-001: a\n');
|
|
1595
1635
|
const resFencedOrder = runGuard(['exit', 'verify'], dir);
|
|
1596
|
-
assertExit(resFencedOrder,
|
|
1597
|
-
assertOut(resFencedOrder, '
|
|
1598
|
-
//
|
|
1599
|
-
writeFile(dir, '.specs/LESSONS.md', '# LESSONS\n\n## 条目区\n\n### L-
|
|
1636
|
+
assertExit(resFencedOrder, 1);
|
|
1637
|
+
assertOut(resFencedOrder, 'BLOCKED: LESSONS.md 条目编号乱序');
|
|
1638
|
+
// 复位:后续子断言要求出口通过 → LESSONS 回到有序形态(编号升序)
|
|
1639
|
+
writeFile(dir, '.specs/LESSONS.md', '# LESSONS\n\n## 条目区\n\n### L-001: a\n### L-002: b\n');
|
|
1600
1640
|
// 子断言:## 验证命令 段标题带括号后缀(与 ## 自检方法 段括号后缀兼容风格一致)不误 BLOCK
|
|
1601
1641
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', '# TEST\n\n## 验证命令(必填 · exit verify 真实执行)\n\n```bash\nnode -e "1"\n```\n');
|
|
1602
1642
|
const resBracket = runGuard(['exit', 'verify'], dir);
|
|
@@ -1756,7 +1796,6 @@ export const ENTRIES = [
|
|
|
1756
1796
|
const acState = (isNew) => {
|
|
1757
1797
|
const st = { ...baseState('verify'), evidence: { verify: { summary: 'verified' } } };
|
|
1758
1798
|
if (isNew) {
|
|
1759
|
-
st.newChange = true;
|
|
1760
1799
|
st.enteredNodes = ['verify'];
|
|
1761
1800
|
}
|
|
1762
1801
|
return st;
|
|
@@ -1765,16 +1804,11 @@ export const ENTRIES = [
|
|
|
1765
1804
|
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md', acRequirement(acceptanceBody));
|
|
1766
1805
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', acTest(coveredIds));
|
|
1767
1806
|
writeState(dir, acState(isNew));
|
|
1768
|
-
//
|
|
1769
|
-
|
|
1807
|
+
// 声明标记(单轨:任何 change 出口都要求声明;夹具直接写 state,故由夹具补同一份事实)
|
|
1808
|
+
writeNodeDeclarationMarkers(dir, 'verify');
|
|
1770
1809
|
};
|
|
1771
1810
|
// 缺覆盖报文的首行(明细只在这一行,断言按它取编号清单——正文别处的编号不算点名)
|
|
1772
1811
|
const acMissingLine = (res) => (res.output.match(/缺 AC 覆盖[^\n]*/u) ?? [''])[0];
|
|
1773
|
-
// WARN COUNT 汇总行读数:内容不可判那一支必须真的进入既有计数(差值断言用,形态同波次判据)
|
|
1774
|
-
const warnCountOf = (res) => {
|
|
1775
|
-
const matched = /WARN COUNT: (\d+)/u.exec(res.output);
|
|
1776
|
-
return matched === null ? 0 : Number(matched[1]);
|
|
1777
|
-
};
|
|
1778
1812
|
// ① 全量覆盖 → 通过(判据不产生输出:缺覆盖报文与「未校验」都不出现)
|
|
1779
1813
|
acWrite(acCriteria(['AC-1', 'AC-2']), ['AC-1', 'AC-2'], true);
|
|
1780
1814
|
const acCovered = runGuard(['exit', 'verify'], dir);
|
|
@@ -1818,20 +1852,12 @@ export const ENTRIES = [
|
|
|
1818
1852
|
assertOut(acNoIds, '给验收准则的每条准则编号');
|
|
1819
1853
|
assertNotOut(acNoIds, '缺 AC 覆盖');
|
|
1820
1854
|
assertNotOut(acNoIds, '未校验(REQUIREMENT 无 AC 编号)');
|
|
1821
|
-
// ④b
|
|
1822
|
-
// 计数差分(判别力):同夹具补上编号且全覆盖后该 WARN 消失,WARN COUNT 恰少 1。
|
|
1855
|
+
// ④b 旧状态带 newChange 字段:同一形态同判 BLOCKED(字段只被忽略,无「旧 change 渐进」侧)
|
|
1823
1856
|
acWrite('- 本段只写散文、不含任何编号。', ['AC-1'], false);
|
|
1824
1857
|
const acNoIdsOld = runGuard(['exit', 'verify'], dir);
|
|
1825
|
-
assertExit(acNoIdsOld,
|
|
1826
|
-
assertOut(acNoIdsOld, '
|
|
1827
|
-
assertOut(acNoIdsOld, '
|
|
1828
|
-
assertOut(acNoIdsOld, 'ALL CHECKS PASSED');
|
|
1829
|
-
acWrite(acCriteria(['AC-1']), ['AC-1'], false);
|
|
1830
|
-
const acNoIdsOldFixed = runGuard(['exit', 'verify'], dir);
|
|
1831
|
-
assertExit(acNoIdsOldFixed, 0);
|
|
1832
|
-
assertTrue(warnCountOf(acNoIdsOld) === warnCountOf(acNoIdsOldFixed) + 1,
|
|
1833
|
-
'内容不可判的 WARN 未计入 WARN COUNT(未校验仍静默): 无编号='
|
|
1834
|
-
+ warnCountOf(acNoIdsOld) + ' 补编号后=' + warnCountOf(acNoIdsOldFixed));
|
|
1858
|
+
assertExit(acNoIdsOld, 1);
|
|
1859
|
+
assertOut(acNoIdsOld, 'BLOCKED: AC 覆盖判据无法执行');
|
|
1860
|
+
assertOut(acNoIdsOld, '没有 AC-N 编号');
|
|
1835
1861
|
// ⑤ TEST.md 缺席 → 与 REQUIREMENT 缺席同口径:**内容不可判**(载体文件被删,新 change
|
|
1836
1862
|
// BLOCKED),不是「未校验」放行。链序同源:AC 覆盖判据排在「## 验证命令」门之前,
|
|
1837
1863
|
// 它一旦拦下,命令门就不会在本次出口说话——「没有清单」是更靠前的那一环。
|
|
@@ -1846,15 +1872,14 @@ export const ENTRIES = [
|
|
|
1846
1872
|
assertNotOut(acNoTest, '缺 AC 覆盖');
|
|
1847
1873
|
// 命令门自身另有断言(系统测试集 H6 的缺段格);此处钉的是链序:AC 判据在它之前发言。
|
|
1848
1874
|
assertNotOut(acNoTest, 'BLOCKED: TEST.md 需声明 ## 验证命令 段');
|
|
1849
|
-
// ⑥
|
|
1875
|
+
// ⑥ 无字段状态同输入 → 同判 BLOCKED(单轨:缺覆盖一律拦,报文点名缺失编号)
|
|
1850
1876
|
acWrite(acCriteria(['AC-1', 'AC-2']), ['AC-1'], false);
|
|
1851
1877
|
const acOldChange = runGuard(['exit', 'verify'], dir);
|
|
1852
|
-
assertExit(acOldChange,
|
|
1853
|
-
assertOut(acOldChange, '
|
|
1878
|
+
assertExit(acOldChange, 1);
|
|
1879
|
+
assertOut(acOldChange, 'BLOCKED');
|
|
1880
|
+
assertOut(acOldChange, '缺 AC 覆盖');
|
|
1854
1881
|
assertTrue(acMissingLine(acOldChange).includes('AC-2'),
|
|
1855
|
-
'
|
|
1856
|
-
assertNotOut(acOldChange, 'BLOCKED');
|
|
1857
|
-
assertOut(acOldChange, 'ALL CHECKS PASSED');
|
|
1882
|
+
'缺覆盖清单应点名缺失编号,实际: ' + acMissingLine(acOldChange));
|
|
1858
1883
|
// ⑦ 书写形态与编号词法:'### AC-N · 标题' 与 '- AC-N: 说明' 两种写法同样解析,同一行的多个编号
|
|
1859
1884
|
// 全部收集;'AC-2a' 这类后缀没有自己的编号,归并到 AC-2(不因后缀漏判)。夹具里 AC-4 只在
|
|
1860
1885
|
// REQUIREMENT 出现、矩阵无对应行 → 只有它缺。段内围栏里的 '## …' 示例不结束本段(围栏内标题
|
|
@@ -1930,20 +1955,12 @@ export const ENTRIES = [
|
|
|
1930
1955
|
assertOut(acNoAcceptanceSection, '形如 AC-1');
|
|
1931
1956
|
assertNotOut(acNoAcceptanceSection, '未校验(REQUIREMENT 无验收准则段)');
|
|
1932
1957
|
assertNotOut(acNoAcceptanceSection, '缺 AC 覆盖');
|
|
1933
|
-
// ⑩b
|
|
1934
|
-
// (判别力):把承载段补回来并覆盖后 WARN 消失,计数恰少 1。
|
|
1958
|
+
// ⑩b 无字段状态走同一份夹具 → 同判 BLOCKED(单轨:承载段缺席一律拦)
|
|
1935
1959
|
writeState(dir, acState(false));
|
|
1936
1960
|
const acNoAcceptanceOld = runGuard(['exit', 'verify'], dir);
|
|
1937
|
-
assertExit(acNoAcceptanceOld,
|
|
1938
|
-
assertOut(acNoAcceptanceOld, '
|
|
1939
|
-
assertOut(acNoAcceptanceOld, '
|
|
1940
|
-
assertOut(acNoAcceptanceOld, 'ALL CHECKS PASSED');
|
|
1941
|
-
acWrite(acCriteria(['AC-1']), ['AC-1'], false);
|
|
1942
|
-
const acNoAcceptanceOldFixed = runGuard(['exit', 'verify'], dir);
|
|
1943
|
-
assertExit(acNoAcceptanceOldFixed, 0);
|
|
1944
|
-
assertTrue(warnCountOf(acNoAcceptanceOld) === warnCountOf(acNoAcceptanceOldFixed) + 1,
|
|
1945
|
-
'承载段缺席的 WARN 未计入 WARN COUNT(删段仍静默): 缺段=' + warnCountOf(acNoAcceptanceOld)
|
|
1946
|
-
+ ' 补段后=' + warnCountOf(acNoAcceptanceOldFixed));
|
|
1961
|
+
assertExit(acNoAcceptanceOld, 1);
|
|
1962
|
+
assertOut(acNoAcceptanceOld, 'BLOCKED: AC 覆盖判据无法执行');
|
|
1963
|
+
assertOut(acNoAcceptanceOld, '定位不到验收准则段');
|
|
1947
1964
|
// ⑪ **与入口同一份选段基准**(AC-4 的判别锚):把模板的验收段改名成不含关键词的标题,模板仍在场 ——
|
|
1948
1965
|
// 选段只能回落到与 open 出口**同一份**回退基准(TEMPLATE_FALLBACK_SECTION_PATTERNS
|
|
1949
1966
|
// 的 requirementAcceptance),于是 verify 出口按入口口径定位到工件的「## 验收准则(AC)」
|
|
@@ -2008,25 +2025,15 @@ export const ENTRIES = [
|
|
|
2008
2025
|
assertOut(acNoRequirement, '恢复: 补回 REQUIREMENT.md');
|
|
2009
2026
|
assertNotOut(acNoRequirement, '未校验(REQUIREMENT 缺席)');
|
|
2010
2027
|
assertNotOut(acNoRequirement, '缺 AC 覆盖');
|
|
2011
|
-
// ⑬b
|
|
2012
|
-
// 模板按登记表的段名书写:AC 判据只在文件在场时读模板,模板段名与登记表不一致会**额外**
|
|
2013
|
-
// 产出一条 TEMPLATE-REGISTRY WARN(只在补回文件那一趟出现),差分因此被它抵消——那条 WARN
|
|
2014
|
-
// 不是本格被测对象,夹具把它消掉,差值才只剩 AC 那一条。
|
|
2028
|
+
// ⑬b 无字段状态同形态:同判 BLOCKED(单轨——删承载文件不能换到「关掉判据」)
|
|
2015
2029
|
writeFile(dir, 'flow-kit/templates/REQUIREMENT.md',
|
|
2016
2030
|
'# REQUIREMENT 模板\n\n## 用户故事(User Story)\n## 验收准则(AC)\n## 范围切分\n'
|
|
2017
2031
|
+ '## 非功能性需求\n## 依赖与假设\n');
|
|
2018
2032
|
writeState(dir, acState(false));
|
|
2019
2033
|
const acNoRequirementOld = runGuard(['exit', 'verify'], dir);
|
|
2020
|
-
assertExit(acNoRequirementOld,
|
|
2021
|
-
assertOut(acNoRequirementOld, '
|
|
2022
|
-
assertOut(acNoRequirementOld, '
|
|
2023
|
-
assertOut(acNoRequirementOld, 'ALL CHECKS PASSED');
|
|
2024
|
-
acWrite(acCriteria(['AC-1']), ['AC-1'], false);
|
|
2025
|
-
const acNoRequirementOldFixed = runGuard(['exit', 'verify'], dir);
|
|
2026
|
-
assertExit(acNoRequirementOldFixed, 0);
|
|
2027
|
-
assertTrue(warnCountOf(acNoRequirementOld) === warnCountOf(acNoRequirementOldFixed) + 1,
|
|
2028
|
-
'载体文件被删的 WARN 未计入 WARN COUNT(删文件仍静默): 缺文件=' + warnCountOf(acNoRequirementOld)
|
|
2029
|
-
+ ' 补文件后=' + warnCountOf(acNoRequirementOldFixed));
|
|
2034
|
+
assertExit(acNoRequirementOld, 1);
|
|
2035
|
+
assertOut(acNoRequirementOld, 'BLOCKED: AC 覆盖判据无法执行');
|
|
2036
|
+
assertOut(acNoRequirementOld, '没有 REQUIREMENT.md');
|
|
2030
2037
|
// ⑭ **围栏里的示例行不算覆盖**:1.1 矩阵段保留围栏内容(段界要跨围栏),但示例行只是书写
|
|
2031
2038
|
// 样例——把 AC-2 / AC-3 写在围栏示例里而真实矩阵只有 AC-1 时,判据必须仍点名缺
|
|
2032
2039
|
// AC-2、AC-3(旧实现全段扫编号,示例行把它读成「覆盖了」= 假绿)。
|
|
@@ -2064,29 +2071,98 @@ export const ENTRIES = [
|
|
|
2064
2071
|
{
|
|
2065
2072
|
name: '22 exit archive WARN:CHANGELOG.md 表格日期非倒序',
|
|
2066
2073
|
run: async (dir) => {
|
|
2074
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/CHANGE.md', intakeChangeText());
|
|
2075
|
+
writeNodeDeclarationMarkers(dir, 'archive');
|
|
2067
2076
|
const st = baseState('archive');
|
|
2068
|
-
st.evidence.archive = { summary: 'archived' };
|
|
2077
|
+
st.evidence.archive = { summary: 'archived', lessonsNomination: { scanned: 0, nominated: [], reasonIfNone: '夹具无候选条目' } };
|
|
2069
2078
|
writeState(dir, st);
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
writeFile(dir, '.specs/
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
assertOut(res, 'WARN: CHANGELOG.md 表格日期非倒序');
|
|
2076
|
-
// 子断言:CHANGELOG 未登记本 change → WARN 渐进(归档收尾登记兜底——
|
|
2077
|
-
// 修复前无检测,执行者遗漏登记可静默进归档,此处应 RED)
|
|
2078
|
-
assertOut(res, '未登记本 change');
|
|
2079
|
-
// 子断言:登记后无未登记 WARN
|
|
2079
|
+
// 归档目录名 = <日期>-<change-id>(运行路径唯一的归档命名规则)——通过的路径必须用合规名,
|
|
2080
|
+
// 非日期名的形态另由本场景末尾的负例断言守住。
|
|
2081
|
+
writeFile(dir, '.specs/archive/2026-10-20-' + CHANGE_ID + '/CHANGE.md', '# CHANGE\n\n## Why\n');
|
|
2082
|
+
writeFile(dir, '.specs/archive/2026-10-20-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# KNOWN-ISSUES\n\n无遗留问题\n');
|
|
2083
|
+
// 子断言:登记(日期倒序、含 change-id)→ 通过且无未登记告警
|
|
2080
2084
|
writeFile(dir, '.specs/CHANGELOG.md', '# CHANGELOG\n\n| 日期 | 说明 |\n|------|------|\n| 2026-08-15 | ' + CHANGE_ID + ' | 归档登记 |\n');
|
|
2081
2085
|
const resRegistered = runGuard(['exit', 'archive'], dir);
|
|
2082
2086
|
assertExit(resRegistered, 0);
|
|
2083
2087
|
assertNotOut(resRegistered, '未登记本 change');
|
|
2088
|
+
// 子断言:表格日期非倒序 → BLOCKED(单一等级)
|
|
2089
|
+
writeFile(dir, '.specs/CHANGELOG.md', '# CHANGELOG\n\n| 日期 | 说明 |\n|------|------|\n| 2026-08-03 | a |\n| 2026-08-04 | b |\n');
|
|
2090
|
+
const resOrder = runGuard(['exit', 'archive'], dir);
|
|
2091
|
+
assertExit(resOrder, 1);
|
|
2092
|
+
assertOut(resOrder, 'BLOCKED: CHANGELOG.md 表格日期非倒序');
|
|
2093
|
+
// 子断言:CHANGELOG 未登记本 change → WARN(归档收尾登记兜底——提示级,不阻断)
|
|
2094
|
+
writeFile(dir, '.specs/CHANGELOG.md', '# CHANGELOG\n\n| 日期 | 说明 |\n|------|------|\n| 2026-08-15 | 其它条目 | 登记 |\n');
|
|
2095
|
+
const resUnregistered = runGuard(['exit', 'archive'], dir);
|
|
2096
|
+
assertExit(resUnregistered, 0);
|
|
2097
|
+
assertOut(resUnregistered, '未登记本 change');
|
|
2084
2098
|
// 子断言:归档缺 KNOWN-ISSUES.md(遗留清单为强制产物)→ BLOCKED
|
|
2085
|
-
fs.rmSync(path.join(dir, '.specs/archive/
|
|
2099
|
+
fs.rmSync(path.join(dir, '.specs/archive/2026-10-20-' + CHANGE_ID, 'KNOWN-ISSUES.md'));
|
|
2086
2100
|
const resMissing = runGuard(['exit', 'archive'], dir);
|
|
2087
2101
|
assertExit(resMissing, 1);
|
|
2088
2102
|
assertOut(resMissing, 'missing Output Schema artifacts');
|
|
2089
2103
|
|
|
2104
|
+
// 子断言(归档目录一条规则 · in-place 扩展):协议通配 `archive/*-<change-id>` 只匹配**合规
|
|
2105
|
+
// 名字**的目录——`<YYYY-MM-DD>-<change-id>`(判据单源 isArchivedChangeDirName)。非日期名
|
|
2106
|
+
// (foo-<id>)既不算「在场」,也不许报成「缺件」:出口当场失败,报文给期望格式 + 实际目录名 +
|
|
2107
|
+
// 可整行照抄的改名命令(路径用与其余报文一致的 .specs/ 相对形态)。
|
|
2108
|
+
writeFile(dir, '.specs/archive/2026-10-20-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# KNOWN-ISSUES\n\n无遗留问题\n');
|
|
2109
|
+
fs.rmSync(path.join(dir, '.specs/archive/2026-10-20-' + CHANGE_ID), { recursive: true, force: true });
|
|
2110
|
+
writeFile(dir, '.specs/archive/foo-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# KNOWN-ISSUES\n\n无遗留问题\n');
|
|
2111
|
+
const resBadName = runGuard(['exit', 'archive'], dir);
|
|
2112
|
+
assertExit(resBadName, 1);
|
|
2113
|
+
assertOut(resBadName, '归档目录名不合规');
|
|
2114
|
+
assertOut(resBadName, 'foo-' + CHANGE_ID);
|
|
2115
|
+
assertOut(resBadName, '<YYYY-MM-DD>-' + CHANGE_ID);
|
|
2116
|
+
assertOut(resBadName, 'mv ".specs/archive/foo-' + CHANGE_ID + '" ".specs/archive/'
|
|
2117
|
+
+ timeUtilsModule.formatLocalDate(new Date()) + '-' + CHANGE_ID + '"');
|
|
2118
|
+
assertNotOut(resBadName, 'missing Output Schema artifacts');
|
|
2119
|
+
// 预检侧同一句(in-place 扩展):结构化预检与出口产物门共用同一条判据与同一句措辞——两个入口
|
|
2120
|
+
// 对同一份盘上事实给出两种说法(一个说缺件、一个说改名)正是本 change 要收掉的分叉。
|
|
2121
|
+
const preflightBadName = runGuard(['exit', 'archive', '--preflight'], dir);
|
|
2122
|
+
assertExit(preflightBadName, 1);
|
|
2123
|
+
assertOut(preflightBadName, '归档目录名不合规');
|
|
2124
|
+
assertOut(preflightBadName, 'mv ".specs/archive/foo-' + CHANGE_ID + '" ".specs/archive/'
|
|
2125
|
+
+ timeUtilsModule.formatLocalDate(new Date()) + '-' + CHANGE_ID + '"');
|
|
2126
|
+
// 子断言(多份错名目录):两份错名目录会拼出同一个目标名——第一条 mv 之后第二条会把源目录
|
|
2127
|
+
// 搬进那个目录之下(不是改名),因此此时只给「先保留一份」的指引,不打印会改变目录结构的命令。
|
|
2128
|
+
writeFile(dir, '.specs/archive/bar-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# KNOWN-ISSUES\n\n无遗留问题\n');
|
|
2129
|
+
const resTwoBadNames = runGuard(['exit', 'archive'], dir);
|
|
2130
|
+
assertExit(resTwoBadNames, 1);
|
|
2131
|
+
assertOut(resTwoBadNames, '归档目录名不合规(2 处)');
|
|
2132
|
+
assertOut(resTwoBadNames, '改名目标相同');
|
|
2133
|
+
assertOut(resTwoBadNames, '按上面的指引处理后');
|
|
2134
|
+
assertNotOut(resTwoBadNames, '改名: mv');
|
|
2135
|
+
fs.rmSync(path.join(dir, '.specs/archive', 'bar-' + CHANGE_ID), { recursive: true, force: true });
|
|
2136
|
+
// 反向构造(单变量 = 只改名):同一目录改成合规名字后同一 exit 通过——判据不是「见归档目录就拦」。
|
|
2137
|
+
fs.renameSync(path.join(dir, '.specs/archive', 'foo-' + CHANGE_ID),
|
|
2138
|
+
path.join(dir, '.specs/archive', '2026-11-11-' + CHANGE_ID));
|
|
2139
|
+
const resRenamed = runGuard(['exit', 'archive'], dir);
|
|
2140
|
+
assertExit(resRenamed, 0);
|
|
2141
|
+
|
|
2142
|
+
// 子断言(真实归档路径 · in-place 扩展):**活动目录已整体搬走** + 归档目录名不合规。上一段的
|
|
2143
|
+
// 夹具里活动目录还在场,提名门按活动目录里的 SUMMARY 份数对账,因而从不触发——真实归档动作
|
|
2144
|
+
// 之后活动目录已不在(整份搬进 archive),此时完整 exit 的首个失败门必须是「归档目录名不合规」
|
|
2145
|
+
// 并给可整行照抄的改名命令,而不是提名门的「工件目录缺失…无从核对扫描份数」(只说没有,不说
|
|
2146
|
+
// 怎么有:同一事实的两种说法,后者不可执行)。
|
|
2147
|
+
const todayPrefix = timeUtilsModule.formatLocalDate(new Date());
|
|
2148
|
+
fs.rmSync(path.join(dir, '.specs/archive/2026-11-11-' + CHANGE_ID), { recursive: true, force: true });
|
|
2149
|
+
fs.renameSync(path.join(dir, '.specs', CHANGE_ID), path.join(dir, '.specs/archive', 'foo-' + CHANGE_ID));
|
|
2150
|
+
writeFile(dir, '.specs/archive/foo-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# KNOWN-ISSUES\n\n无遗留问题\n');
|
|
2151
|
+
const resArchivedBadName = runGuard(['exit', 'archive'], dir);
|
|
2152
|
+
assertExit(resArchivedBadName, 1);
|
|
2153
|
+
assertOut(resArchivedBadName, '归档目录名不合规');
|
|
2154
|
+
assertOut(resArchivedBadName, '.specs/archive/foo-' + CHANGE_ID);
|
|
2155
|
+
assertOut(resArchivedBadName, '<YYYY-MM-DD>-' + CHANGE_ID);
|
|
2156
|
+
assertOut(resArchivedBadName, 'mv ".specs/archive/foo-' + CHANGE_ID + '" ".specs/archive/'
|
|
2157
|
+
+ todayPrefix + '-' + CHANGE_ID + '"');
|
|
2158
|
+
assertNotOut(resArchivedBadName, '工件目录缺失');
|
|
2159
|
+
assertNotOut(resArchivedBadName, '无从核对扫描份数');
|
|
2160
|
+
// 反向构造(单变量 = 只改名):照抄上面的改名命令后同一 exit 通过——恢复动作真的可执行。
|
|
2161
|
+
fs.renameSync(path.join(dir, '.specs/archive', 'foo-' + CHANGE_ID),
|
|
2162
|
+
path.join(dir, '.specs/archive', todayPrefix + '-' + CHANGE_ID));
|
|
2163
|
+
const resArchivedRenamed = runGuard(['exit', 'archive'], dir);
|
|
2164
|
+
assertExit(resArchivedRenamed, 0);
|
|
2165
|
+
|
|
2090
2166
|
// 子断言:结构化预检的**时点分界**。归档产出(.specs/archive/<日期>-<change-id>/)是归档动作
|
|
2091
2167
|
// 自己的产出位置——归档前连 .specs/archive/ 都不存在,把它报成缺件、还让人「先按上述路径创建」,
|
|
2092
2168
|
// 给的是归档前不可能执行的指令(完整出口照旧要求它:那是归档动作做完后的判据,由上面的
|
|
@@ -2131,8 +2207,9 @@ export const ENTRIES = [
|
|
|
2131
2207
|
}],
|
|
2132
2208
|
}, null, 2) + '\n');
|
|
2133
2209
|
const incompleteProtocolPath = path.join(dir, 'reference', 'custom-unspecified-paths.json');
|
|
2134
|
-
//
|
|
2135
|
-
|
|
2210
|
+
// 归档自身的两件必需产物先补齐(归档目录名按唯一规则用 <日期>-<change-id>):单变量 = 唯一
|
|
2211
|
+
// 缺陷就是那件「声明不完整」的产物。
|
|
2212
|
+
writeFile(dir, '.specs/archive/2026-10-20-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# KNOWN-ISSUES\n\n无遗留问题\n');
|
|
2136
2213
|
const exitIncomplete = runGuard(['exit', 'archive', '--protocol', incompleteProtocolPath], dir);
|
|
2137
2214
|
assertExit(exitIncomplete, 1);
|
|
2138
2215
|
const preflightIncomplete = runGuard(
|
|
@@ -2253,6 +2330,7 @@ export const ENTRIES = [
|
|
|
2253
2330
|
writeState(dir, composeState({
|
|
2254
2331
|
currentNode: 'brainstorm',
|
|
2255
2332
|
evidence: { brainstorm: { summary: 'brainstorm done' } },
|
|
2333
|
+
enteredNodes: ['brainstorm'],
|
|
2256
2334
|
}));
|
|
2257
2335
|
writeFile(dir, '.specs/compose-demo/notes.md', '# notes\n'); // brainstorm 产物(artifact 门控)
|
|
2258
2336
|
writeFile(dir, '.specs/compose-demo/CHANGE.md', '# CHANGE\n\n## 变更目标\n\n## 方案\n');
|
|
@@ -2274,6 +2352,7 @@ export const ENTRIES = [
|
|
|
2274
2352
|
writeState(dir, composeState({
|
|
2275
2353
|
currentNode: 'brainstorm',
|
|
2276
2354
|
evidence: { brainstorm: { summary: 'brainstorm done' } },
|
|
2355
|
+
enteredNodes: ['brainstorm'],
|
|
2277
2356
|
}));
|
|
2278
2357
|
writeFile(dir, '.specs/compose-demo/notes.md', '# notes\n');
|
|
2279
2358
|
const res = runGuard(['exit', 'brainstorm'], dir, { FLOW_COMET_PROTOCOL: custom });
|
|
@@ -2288,6 +2367,7 @@ export const ENTRIES = [
|
|
|
2288
2367
|
evidence: { brainstorm: { summary: 'brainstorm done' } },
|
|
2289
2368
|
protocolPath: 'custom-protocol.json',
|
|
2290
2369
|
});
|
|
2370
|
+
bound.enteredNodes = ['brainstorm'];
|
|
2291
2371
|
writeState(dir, bound);
|
|
2292
2372
|
const resBound = runGuard(['exit', 'brainstorm'], dir); // runGuard 默认 env=内置协议副本
|
|
2293
2373
|
assertExit(resBound, 0);
|
|
@@ -2349,6 +2429,7 @@ export const ENTRIES = [
|
|
|
2349
2429
|
writeState(dir, composeState({
|
|
2350
2430
|
currentNode: 'brainstorm',
|
|
2351
2431
|
evidence: { brainstorm: { summary: 'brainstorm done' } },
|
|
2432
|
+
enteredNodes: ['brainstorm'],
|
|
2352
2433
|
}));
|
|
2353
2434
|
writeFile(dir, '.specs/compose-demo/notes.md', '# notes\n');
|
|
2354
2435
|
const res = runGuard(['exit', 'brainstorm', '--protocol', custom], dir);
|
|
@@ -2391,6 +2472,7 @@ export const ENTRIES = [
|
|
|
2391
2472
|
writeState(dir, composeState({
|
|
2392
2473
|
currentNode: 'brainstorm',
|
|
2393
2474
|
evidence: { brainstorm: { summary: 'brainstorm done' } },
|
|
2475
|
+
enteredNodes: ['brainstorm'],
|
|
2394
2476
|
}));
|
|
2395
2477
|
writeFile(dir, '.specs/compose-demo/notes.md', '# notes\n');
|
|
2396
2478
|
writeFile(dir, '.specs/compose-demo/T01-SUMMARY.md', '# T01-SUMMARY\n');
|