flow-comet 1.6.5 → 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 +32 -18
- package/.flow-comet/skills/flow-comet/reference/commit-discipline.md +2 -2
- 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 +30 -11
- 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/context-init.mjs +26 -23
- package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +14 -94
- package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +122 -11
- package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +79 -40
- package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +11 -9
- package/.flow-comet/skills/flow-comet/scripts/items/e.mjs +52 -10
- package/.flow-comet/skills/flow-comet/scripts/items/f.mjs +1 -1
- package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +128 -56
- package/.flow-comet/skills/flow-comet/scripts/items/k.mjs +357 -3
- package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +26 -1
- package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +6 -2
- package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +29 -21
- package/.flow-comet/skills/flow-comet/scripts/lib/ac-coverage.mjs +317 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/fix-loop-node.mjs +4 -15
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-artifact-skeleton.mjs +47 -5
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +357 -219
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +725 -309
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +182 -54
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-state-io.mjs +8 -6
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-template-fidelity.mjs +224 -83
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +17 -28
- package/.flow-comet/skills/flow-comet/scripts/lib/lessons-hits.mjs +160 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/run-root.mjs +21 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/section-body.mjs +92 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-admin.mjs +61 -33
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +663 -205
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-recovery.mjs +68 -9
- package/.flow-comet/skills/flow-comet/scripts/lib/state-determine.mjs +11 -4
- package/.flow-comet/skills/flow-comet/scripts/lib/state-explain.mjs +92 -13
- package/.flow-comet/skills/flow-comet/scripts/lib/state-io.mjs +232 -11
- package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +140 -74
- package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +8 -4
- package/.flow-comet/skills/flow-comet/scripts/lib/task-graph.mjs +84 -31
- package/.flow-comet/skills/flow-comet/scripts/lib/test-assertions.mjs +0 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +248 -24
- package/.flow-comet/skills/flow-comet/scripts/lib/test-helpers.mjs +63 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +181 -8
- package/.flow-comet/skills/flow-comet/scripts/lib/wave-projection.mjs +340 -0
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +132 -20
- package/.flow-comet/skills/flow-comet/scripts/route-node.mjs +12 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +1564 -54
- package/.flow-comet/skills/flow-comet/scripts/scenarios/b.mjs +1489 -38
- package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +1466 -243
- package/.flow-comet/skills/flow-comet/scripts/scenarios/d.mjs +743 -24
- package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +220 -92
- package/.flow-comet/skills/flow-comet/scripts/scenarios/f.mjs +657 -21
- package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +41 -27
- package/.flow-comet/skills/flow-comet/scripts/scenarios/h.mjs +285 -9
- package/.flow-comet/skills/flow-comet/scripts/scenarios/i.mjs +7 -6
- package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +21 -15
- package/.flow-comet/skills/flow-comet/scripts/scenarios/k.mjs +8 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +45 -36
- package/.flow-comet/skills/flow-comet/scripts/scenarios/m.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +2381 -85
- package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +135 -2
- package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +143 -16
- package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +339 -103
- package/.flow-comet/skills/flow-comet/scripts/workflow-state.mjs +5 -2
- 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 +37 -13
- 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 +13 -6
- package/.flow-comet/skills/flow-comet-review/SKILL.md +21 -12
- package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +1 -1
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +43 -18
- package/.flow-comet/skills/flow-comet-task/SKILL.md +4 -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
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import { createHash } from 'crypto';
|
|
13
|
-
import { assertEqual, assertExit, assertNotOut, assertOut, assertTrue, baseState, runGuard, runHandoff, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
|
|
13
|
+
import { assertEqual, assertExit, assertNotOut, assertOut, assertTrue, baseState, installSkillTreeCopy, runGuard, runHandoff, runPrintedCommand, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
|
|
14
14
|
import { archiveRecordJson, multiWaveTaskContent, explainContractProblems, assertExplainFailClosed, explainReverseConstructionProblems, CHANGE_ID, readStateFile, gitInit, gitBranch, writeIntakeArtifacts, fullContract, execSummaryFixture, assertNodeLine, driveThroughDesign } from '../lib/system-fixtures.mjs';
|
|
15
15
|
|
|
16
16
|
// skill-load 的模板声明(节点级,C3/AC-13 加载链):参数化的委托驱动按节点查表——夹具是真实命令
|
|
@@ -30,6 +30,30 @@ function skillLoadArgs(nodeId, skill, prompt) {
|
|
|
30
30
|
return args;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// 协议 requiredSkillCalls 中 enforcement='guarded' 的协调者技能(逐节点查表,与
|
|
34
|
+
// reference/workflow-protocol.json 同值):节点实现技能与必需技能是两个声明面——出口的覆盖判据
|
|
35
|
+
// 要求每份必需技能都有自己的标记,拿实现技能的标记顶替不了。handoff scope 的技能(subagent-execute
|
|
36
|
+
// 的 flow-comet-dev 由子代理加载)不在此表:协调者不加载它,声明它反而是假声明。
|
|
37
|
+
const REQUIRED_SKILL_DECLARATION = {
|
|
38
|
+
plan: { skill: 'flow-comet-task', prompt: 'flow-kit/prompts/3-task.md' },
|
|
39
|
+
execute: { skill: 'flow-comet-dev', prompt: 'flow-kit/prompts/4-dev.md' },
|
|
40
|
+
review: { skill: 'flow-comet-test', prompt: 'flow-kit/prompts/5-test.md' },
|
|
41
|
+
verify: { skill: 'flow-comet-integration', prompt: 'flow-kit/prompts/7-integration.md' },
|
|
42
|
+
archive: { skill: 'flow-comet-integration', prompt: 'flow-kit/prompts/7-integration.md' },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// 节点声明的完整形态(两个多趟驱动共用):实现技能 + 同名的 guarded 必需技能。不共用时两处驱动
|
|
46
|
+
// 各写一遍补声明,下一处需要补的地方又会漏。
|
|
47
|
+
function declareNodeDeclarations(dir, env, nodeId, skill, prompt) {
|
|
48
|
+
assertExit(runState(skillLoadArgs(nodeId, skill, prompt), dir, env), 0);
|
|
49
|
+
const required = REQUIRED_SKILL_DECLARATION[nodeId];
|
|
50
|
+
// 必需技能有自己的协议文件(review 的 flow-comet-test 读 5-test.md)——用实现技能的提示词补声明,
|
|
51
|
+
// 技能面覆盖了但协议文件面仍缺,出口照样拦
|
|
52
|
+
if (required && required.skill !== skill) {
|
|
53
|
+
assertExit(runState(skillLoadArgs(nodeId, required.skill, required.prompt), dir, env), 0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
33
57
|
export const ENTRIES = [
|
|
34
58
|
// ---------- A. 状态机与路由 ----------
|
|
35
59
|
|
|
@@ -72,7 +96,7 @@ export const ENTRIES = [
|
|
|
72
96
|
},
|
|
73
97
|
|
|
74
98
|
{
|
|
75
|
-
name: 'A3 init 同 id
|
|
99
|
+
name: 'A3 init 同 id 重跑:防护提示不阻断;另一 change 在途时默认阻断 + --replace 留档可见',
|
|
76
100
|
run: (dir) => {
|
|
77
101
|
writeFile(dir, 'package.json', '{"name":"x"}');
|
|
78
102
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
@@ -80,6 +104,25 @@ export const ENTRIES = [
|
|
|
80
104
|
assertExit(res, 0);
|
|
81
105
|
assertOut(res, 'WARN: change ' + CHANGE_ID + ' 已存在');
|
|
82
106
|
assertOut(res, '重置节点状态');
|
|
107
|
+
// 另一 change 在途:默认阻断(非零退出 + 点名在途 change + 两条出路),state 字节零改写
|
|
108
|
+
const statePath = path.join(dir, '.flow-comet', 'flow-comet-state.json');
|
|
109
|
+
const before = fs.readFileSync(statePath);
|
|
110
|
+
const blocked = runState(['init', 'next-change'], dir);
|
|
111
|
+
assertExit(blocked, 1);
|
|
112
|
+
assertOut(blocked, 'BLOCKED: 在途 change "' + CHANGE_ID + '" 尚未完成');
|
|
113
|
+
assertOut(blocked, '--replace ' + CHANGE_ID);
|
|
114
|
+
assertOut(blocked, 'workflow-state.mjs" status');
|
|
115
|
+
if (!fs.readFileSync(statePath).equals(before)) throw new Error('默认阻断路径改写了 state 字节');
|
|
116
|
+
// 显式 --replace + --reason:旧状态逐字节留档 + RECOVERY 块可见 + 新 change 正常初始化
|
|
117
|
+
const replaced = runState(['init', 'next-change', '--replace', CHANGE_ID, '--reason', '切换 change'], dir);
|
|
118
|
+
assertExit(replaced, 0);
|
|
119
|
+
assertOut(replaced, 'RECOVERY: 在途 change "' + CHANGE_ID + '" 的状态已留档');
|
|
120
|
+
const snapshotLine = replaced.output.split('\n').find((row) => row.startsWith('RECOVERY: 快照 '));
|
|
121
|
+
if (!snapshotLine) throw new Error('RECOVERY 块缺快照路径:\n' + replaced.output);
|
|
122
|
+
const snapshotPath = path.join(dir, ...snapshotLine.slice('RECOVERY: 快照 '.length).trim().split('/'));
|
|
123
|
+
if (!fs.readFileSync(snapshotPath).equals(before)) throw new Error('留档快照与覆盖前的 state 字节不一致');
|
|
124
|
+
const st = readStateFile(dir);
|
|
125
|
+
if (st.activeChange !== 'next-change') throw new Error('放行后新 change 未初始化: ' + JSON.stringify(st.activeChange));
|
|
83
126
|
},
|
|
84
127
|
},
|
|
85
128
|
|
|
@@ -134,6 +177,8 @@ export const ENTRIES = [
|
|
|
134
177
|
run: (dir) => {
|
|
135
178
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
136
179
|
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
180
|
+
// open 该读两份协议、协议声明两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
181
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
137
182
|
writeIntakeArtifacts(dir);
|
|
138
183
|
assertExit(runState(['record', 'open', '{"summary":"intake complete"}'], dir), 0);
|
|
139
184
|
// 真实出口:exit open --apply(未激活声明机制 → 兼容警告 + 通过)
|
|
@@ -378,6 +423,9 @@ export const ENTRIES = [
|
|
|
378
423
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
|
|
379
424
|
multiWaveTaskContent({ P01: 'pending', P02: 'pending', S01: 'pending', P03: 'pending' }));
|
|
380
425
|
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
426
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):节点实现技能与必需技能是两个声明面,
|
|
427
|
+
// 出口覆盖判据要求后者也有标记。
|
|
428
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
381
429
|
assertExit(runState(['record', 'plan', '{"summary":"plan done"}'], dir), 0);
|
|
382
430
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
383
431
|
const rPlan = runGuard(['exit', 'plan', '--apply'], dir);
|
|
@@ -385,6 +433,39 @@ export const ENTRIES = [
|
|
|
385
433
|
assertOut(rPlan, 'ALL CHECKS PASSED');
|
|
386
434
|
// 首趟路由:首波双并行无前置依赖 → 直接进入委托节点
|
|
387
435
|
assertOut(rPlan, 'NODE: subagent-execute');
|
|
436
|
+
// 委托前置门的声明命令必须照抄可执行:解析打印文本 → 真执行 → 再 request 通过。旧形态是
|
|
437
|
+
// 「workflow-state.mjs skill-load <node> <skill>」——裸脚本名在 shell 里 command not found,
|
|
438
|
+
// `<skill>` 占位在 bash 下是重定向,且不带该节点全部 --prompt / --templates / --protocol,
|
|
439
|
+
// 字面断言钉不住「这条命令能不能用」。同一次 request 还断言开工前 LESSONS 命中集的围栏口径:
|
|
440
|
+
// 围栏里的书写样例不是真条目(围栏判定与段体单源同口径),围栏外的条目照常命中。
|
|
441
|
+
writeFile(dir, '.specs/LESSONS.md',
|
|
442
|
+
'# LESSONS\n\n## 条目区\n\n~~~md\n### L-901 · [proc] 围栏内的书写样例\n- **关键词**: p01 委托边界\n~~~\n\n'
|
|
443
|
+
+ '### L-902 · [proc] 委托边界须留痕\n- **关键词**: p01\n');
|
|
444
|
+
const gatedRequest = runHandoff(['request', 'P01', 'P01 委托'], dir);
|
|
445
|
+
assertExit(gatedRequest, 1);
|
|
446
|
+
assertOut(gatedRequest, 'BLOCKED: 节点 subagent-execute 缺少技能加载声明标记');
|
|
447
|
+
assertNotOut(gatedRequest, 'HANDOFF REQUEST');
|
|
448
|
+
const declarationCommand = (gatedRequest.output.match(/^\s*(node "[^"]+" skill-load [^\n]+)$/m) || [])[1];
|
|
449
|
+
assertTrue(typeof declarationCommand === 'string',
|
|
450
|
+
'委托前置门的阻塞必须给出完整可执行命令(node "<脚本路径>" skill-load …):\n' + gatedRequest.output);
|
|
451
|
+
// 打印命令按安装布局的执行面解析(脚本根是运行根相对形态):先把技能树复制成安装副本,
|
|
452
|
+
// 再真跑打印文本——执行的是打印出来的脚本路径与参数,不是 harness 自己的绝对路径。
|
|
453
|
+
installSkillTreeCopy(dir, path.join('.claude', 'skills'));
|
|
454
|
+
const replayedDeclaration = runPrintedCommand(declarationCommand, dir,
|
|
455
|
+
{ FLOW_COMET_RUN_ROOT: dir, FLOW_COMET_PROTOCOL: '' });
|
|
456
|
+
assertTrue(replayedDeclaration.status === 0,
|
|
457
|
+
'照抄的声明命令跑不通\n 命令: ' + declarationCommand
|
|
458
|
+
+ '\n exit ' + replayedDeclaration.status + '\n' + replayedDeclaration.output);
|
|
459
|
+
const declaredRequest = runHandoff(['request', 'P01', 'P01 委托'], dir);
|
|
460
|
+
assertExit(declaredRequest, 0);
|
|
461
|
+
assertOut(declaredRequest, 'HANDOFF REQUEST: P01');
|
|
462
|
+
assertOut(declaredRequest, 'LESSONS-HITS: 1 条');
|
|
463
|
+
assertOut(declaredRequest, 'L-902');
|
|
464
|
+
assertNotOut(declaredRequest, 'L-901');
|
|
465
|
+
// 这一格考的是开工前打印面(命中集 + 围栏判定)。出口侧的「逐条回应」判据按**任务写面**算命中,
|
|
466
|
+
// 本夹具的 L-902 只会落在 P01 的扫描段上——留着教训册就要把 A13 后续每份 SUMMARY 的措辞一并改写,
|
|
467
|
+
// 而那条判据另有场景逐格考(含缺回应 / 围栏内回应)。断言完成后撤掉夹具,A13 其余步骤保持原基线。
|
|
468
|
+
fs.rmSync(path.join(dir, '.specs', 'LESSONS.md'), { force: true });
|
|
388
469
|
// 两层加载模型:执行域两节点的手动声明标记(record 前置门;一次声明后续趟次复用)
|
|
389
470
|
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
390
471
|
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
@@ -503,6 +584,9 @@ export const ENTRIES = [
|
|
|
503
584
|
'<task id="X2" parallel="true" status="pending"><action>实现 X2</action><write_files>src/x2.mjs</write_files><verify>node --check src/x2.mjs</verify><depends_on>X1</depends_on></task>\n';
|
|
504
585
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + cyclic);
|
|
505
586
|
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
587
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):节点实现技能与必需技能是两个声明面,
|
|
588
|
+
// 出口覆盖判据要求后者也有标记。
|
|
589
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
506
590
|
assertExit(runState(['record', 'plan', '{"summary":"plan drafted"}'], dir), 0);
|
|
507
591
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
508
592
|
const blocked = runGuard(['exit', 'plan', '--apply'], dir);
|
|
@@ -560,7 +644,7 @@ export const ENTRIES = [
|
|
|
560
644
|
// next 对「currentNode 无 evidence 且非固定路由后继」的委托跳转态按正常推进豁免不放行,
|
|
561
645
|
// 仅断言 guard 侧 NODE;直接后继/回流态(next 可确认)才做双侧收敛断言。
|
|
562
646
|
const drive = (nodeId, skill, prompt, prepare, { expectedNode, converge = true } = {}) => {
|
|
563
|
-
|
|
647
|
+
declareNodeDeclarations(dir, env, nodeId, skill, prompt);
|
|
564
648
|
prepare();
|
|
565
649
|
assertExit(runGuard(['entry', nodeId], dir), 0);
|
|
566
650
|
const res = runGuard(['exit', nodeId, '--apply'], dir);
|
|
@@ -625,6 +709,8 @@ export const ENTRIES = [
|
|
|
625
709
|
}, { expectedNode: 'archive', converge: true });
|
|
626
710
|
// 归档出口:两侧均 NEXT: done
|
|
627
711
|
assertExit(runState(['skill-load', 'archive', 'flow-comet-archive', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
712
|
+
// 协议 archive.requiredSkillCalls = flow-comet-integration(guarded):出口覆盖判据要求该技能也有标记
|
|
713
|
+
assertExit(runState(['skill-load', 'archive', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
628
714
|
writeFile(dir, '.specs/archive/2026-08-28-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# 遗留问题\n\n无。\n');
|
|
629
715
|
// 归档提名随证据落盘:本 change 写了 6 份任务 SUMMARY(并行 4 份 + 串行 2 份,扫描份数按
|
|
630
716
|
// 同一清单对账)。提名门缺字段即拦,与本条被测的路由收敛判据无关。
|
|
@@ -657,6 +743,9 @@ export const ENTRIES = [
|
|
|
657
743
|
const exitPlanNoApply = () => runGuard(['exit', 'plan'], dir, planEnv);
|
|
658
744
|
const exitPlanApply = () => runGuard(['exit', 'plan', '--apply'], dir, planEnv);
|
|
659
745
|
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
746
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):节点实现技能与必需技能是两个声明面,
|
|
747
|
+
// 出口覆盖判据要求后者也有标记。
|
|
748
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
660
749
|
assertExit(runState(['record', 'plan', '{"summary":"plan drafted"}'], dir), 0);
|
|
661
750
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
662
751
|
const planTask = (taskBody) => writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + taskBody);
|
|
@@ -714,6 +803,18 @@ export const ENTRIES = [
|
|
|
714
803
|
assertExit(globRecovered, 0);
|
|
715
804
|
assertOut(globRecovered, 'ALL CHECKS PASSED');
|
|
716
805
|
assertNotOut(globRecovered, 'BLOCKED');
|
|
806
|
+
// 写面判定的元素名大小写无关:`<WRITE_FILES>` 与 `<write_files>` 是同一种元素——7 字段门按
|
|
807
|
+
// 大小写不敏感判定在场,而「这份写面算不算有内容」的判据若只认小写,大写写法的任务就被静默
|
|
808
|
+
// 排除在 [P] 补集判据之外:同波同层、写面互不重叠的一对永远不被要求标 parallel(判据在场才判,
|
|
809
|
+
// 判据缺席就是放行)。
|
|
810
|
+
planTask(
|
|
811
|
+
'## 波次划分\n\nWave 1: U01, U02\n\n## 任务清单\n\n'
|
|
812
|
+
+ '<task id="U01" status="pending"><action>实现 U01</action><WRITE_FILES>src/u01.mjs</WRITE_FILES><verify>node --check src/u01.mjs</verify></task>\n'
|
|
813
|
+
+ '<task id="U02" status="pending"><action>实现 U02</action><WRITE_FILES>src/u02.mjs</WRITE_FILES><verify>node --check src/u02.mjs</verify></task>\n');
|
|
814
|
+
const upperCaseWriteFiles = exitPlanNoApply();
|
|
815
|
+
assertExit(upperCaseWriteFiles, 1);
|
|
816
|
+
assertOut(upperCaseWriteFiles, '同波任务可并行却未标 [P]');
|
|
817
|
+
assertOut(upperCaseWriteFiles, 'U01 × U02');
|
|
717
818
|
// 同一文件跨任务族(负例):两个非修复任务写入同一文件、彼此无依赖路径(串行拆分同样构成
|
|
718
819
|
// 「未显式排序的同文件多任务」)→ 新 change BLOCKED,消息含任务对与重叠文件 + 恢复指引。
|
|
719
820
|
// 同夹具并列一对修复任务(id 带修复前缀)写同一文件且无依赖路径——该族不参与判定,
|
|
@@ -759,18 +860,16 @@ export const ENTRIES = [
|
|
|
759
860
|
assertExit(fixSectionRes, 0);
|
|
760
861
|
assertNotOut(fixSectionRes, '同文件跨任务且无依赖路径');
|
|
761
862
|
assertNotOut(fixSectionRes, 'BLOCKED');
|
|
762
|
-
//
|
|
863
|
+
// 同一形态(无任何新旧标记字段):同判 BLOCKED(单轨,无渐进放行侧),恢复指引仍在
|
|
763
864
|
planTask(C1 + sameFilePairNoDeps + fixPair);
|
|
764
865
|
const sameFileState = readStateFile(dir);
|
|
765
|
-
delete sameFileState.newChange;
|
|
766
866
|
writeState(dir, sameFileState);
|
|
767
867
|
const sameFileWarn = exitPlanNoApply();
|
|
768
|
-
assertExit(sameFileWarn,
|
|
769
|
-
assertOut(sameFileWarn, '
|
|
770
|
-
assertOut(sameFileWarn, '同文件跨任务且无依赖路径');
|
|
868
|
+
assertExit(sameFileWarn, 1);
|
|
869
|
+
assertOut(sameFileWarn, 'BLOCKED: TASK.md 同文件跨任务且无依赖路径');
|
|
771
870
|
assertOut(sameFileWarn, 'X1×X2');
|
|
772
|
-
|
|
773
|
-
writeState(dir, { ...sameFileState
|
|
871
|
+
assertOut(sameFileWarn, '恢复');
|
|
872
|
+
writeState(dir, { ...sameFileState });
|
|
774
873
|
// 恢复:按指引补显式 depends_on,且 **P02 保持写原重叠路径 bak_a.txt**
|
|
775
874
|
// (不改路径避开重叠)——证明「补 depends_on 解决原重叠」而非「改路径避开重叠」;补依赖后
|
|
776
875
|
// P02 跨趟(dep 未满足,不在本趟可运行集合)→ 同波次并行对只剩 P01 → 重叠消失 → 同出口通过。
|
|
@@ -820,7 +919,7 @@ export const ENTRIES = [
|
|
|
820
919
|
};
|
|
821
920
|
// drive 收敛面全量:每个转换点(含平行跳转与趟间回流)都断言 next 可达且与 guard 出口 NODE 一致
|
|
822
921
|
const drive = (nodeId, skill, prompt, prepare, { expectedNode } = {}) => {
|
|
823
|
-
|
|
922
|
+
declareNodeDeclarations(dir, env, nodeId, skill, prompt);
|
|
824
923
|
prepare();
|
|
825
924
|
assertExit(runGuard(['entry', nodeId], dir), 0);
|
|
826
925
|
const res = runGuard(['exit', nodeId, '--apply'], dir);
|
|
@@ -884,6 +983,8 @@ export const ENTRIES = [
|
|
|
884
983
|
}, { expectedNode: 'archive' });
|
|
885
984
|
// 归档出口:两侧均 NEXT: done
|
|
886
985
|
assertExit(runState(['skill-load', 'archive', 'flow-comet-archive', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
986
|
+
// 协议 archive.requiredSkillCalls = flow-comet-integration(guarded):出口覆盖判据要求该技能也有标记
|
|
987
|
+
assertExit(runState(['skill-load', 'archive', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
887
988
|
writeFile(dir, '.specs/archive/2026-08-28-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# 遗留问题\n\n无。\n');
|
|
888
989
|
// 归档提名随证据落盘:本 change 写了 6 份任务 SUMMARY(并行 4 份 + 串行 2 份,扫描份数按
|
|
889
990
|
// 同一清单对账)。提名门缺字段即拦,与本条被测的路由收敛判据无关。
|
|
@@ -918,6 +1019,8 @@ export const ENTRIES = [
|
|
|
918
1019
|
driveThroughDesign(dir);
|
|
919
1020
|
writeTask({ S01: 'pending' });
|
|
920
1021
|
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
1022
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):出口覆盖判据要求该技能也有标记
|
|
1023
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
921
1024
|
assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
|
|
922
1025
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
923
1026
|
assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
|
|
@@ -925,6 +1028,8 @@ export const ENTRIES = [
|
|
|
925
1028
|
writeTask({ S01: 'done' });
|
|
926
1029
|
writeFile(dir, '.specs/' + CHANGE_ID + '/S01-SUMMARY.md', execSummaryFixture('S01'));
|
|
927
1030
|
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
1031
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
1032
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
928
1033
|
assertExit(runState(['record', 'execute', '{"summary":"executed","parallelTakeoverApproved":true}'], dir, env), 0);
|
|
929
1034
|
assertExit(runGuard(['entry', 'execute'], dir), 0);
|
|
930
1035
|
// R-1 欠账漂移态:currentNode 漂移到文件推导下一节点 review(execute 未 completed)
|
|
@@ -964,6 +1069,8 @@ export const ENTRIES = [
|
|
|
964
1069
|
driveThroughDesign(dir);
|
|
965
1070
|
writeTask({ P01: 'pending', S01: 'pending' });
|
|
966
1071
|
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
1072
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):出口覆盖判据要求该技能也有标记
|
|
1073
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
967
1074
|
assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
|
|
968
1075
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
969
1076
|
assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
|
|
@@ -1019,6 +1126,8 @@ export const ENTRIES = [
|
|
|
1019
1126
|
driveThroughDesign(dir);
|
|
1020
1127
|
writeTask({ S01: 'pending' });
|
|
1021
1128
|
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
1129
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):出口覆盖判据要求该技能也有标记
|
|
1130
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
1022
1131
|
assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
|
|
1023
1132
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
1024
1133
|
assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
|
|
@@ -1026,6 +1135,8 @@ export const ENTRIES = [
|
|
|
1026
1135
|
writeTask({ S01: 'done' });
|
|
1027
1136
|
writeFile(dir, '.specs/' + CHANGE_ID + '/S01-SUMMARY.md', execSummaryFixture('S01'));
|
|
1028
1137
|
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
1138
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
1139
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
1029
1140
|
assertExit(runState(['record', 'execute', '{"summary":"executed"}'], dir, env), 0);
|
|
1030
1141
|
assertExit(runGuard(['entry', 'execute'], dir), 0);
|
|
1031
1142
|
// 执行者自切 direct(directOverride=true 但无授权审计记录——B 方案前的自切/遗留形态)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import path from 'path';
|
|
8
|
-
import { assertExit, assertNotOut, assertOut, runGuard, runHandoff, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
|
|
8
|
+
import { assertExit, assertNotOut, assertOut, assertTrue, installSkillTreeCopy, runGuard, runHandoff, runPrintedCommand, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
|
|
9
9
|
import { serialTaskBlock, fixBatchParallelTaskText, fixBatchTwoFixTaskText, fixBatchHistoryWithStaleExecuteExit, writeFixBatchFixture, CHANGE_ID, readStateFile, writeIntakeArtifacts, fullContract, execSummaryFixture, fixBatchReviewDoc, completeFixTaskAndRecord, assertNodeLine, assertNotNodeLine } from '../lib/system-fixtures.mjs';
|
|
10
10
|
|
|
11
11
|
export const ENTRIES = [
|
|
@@ -20,6 +20,7 @@ export const ENTRIES = [
|
|
|
20
20
|
run: (dir) => {
|
|
21
21
|
const env = { FLOW_COMET_PROTOCOL: path.join(dir, 'reference', 'workflow-protocol.json') };
|
|
22
22
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
23
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
23
24
|
|
|
24
25
|
// ① 旧绕过路径:Fix 任务仍 pending 时直接 exit review --apply → 新 change BLOCKED + 恢复指引
|
|
25
26
|
const bypass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
@@ -87,6 +88,9 @@ export const ENTRIES = [
|
|
|
87
88
|
|
|
88
89
|
// ⑤ 回源 review 出口门禁真实执行:缺处置标记 → BLOCKED;补齐后同出口通过并推进 verify
|
|
89
90
|
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
91
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
92
|
+
// 出口覆盖判据要求全部声明
|
|
93
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
90
94
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
91
95
|
writeFile(dir, '.specs/' + CHANGE_ID + '/REVIEW.md', fixBatchReviewDoc(false));
|
|
92
96
|
const gate = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
@@ -125,6 +129,7 @@ export const ENTRIES = [
|
|
|
125
129
|
const env = { FLOW_COMET_PROTOCOL: path.join(dir, 'reference', 'workflow-protocol.json') };
|
|
126
130
|
const gateMarker = path.join(dir, 'verify-gate-ran.txt');
|
|
127
131
|
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending' });
|
|
132
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
128
133
|
|
|
129
134
|
// ① 旧绕过路径:pending 修复任务时直接 exit verify --apply → BLOCKED,且验证命令未被执行
|
|
130
135
|
const bypass = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
@@ -177,6 +182,8 @@ export const ENTRIES = [
|
|
|
177
182
|
|
|
178
183
|
// ⑤ 回源 verify 出口真实执行:验证命令落盘 + 推进 archive
|
|
179
184
|
assertExit(runState(['skill-load', 'verify', 'flow-comet-verify', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
185
|
+
// 协议 verify.requiredSkillCalls = flow-comet-integration(guarded):同一份协议文件、另一个技能面
|
|
186
|
+
assertExit(runState(['skill-load', 'verify', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
180
187
|
assertExit(runGuard(['entry', 'verify'], dir, env), 0);
|
|
181
188
|
const vf = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
182
189
|
assertExit(vf, 0);
|
|
@@ -192,14 +199,14 @@ export const ENTRIES = [
|
|
|
192
199
|
},
|
|
193
200
|
},
|
|
194
201
|
{
|
|
195
|
-
// 越界拦截 + done-but-unclosed 回放 +
|
|
202
|
+
// 越界拦截 + done-but-unclosed 回放 + 旧态同判(真实命令链路):
|
|
196
203
|
// ① 新 change review/pending → BLOCKED + state 不变;
|
|
197
204
|
// ② 事故回放——Fix 任务全 done 但 history 最新 exit execute 签名仍是追加前值
|
|
198
205
|
// (从未重跑 execute 出口)→ 同出口 BLOCKED + state 字节零改写(修复前被错误断言为通过);
|
|
199
206
|
// ③ 正对照——按指引 entry execute + exit execute --apply 真闭合后,review 出口通过;
|
|
200
207
|
// ④⑤ verify 源 pending / done-but-unclosed 同样 BLOCKED 且验证命令不执行,⑥ 闭合后通过;
|
|
201
|
-
// ⑦⑧⑨
|
|
202
|
-
name: 'A23 Fix
|
|
208
|
+
// ⑦⑧⑨ 同一形态(无任何新旧标记字段)同判 BLOCKED、next 归位可达、验证出口真实执行。
|
|
209
|
+
name: 'A23 Fix 越界拦截与旧态容忍:源节点直接 exit 一律 BLOCK 不卡死,next 归位可达(真实命令)',
|
|
203
210
|
run: (dir) => {
|
|
204
211
|
const env = { FLOW_COMET_PROTOCOL: path.join(dir, 'reference', 'workflow-protocol.json') };
|
|
205
212
|
const gateMarker = path.join(dir, 'verify-gate-ran.txt');
|
|
@@ -207,6 +214,7 @@ export const ENTRIES = [
|
|
|
207
214
|
|
|
208
215
|
// ① 新 change review 源 + pending:直接 exit review --apply → BLOCKED + 恢复指引 + state 不变
|
|
209
216
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
217
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
210
218
|
const rBlock = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
211
219
|
assertExit(rBlock, 1);
|
|
212
220
|
assertOut(rBlock, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
@@ -223,6 +231,7 @@ export const ENTRIES = [
|
|
|
223
231
|
// ② 事故回放形态:Fix 任务已全 done,但 history 最新 exit execute 记录的是追加前签名
|
|
224
232
|
//(done 后从未再跑 execute 出口)→ 修复前静默放行,修复后必须 BLOCKED + state 字节零改写
|
|
225
233
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'done' });
|
|
234
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
226
235
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
227
236
|
const doneUnclosed = readStateFile(dir);
|
|
228
237
|
doneUnclosed.history = fixBatchHistoryWithStaleExecuteExit();
|
|
@@ -248,6 +257,9 @@ export const ENTRIES = [
|
|
|
248
257
|
assertNotOut(rClosedExit, 'RETURN: 回源节点');
|
|
249
258
|
assertNodeLine(rClosedExit, 'review');
|
|
250
259
|
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
260
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
261
|
+
// 出口覆盖判据要求全部声明
|
|
262
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
251
263
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
252
264
|
const rReviewPass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
253
265
|
assertExit(rReviewPass, 0);
|
|
@@ -259,6 +271,7 @@ export const ENTRIES = [
|
|
|
259
271
|
// 直接 exit review BLOCKED;next 归位 subagent-execute;完成委托后第二趟
|
|
260
272
|
// exit subagent-execute --apply 回源 review;源节点出口真实执行并推进 verify。
|
|
261
273
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending', parallelFix: true });
|
|
274
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
262
275
|
const pBypass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
263
276
|
assertExit(pBypass, 1);
|
|
264
277
|
assertOut(pBypass, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
@@ -297,6 +310,9 @@ export const ENTRIES = [
|
|
|
297
310
|
throw new Error('并行修复第二趟出口应回源 review,实际 ' + JSON.stringify(pSt.currentNode));
|
|
298
311
|
}
|
|
299
312
|
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
313
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
314
|
+
// 出口覆盖判据要求全部声明
|
|
315
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
300
316
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
301
317
|
const pReviewPass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
302
318
|
assertExit(pReviewPass, 0);
|
|
@@ -305,6 +321,7 @@ export const ENTRIES = [
|
|
|
305
321
|
// ④ 新 change verify 源 + pending:直接 exit verify --apply → BLOCKED,验证命令未执行
|
|
306
322
|
fs.rmSync(gateMarker, { force: true });
|
|
307
323
|
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending' });
|
|
324
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
308
325
|
const vBlock = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
309
326
|
assertExit(vBlock, 1);
|
|
310
327
|
assertOut(vBlock, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
@@ -320,6 +337,7 @@ export const ENTRIES = [
|
|
|
320
337
|
//(原路径会跳过 verify 去 archive)+ 全 done + 最新 execute exit 签名过时 → BLOCKED,验证命令
|
|
321
338
|
// 不执行、state 字节零改写;⑥ 按指引闭合后 exit verify 真实执行验证命令并推进 archive
|
|
322
339
|
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'done' });
|
|
340
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
323
341
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
324
342
|
const verifyDoneUnclosed = readStateFile(dir);
|
|
325
343
|
verifyDoneUnclosed.history = fixBatchHistoryWithStaleExecuteExit();
|
|
@@ -342,6 +360,8 @@ export const ENTRIES = [
|
|
|
342
360
|
assertNotOut(vClosedExit, 'RETURN: 回源节点');
|
|
343
361
|
assertNodeLine(vClosedExit, 'verify');
|
|
344
362
|
assertExit(runState(['skill-load', 'verify', 'flow-comet-verify', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
363
|
+
// 协议 verify.requiredSkillCalls = flow-comet-integration(guarded):同一份协议文件、另一个技能面
|
|
364
|
+
assertExit(runState(['skill-load', 'verify', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
345
365
|
assertExit(runGuard(['entry', 'verify'], dir, env), 0);
|
|
346
366
|
const vPass = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
347
367
|
assertExit(vPass, 0);
|
|
@@ -351,21 +371,18 @@ export const ENTRIES = [
|
|
|
351
371
|
throw new Error('闭合后 verify 出口未真实执行 TEST.md 验证命令(副作用文件缺失/内容不符)');
|
|
352
372
|
}
|
|
353
373
|
|
|
354
|
-
// ⑦
|
|
355
|
-
|
|
374
|
+
// ⑦ 同一形态(无任何新旧标记字段)review 源 + pending:同判 BLOCKED(单轨,无渐进放行)
|
|
375
|
+
// (前序 ①~⑥ 已消耗归位轮次;本段测的是「直接 exit 源节点」这一门,先把轮次计数清零)
|
|
376
|
+
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
377
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
356
378
|
const oldExit = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
357
|
-
assertExit(oldExit,
|
|
358
|
-
assertOut(oldExit, '
|
|
359
|
-
assertNotOut(oldExit, '
|
|
360
|
-
assertOut(oldExit, 'ALL CHECKS PASSED');
|
|
361
|
-
assertNodeLine(oldExit, 'execute'); // pending 修复任务使路由继续回 execute(流程未卡死)
|
|
362
|
-
st = readStateFile(dir);
|
|
363
|
-
if (st.currentNode !== 'execute') {
|
|
364
|
-
throw new Error('旧 change 渐进放行后 currentNode 应为 execute,实际 ' + JSON.stringify(st.currentNode));
|
|
365
|
-
}
|
|
379
|
+
assertExit(oldExit, 1);
|
|
380
|
+
assertOut(oldExit, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
381
|
+
assertNotOut(oldExit, 'ALL CHECKS PASSED');
|
|
366
382
|
|
|
367
|
-
// ⑧
|
|
368
|
-
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending'
|
|
383
|
+
// ⑧ 同一形态 next 入口:pending 修复 + 源节点驻留 → next 仍归位 execute(路由不受分级影响)
|
|
384
|
+
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
385
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
369
386
|
const oldNext = runState(['next'], dir, env);
|
|
370
387
|
assertExit(oldNext, 0);
|
|
371
388
|
assertNotOut(oldNext, 'BLOCKED');
|
|
@@ -376,22 +393,19 @@ export const ENTRIES = [
|
|
|
376
393
|
throw new Error('旧 change next 归位后 currentNode 应为 execute,实际 ' + JSON.stringify(st.currentNode));
|
|
377
394
|
}
|
|
378
395
|
|
|
379
|
-
// ⑨
|
|
396
|
+
// ⑨ 同一形态 verify 源 + pending:同判 BLOCKED(单轨),验证命令不执行(拦截早于命令)
|
|
380
397
|
fs.rmSync(gateMarker, { force: true });
|
|
381
|
-
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending'
|
|
398
|
+
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending' });
|
|
399
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
382
400
|
const oldVerify = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
383
|
-
assertExit(oldVerify,
|
|
384
|
-
assertOut(oldVerify, '
|
|
385
|
-
assertNotOut(oldVerify, '
|
|
386
|
-
assertOut(oldVerify, 'ALL CHECKS PASSED');
|
|
387
|
-
assertNodeLine(oldVerify, 'execute'); // pending 修复任务使路由继续回 execute
|
|
388
|
-
if (!fs.existsSync(gateMarker) || fs.readFileSync(gateMarker, 'utf8') !== 'GATE-RAN') {
|
|
389
|
-
throw new Error('旧 change verify 出口未真实执行 TEST.md 验证命令(渐进不等于跳过门禁)');
|
|
390
|
-
}
|
|
401
|
+
assertExit(oldVerify, 1);
|
|
402
|
+
assertOut(oldVerify, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
403
|
+
assertNotOut(oldVerify, 'ALL CHECKS PASSED');
|
|
391
404
|
|
|
392
405
|
// ⑩ 多波次真实 Fix:第一波收口后追加第二波;第三趟收口时历史最新签名已等于当前签名、
|
|
393
406
|
// 更早签名仍发散——全量签名扫描不得被最新签名覆盖,仍须保留 FIX-BATCH 锚。
|
|
394
407
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
408
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
395
409
|
assertExit(runState(['next'], dir, env), 0); // 受控归位 execute
|
|
396
410
|
completeFixTaskAndRecord(dir, env); // 第一波:单修复任务 done + 声明/record
|
|
397
411
|
const wave1 = runGuard(['exit', 'execute', '--apply'], dir, env);
|
|
@@ -408,6 +422,8 @@ export const ENTRIES = [
|
|
|
408
422
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
409
423
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-02-SUMMARY.md', execSummaryFixture('T-FIX-02'));
|
|
410
424
|
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
425
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
426
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
411
427
|
assertExit(runState(['record', 'execute', '{"summary":"fix wave two executed","parallelTakeoverApproved":true}'], dir, env), 0);
|
|
412
428
|
const wave2 = runGuard(['exit', 'execute', '--apply'], dir, env);
|
|
413
429
|
assertExit(wave2, 0);
|
|
@@ -438,6 +454,7 @@ export const ENTRIES = [
|
|
|
438
454
|
|
|
439
455
|
// ⑪ 源未 entry 的真实 Fix:分类只认历史签名/Fix 结构标记,不依赖 enteredNodes → 仍 FIX-BATCH
|
|
440
456
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
457
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
441
458
|
const noEntryState = readStateFile(dir);
|
|
442
459
|
noEntryState.enteredNodes = (noEntryState.enteredNodes || []).filter((nodeId) => nodeId !== 'review');
|
|
443
460
|
writeState(dir, noEntryState);
|
|
@@ -467,6 +484,8 @@ export const ENTRIES = [
|
|
|
467
484
|
directOverride: false,
|
|
468
485
|
});
|
|
469
486
|
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
487
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
488
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
470
489
|
assertExit(runState(['record', 'execute', '{"summary":"legacy state closure","parallelTakeoverApproved":true}'], dir, env), 0);
|
|
471
490
|
const legacyExit = runGuard(['exit', 'execute', '--apply'], dir, env);
|
|
472
491
|
assertExit(legacyExit, 0);
|
|
@@ -479,9 +498,9 @@ export const ENTRIES = [
|
|
|
479
498
|
throw new Error('旧态未分类回程应停在 review: ' + JSON.stringify(legacyState.currentNode));
|
|
480
499
|
}
|
|
481
500
|
|
|
482
|
-
// ⑬ 受控归位轮次真实链路(review 源):第 1~3 轮输出「第 n/3 轮」并递增计数;第 4
|
|
483
|
-
//
|
|
484
|
-
// 后放行;verify
|
|
501
|
+
// ⑬ 受控归位轮次真实链路(review 源):第 1~3 轮输出「第 n/3 轮」并递增计数;第 4 轮
|
|
502
|
+
// BLOCK(state 字节零改写、currentNode 保持 review);用户显式授权(嵌套证据)
|
|
503
|
+
// 后放行;verify 失败计数与轮次计数各自独立;同一形态第 4 轮同判 BLOCKED。
|
|
485
504
|
const fixRoundsText = (statuses) => '# TASK\n\n## 任务清单\n\n' + serialTaskBlock('T01', 'done')
|
|
486
505
|
+ '\n\n## Fix 任务(来自 REVIEW / INTEGRATION)\n\n'
|
|
487
506
|
+ statuses.map((s, i) => serialTaskBlock('T-FIX-0' + (i + 1), s)).join('\n') + '\n';
|
|
@@ -501,6 +520,8 @@ export const ENTRIES = [
|
|
|
501
520
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-0' + i + '-SUMMARY.md', execSummaryFixture('T-FIX-0' + i));
|
|
502
521
|
}
|
|
503
522
|
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
523
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
524
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
504
525
|
// entry 记录 taskHash:签名值必须带算法版本前缀(新链路 vN 前缀形态)
|
|
505
526
|
assertExit(runGuard(['entry', 'execute'], dir, env), 0);
|
|
506
527
|
const stHash = readStateFile(dir);
|
|
@@ -523,6 +544,7 @@ export const ENTRIES = [
|
|
|
523
544
|
};
|
|
524
545
|
|
|
525
546
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
547
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
526
548
|
// verify 失败计数先落到 2——后续 4 轮归位都不得触碰该值
|
|
527
549
|
assertExit(runState(['verify-fail'], dir, env), 0);
|
|
528
550
|
const vfTwo = runState(['verify-fail'], dir, env);
|
|
@@ -599,25 +621,25 @@ export const ENTRIES = [
|
|
|
599
621
|
if (readStateFile(dir).fixRoundsByChange?.ch !== 4) {
|
|
600
622
|
throw new Error('verify 失败累计不得改写 Fix 轮次计数: ' + JSON.stringify(readStateFile(dir).fixRoundsByChange));
|
|
601
623
|
}
|
|
602
|
-
//
|
|
603
|
-
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending'
|
|
624
|
+
// 同一形态第 4 轮(无任何新旧标记字段):同判 BLOCKED(单轨,无渐进放行侧),计数不推进
|
|
625
|
+
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
626
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
604
627
|
const oldRoundState = readStateFile(dir);
|
|
605
628
|
oldRoundState.fixRoundsByChange = { ch: 3 };
|
|
606
629
|
writeState(dir, oldRoundState);
|
|
607
630
|
const oldRound4 = runState(['next'], dir, env);
|
|
608
|
-
assertExit(oldRound4,
|
|
609
|
-
assertOut(oldRound4, '
|
|
610
|
-
assertOut(oldRound4, '(第 4/3 轮)');
|
|
611
|
-
assertNotOut(oldRound4, 'BLOCKED');
|
|
631
|
+
assertExit(oldRound4, 1);
|
|
632
|
+
assertOut(oldRound4, 'BLOCKED: Fix 批次受控归位已达 3 轮上限');
|
|
612
633
|
const oldRoundAfter = readStateFile(dir);
|
|
613
|
-
if (oldRoundAfter.
|
|
614
|
-
throw new Error('
|
|
615
|
-
+ JSON.stringify({
|
|
634
|
+
if (oldRoundAfter.fixRoundsByChange?.ch !== 3) {
|
|
635
|
+
throw new Error('BLOCK 不得推进 Fix 轮次计数: '
|
|
636
|
+
+ JSON.stringify({ rounds: oldRoundAfter.fixRoundsByChange }));
|
|
616
637
|
}
|
|
617
638
|
|
|
618
639
|
// ⑭ 签名算法版本可判别(真实命令链路):跨版本(v2 事件 vs 当前 v1)不做同版本比对——
|
|
619
640
|
// 不得把正常回程误判为未闭合 Fix;同版本 legacy 裸 hex 按既有语义参与(②⑤ 已锚)。
|
|
620
641
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'done' });
|
|
642
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
621
643
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
622
644
|
const versionSkewState = readStateFile(dir);
|
|
623
645
|
versionSkewState.history = [{
|
|
@@ -629,6 +651,9 @@ export const ENTRIES = [
|
|
|
629
651
|
fs.rmSync(path.join(dir, '.specs', CHANGE_ID, 'TEST.md'), { force: true });
|
|
630
652
|
fs.rmSync(path.join(dir, '.specs', CHANGE_ID, 'UAT.md'), { force: true });
|
|
631
653
|
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
654
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
655
|
+
// 出口覆盖判据要求全部声明
|
|
656
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
632
657
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
633
658
|
const skewExit = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
634
659
|
assertExit(skewExit, 0);
|
|
@@ -697,10 +722,20 @@ export const ENTRIES = [
|
|
|
697
722
|
assertExit(res, 1);
|
|
698
723
|
assertOut(res, 'BLOCKED');
|
|
699
724
|
assertOut(res, '缺少对应声明标记');
|
|
700
|
-
assertOut(res, 'workflow-state.mjs skill-load open flow-comet-change');
|
|
701
725
|
// 拦截先于写入——evidence 不得落库
|
|
702
726
|
const st = readStateFile(dir);
|
|
703
727
|
if (st.evidence && st.evidence.open) throw new Error('拦截后不应写入 evidence: ' + JSON.stringify(st.evidence.open));
|
|
728
|
+
// 报文给出的声明命令必须**照抄能跑通**(解析打印文本 → 真执行 → 同一条 record 通过):裸脚本名
|
|
729
|
+
// 的旧形态在 shell 里 command not found,字符串断言钉不住「这条命令能不能用」。
|
|
730
|
+
const command = (res.output.match(/^\s*(node "[^"]+" skill-load [^\n]+)$/m) || [])[1];
|
|
731
|
+
assertTrue(typeof command === 'string', '缺声明标记的阻塞必须给出完整可执行命令(node "<脚本路径>" skill-load …):\n' + res.output);
|
|
732
|
+
installSkillTreeCopy(dir, path.join('.claude', 'skills'));
|
|
733
|
+
const replayed = runPrintedCommand(command, dir, { FLOW_COMET_RUN_ROOT: dir, FLOW_COMET_PROTOCOL: '' });
|
|
734
|
+
assertTrue(replayed.status === 0,
|
|
735
|
+
'照抄的声明命令跑不通\n 命令: ' + command + '\n exit ' + replayed.status + '\n' + replayed.output);
|
|
736
|
+
const recorded = runState(['record', 'open', JSON.stringify({ summary: 'done', completedChecks: ['required-skill:open.flow-comet-change'] })], dir);
|
|
737
|
+
assertExit(recorded, 0);
|
|
738
|
+
assertOut(recorded, 'EVIDENCE: open');
|
|
704
739
|
},
|
|
705
740
|
},
|
|
706
741
|
|
|
@@ -775,6 +810,8 @@ export const ENTRIES = [
|
|
|
775
810
|
run: (dir) => {
|
|
776
811
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
777
812
|
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
813
|
+
// open 该读两份协议、两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
814
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
778
815
|
writeIntakeArtifacts(dir);
|
|
779
816
|
writeFile(dir, 'flow-kit/prompts/0-change.md', '# 阶段 0 · CHANGE\n\n## 角色\n\n你是 Changeer。\n');
|
|
780
817
|
// ① M5: record 自动补声明标记 → 出口通过(无需手动 skill-load)
|
|
@@ -812,6 +849,8 @@ export const ENTRIES = [
|
|
|
812
849
|
run: (dir) => {
|
|
813
850
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
814
851
|
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
852
|
+
// open 该读两份协议、两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
853
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
815
854
|
// 旧格式记录:completedChecks 无 required-skill 条目 → 不校验标记,通过
|
|
816
855
|
const rA = runState(['record', 'open', JSON.stringify({ summary: 'legacy', completedChecks: ['unit-tests'] })], dir);
|
|
817
856
|
assertExit(rA, 0);
|