flow-comet 1.6.4 → 1.7.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 +36 -6
- package/.flow-comet/skills/flow-comet/reference/artifact-template-overlay.md +154 -0
- package/.flow-comet/skills/flow-comet/reference/artifact-templates.json +387 -0
- package/.flow-comet/skills/flow-comet/reference/commit-discipline.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/entry-detail.md +29 -4
- package/.flow-comet/skills/flow-comet/reference/workflow-protocol.json +22 -0
- package/.flow-comet/skills/flow-comet/scripts/context-init.mjs +26 -23
- package/.flow-comet/skills/flow-comet/scripts/evolve.mjs +174 -0
- package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +17 -95
- package/.flow-comet/skills/flow-comet/scripts/health.mjs +28 -4
- package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +136 -19
- package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +54 -18
- package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +6 -6
- package/.flow-comet/skills/flow-comet/scripts/items/e.mjs +52 -10
- package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +25 -10
- package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +4 -2
- package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +21 -13
- package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +163 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/ac-coverage.mjs +317 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-artifact-skeleton.mjs +448 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +396 -27
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +1035 -172
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +129 -98
- 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 +797 -232
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +91 -22
- 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 +69 -13
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +454 -135
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-recovery.mjs +66 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/state-explain.mjs +109 -13
- package/.flow-comet/skills/flow-comet/scripts/lib/state-io.mjs +55 -2
- package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +149 -34
- package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +79 -9
- package/.flow-comet/skills/flow-comet/scripts/lib/task-graph.mjs +84 -31
- package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +78 -8
- package/.flow-comet/skills/flow-comet/scripts/lib/test-helpers.mjs +60 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +167 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/wave-projection.mjs +341 -0
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +287 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +1454 -16
- package/.flow-comet/skills/flow-comet/scripts/scenarios/b.mjs +1202 -8
- package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +1205 -77
- package/.flow-comet/skills/flow-comet/scripts/scenarios/d.mjs +753 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +52 -11
- package/.flow-comet/skills/flow-comet/scripts/scenarios/f.mjs +582 -3
- package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +9 -1
- package/.flow-comet/skills/flow-comet/scripts/scenarios/i.mjs +5 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +22 -6
- package/.flow-comet/skills/flow-comet/scripts/scenarios/k.mjs +2 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +18 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +4100 -0
- package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +135 -0
- package/.flow-comet/skills/flow-comet/scripts/system-test.mjs +6 -5
- package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +203 -4
- package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +312 -63
- package/.flow-comet/skills/flow-comet/scripts/workflow-state.mjs +5 -2
- package/.flow-comet/skills/flow-comet-archive/SKILL.md +6 -2
- package/.flow-comet/skills/flow-comet-change/SKILL.md +6 -2
- package/.flow-comet/skills/flow-comet-design/GUIDANCE.md +13 -3
- package/.flow-comet/skills/flow-comet-design/SKILL.md +15 -8
- package/.flow-comet/skills/flow-comet-dev/SKILL.md +1 -1
- package/.flow-comet/skills/flow-comet-evolve/SKILL.md +1 -0
- package/.flow-comet/skills/flow-comet-execute/SKILL.md +42 -15
- package/.flow-comet/skills/flow-comet-health/SKILL.md +1 -1
- package/.flow-comet/skills/flow-comet-integration/SKILL.md +1 -1
- package/.flow-comet/skills/flow-comet-open/GUIDANCE.md +14 -4
- package/.flow-comet/skills/flow-comet-open/SKILL.md +11 -9
- package/.flow-comet/skills/flow-comet-plan/GUIDANCE.md +13 -3
- package/.flow-comet/skills/flow-comet-plan/SKILL.md +21 -10
- package/.flow-comet/skills/flow-comet-requirement/SKILL.md +1 -1
- package/.flow-comet/skills/flow-comet-review/SKILL.md +33 -18
- package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +13 -3
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +44 -16
- package/.flow-comet/skills/flow-comet-task/SKILL.md +3 -2
- package/.flow-comet/skills/flow-comet-test/SKILL.md +6 -2
- package/.flow-comet/skills/flow-comet-ui-design/SKILL.md +2 -2
- package/.flow-comet/skills/flow-comet-verify/SKILL.md +12 -8
- package/README.md +3 -3
- package/package.json +1 -1
- package/scripts/dsh-bridge.mjs +2 -2
- package/scripts/lib/installer-flowkit.mjs +43 -3
|
@@ -10,8 +10,49 @@
|
|
|
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';
|
|
14
|
-
import { multiWaveTaskContent, explainContractProblems, assertExplainFailClosed, explainReverseConstructionProblems, CHANGE_ID, readStateFile, gitInit, gitBranch, writeIntakeArtifacts, fullContract, execSummaryFixture, assertNodeLine, driveThroughDesign } from '../lib/system-fixtures.mjs';
|
|
13
|
+
import { assertEqual, assertExit, assertNotOut, assertOut, assertTrue, baseState, installSkillTreeCopy, runGuard, runHandoff, runPrintedCommand, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
|
|
14
|
+
import { archiveRecordJson, multiWaveTaskContent, explainContractProblems, assertExplainFailClosed, explainReverseConstructionProblems, CHANGE_ID, readStateFile, gitInit, gitBranch, writeIntakeArtifacts, fullContract, execSummaryFixture, assertNodeLine, driveThroughDesign } from '../lib/system-fixtures.mjs';
|
|
15
|
+
|
|
16
|
+
// skill-load 的模板声明(节点级,C3/AC-13 加载链):参数化的委托驱动按节点查表——夹具是真实命令
|
|
17
|
+
// 序列,声明集合要与节点映射一致(集合不一致时引擎按 C11 fail-closed 拦截)。
|
|
18
|
+
const TEMPLATE_DECLARATION = {
|
|
19
|
+
open: 'CHANGE.md,REQUIREMENT.md',
|
|
20
|
+
design: 'DESIGN.md',
|
|
21
|
+
plan: 'TASK.md',
|
|
22
|
+
execute: 'SUMMARY.md',
|
|
23
|
+
'subagent-execute': 'SUMMARY.md',
|
|
24
|
+
review: 'REVIEW.md,TEST.md',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function skillLoadArgs(nodeId, skill, prompt) {
|
|
28
|
+
const args = ['skill-load', nodeId, skill, '--prompt', prompt];
|
|
29
|
+
if (TEMPLATE_DECLARATION[nodeId]) args.push('--templates', TEMPLATE_DECLARATION[nodeId]);
|
|
30
|
+
return args;
|
|
31
|
+
}
|
|
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
|
+
}
|
|
15
56
|
|
|
16
57
|
export const ENTRIES = [
|
|
17
58
|
// ---------- A. 状态机与路由 ----------
|
|
@@ -116,7 +157,9 @@ export const ENTRIES = [
|
|
|
116
157
|
name: 'A5 next:推进与状态漂移校正',
|
|
117
158
|
run: (dir) => {
|
|
118
159
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
119
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md'], dir), 0);
|
|
160
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
161
|
+
// open 该读两份协议、协议声明两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
162
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
120
163
|
writeIntakeArtifacts(dir);
|
|
121
164
|
assertExit(runState(['record', 'open', '{"summary":"intake complete"}'], dir), 0);
|
|
122
165
|
// 真实出口:exit open --apply(未激活声明机制 → 兼容警告 + 通过)
|
|
@@ -198,7 +241,7 @@ export const ENTRIES = [
|
|
|
198
241
|
name: 'A9 record:基础证据记录',
|
|
199
242
|
run: (dir, outcomes) => {
|
|
200
243
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
201
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-change'], dir), 0);
|
|
244
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
202
245
|
// JSON payload → evidence 写入 + next 提示
|
|
203
246
|
const res = runState(['record', 'open', '{"summary":"recorded"}'], dir);
|
|
204
247
|
assertExit(res, 0);
|
|
@@ -360,7 +403,10 @@ export const ENTRIES = [
|
|
|
360
403
|
// 对未实现循环路由的引擎本用例 RED 属预期(单趟限制下委托节点完成后不再路由回)。
|
|
361
404
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
|
|
362
405
|
multiWaveTaskContent({ P01: 'pending', P02: 'pending', S01: 'pending', P03: 'pending' }));
|
|
363
|
-
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir), 0);
|
|
406
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
407
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):节点实现技能与必需技能是两个声明面,
|
|
408
|
+
// 出口覆盖判据要求后者也有标记。
|
|
409
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
364
410
|
assertExit(runState(['record', 'plan', '{"summary":"plan done"}'], dir), 0);
|
|
365
411
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
366
412
|
const rPlan = runGuard(['exit', 'plan', '--apply'], dir);
|
|
@@ -368,9 +414,42 @@ export const ENTRIES = [
|
|
|
368
414
|
assertOut(rPlan, 'ALL CHECKS PASSED');
|
|
369
415
|
// 首趟路由:首波双并行无前置依赖 → 直接进入委托节点
|
|
370
416
|
assertOut(rPlan, 'NODE: subagent-execute');
|
|
417
|
+
// 委托前置门的声明命令必须照抄可执行:解析打印文本 → 真执行 → 再 request 通过。旧形态是
|
|
418
|
+
// 「workflow-state.mjs skill-load <node> <skill>」——裸脚本名在 shell 里 command not found,
|
|
419
|
+
// `<skill>` 占位在 bash 下是重定向,且不带该节点全部 --prompt / --templates / --protocol,
|
|
420
|
+
// 字面断言钉不住「这条命令能不能用」。同一次 request 还断言开工前 LESSONS 命中集的围栏口径:
|
|
421
|
+
// 围栏里的书写样例不是真条目(围栏判定与段体单源同口径),围栏外的条目照常命中。
|
|
422
|
+
writeFile(dir, '.specs/LESSONS.md',
|
|
423
|
+
'# LESSONS\n\n## 条目区\n\n~~~md\n### L-901 · [proc] 围栏内的书写样例\n- **关键词**: p01 委托边界\n~~~\n\n'
|
|
424
|
+
+ '### L-902 · [proc] 委托边界须留痕\n- **关键词**: p01\n');
|
|
425
|
+
const gatedRequest = runHandoff(['request', 'P01', 'P01 委托'], dir);
|
|
426
|
+
assertExit(gatedRequest, 1);
|
|
427
|
+
assertOut(gatedRequest, 'BLOCKED: 节点 subagent-execute 缺少技能加载声明标记');
|
|
428
|
+
assertNotOut(gatedRequest, 'HANDOFF REQUEST');
|
|
429
|
+
const declarationCommand = (gatedRequest.output.match(/^\s*(node "[^"]+" skill-load [^\n]+)$/m) || [])[1];
|
|
430
|
+
assertTrue(typeof declarationCommand === 'string',
|
|
431
|
+
'委托前置门的阻塞必须给出完整可执行命令(node "<脚本路径>" skill-load …):\n' + gatedRequest.output);
|
|
432
|
+
// 打印命令按安装布局的执行面解析(脚本根是运行根相对形态):先把技能树复制成安装副本,
|
|
433
|
+
// 再真跑打印文本——执行的是打印出来的脚本路径与参数,不是 harness 自己的绝对路径。
|
|
434
|
+
installSkillTreeCopy(dir, path.join('.claude', 'skills'));
|
|
435
|
+
const replayedDeclaration = runPrintedCommand(declarationCommand, dir,
|
|
436
|
+
{ FLOW_COMET_RUN_ROOT: dir, FLOW_COMET_PROTOCOL: '' });
|
|
437
|
+
assertTrue(replayedDeclaration.status === 0,
|
|
438
|
+
'照抄的声明命令跑不通\n 命令: ' + declarationCommand
|
|
439
|
+
+ '\n exit ' + replayedDeclaration.status + '\n' + replayedDeclaration.output);
|
|
440
|
+
const declaredRequest = runHandoff(['request', 'P01', 'P01 委托'], dir);
|
|
441
|
+
assertExit(declaredRequest, 0);
|
|
442
|
+
assertOut(declaredRequest, 'HANDOFF REQUEST: P01');
|
|
443
|
+
assertOut(declaredRequest, 'LESSONS-HITS: 1 条');
|
|
444
|
+
assertOut(declaredRequest, 'L-902');
|
|
445
|
+
assertNotOut(declaredRequest, 'L-901');
|
|
446
|
+
// 这一格考的是开工前打印面(命中集 + 围栏判定)。出口侧的「逐条回应」判据按**任务写面**算命中,
|
|
447
|
+
// 本夹具的 L-902 只会落在 P01 的扫描段上——留着教训册就要把 A13 后续每份 SUMMARY 的措辞一并改写,
|
|
448
|
+
// 而那条判据另有场景逐格考(含缺回应 / 围栏内回应)。断言完成后撤掉夹具,A13 其余步骤保持原基线。
|
|
449
|
+
fs.rmSync(path.join(dir, '.specs', 'LESSONS.md'), { force: true });
|
|
371
450
|
// 两层加载模型:执行域两节点的手动声明标记(record 前置门;一次声明后续趟次复用)
|
|
372
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
373
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
451
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
452
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
374
453
|
|
|
375
454
|
// 单趟完成动作:TASK.md 标 done(status 变更不影响任务集签名)+ SUMMARY 夹具 + 真实 handoff 委托回传
|
|
376
455
|
const completeTasks = (ids) => {
|
|
@@ -485,7 +564,10 @@ export const ENTRIES = [
|
|
|
485
564
|
'<task id="X1" parallel="true" status="pending"><action>实现 X1</action><write_files>src/x1.mjs</write_files><verify>node --check src/x1.mjs</verify><depends_on>X2</depends_on></task>\n' +
|
|
486
565
|
'<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';
|
|
487
566
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + cyclic);
|
|
488
|
-
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir), 0);
|
|
567
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
568
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):节点实现技能与必需技能是两个声明面,
|
|
569
|
+
// 出口覆盖判据要求后者也有标记。
|
|
570
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
489
571
|
assertExit(runState(['record', 'plan', '{"summary":"plan drafted"}'], dir), 0);
|
|
490
572
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
491
573
|
const blocked = runGuard(['exit', 'plan', '--apply'], dir);
|
|
@@ -543,7 +625,7 @@ export const ENTRIES = [
|
|
|
543
625
|
// next 对「currentNode 无 evidence 且非固定路由后继」的委托跳转态按正常推进豁免不放行,
|
|
544
626
|
// 仅断言 guard 侧 NODE;直接后继/回流态(next 可确认)才做双侧收敛断言。
|
|
545
627
|
const drive = (nodeId, skill, prompt, prepare, { expectedNode, converge = true } = {}) => {
|
|
546
|
-
|
|
628
|
+
declareNodeDeclarations(dir, env, nodeId, skill, prompt);
|
|
547
629
|
prepare();
|
|
548
630
|
assertExit(runGuard(['entry', nodeId], dir), 0);
|
|
549
631
|
const res = runGuard(['exit', nodeId, '--apply'], dir);
|
|
@@ -608,8 +690,13 @@ export const ENTRIES = [
|
|
|
608
690
|
}, { expectedNode: 'archive', converge: true });
|
|
609
691
|
// 归档出口:两侧均 NEXT: done
|
|
610
692
|
assertExit(runState(['skill-load', 'archive', 'flow-comet-archive', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
693
|
+
// 协议 archive.requiredSkillCalls = flow-comet-integration(guarded):出口覆盖判据要求该技能也有标记
|
|
694
|
+
assertExit(runState(['skill-load', 'archive', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
611
695
|
writeFile(dir, '.specs/archive/2026-08-28-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# 遗留问题\n\n无。\n');
|
|
612
|
-
|
|
696
|
+
// 归档提名随证据落盘:本 change 写了 6 份任务 SUMMARY(并行 4 份 + 串行 2 份,扫描份数按
|
|
697
|
+
// 同一清单对账)。提名门缺字段即拦,与本条被测的路由收敛判据无关。
|
|
698
|
+
assertExit(runState(['record', 'archive',
|
|
699
|
+
archiveRecordJson('archive complete', ['P01', 'P02', 'S01', 'P03', 'P04', 'S02'])], dir, env), 0);
|
|
613
700
|
assertExit(runGuard(['entry', 'archive'], dir), 0);
|
|
614
701
|
const res = runGuard(['exit', 'archive', '--apply'], dir);
|
|
615
702
|
assertExit(res, 0);
|
|
@@ -636,7 +723,10 @@ export const ENTRIES = [
|
|
|
636
723
|
// 非 --apply 出口(弱判/强判阶段不推进状态,避免 apply 后 currentNode 偏离 plan)
|
|
637
724
|
const exitPlanNoApply = () => runGuard(['exit', 'plan'], dir, planEnv);
|
|
638
725
|
const exitPlanApply = () => runGuard(['exit', 'plan', '--apply'], dir, planEnv);
|
|
639
|
-
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir), 0);
|
|
726
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
727
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):节点实现技能与必需技能是两个声明面,
|
|
728
|
+
// 出口覆盖判据要求后者也有标记。
|
|
729
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
640
730
|
assertExit(runState(['record', 'plan', '{"summary":"plan drafted"}'], dir), 0);
|
|
641
731
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
642
732
|
const planTask = (taskBody) => writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + taskBody);
|
|
@@ -694,6 +784,18 @@ export const ENTRIES = [
|
|
|
694
784
|
assertExit(globRecovered, 0);
|
|
695
785
|
assertOut(globRecovered, 'ALL CHECKS PASSED');
|
|
696
786
|
assertNotOut(globRecovered, 'BLOCKED');
|
|
787
|
+
// 写面判定的元素名大小写无关:`<WRITE_FILES>` 与 `<write_files>` 是同一种元素——7 字段门按
|
|
788
|
+
// 大小写不敏感判定在场,而「这份写面算不算有内容」的判据若只认小写,大写写法的任务就被静默
|
|
789
|
+
// 排除在 [P] 补集判据之外:同波同层、写面互不重叠的一对永远不被要求标 parallel(判据在场才判,
|
|
790
|
+
// 判据缺席就是放行)。
|
|
791
|
+
planTask(
|
|
792
|
+
'## 波次划分\n\nWave 1: U01, U02\n\n## 任务清单\n\n'
|
|
793
|
+
+ '<task id="U01" status="pending"><action>实现 U01</action><WRITE_FILES>src/u01.mjs</WRITE_FILES><verify>node --check src/u01.mjs</verify></task>\n'
|
|
794
|
+
+ '<task id="U02" status="pending"><action>实现 U02</action><WRITE_FILES>src/u02.mjs</WRITE_FILES><verify>node --check src/u02.mjs</verify></task>\n');
|
|
795
|
+
const upperCaseWriteFiles = exitPlanNoApply();
|
|
796
|
+
assertExit(upperCaseWriteFiles, 1);
|
|
797
|
+
assertOut(upperCaseWriteFiles, '同波任务可并行却未标 [P]');
|
|
798
|
+
assertOut(upperCaseWriteFiles, 'U01 × U02');
|
|
697
799
|
// 同一文件跨任务族(负例):两个非修复任务写入同一文件、彼此无依赖路径(串行拆分同样构成
|
|
698
800
|
// 「未显式排序的同文件多任务」)→ 新 change BLOCKED,消息含任务对与重叠文件 + 恢复指引。
|
|
699
801
|
// 同夹具并列一对修复任务(id 带修复前缀)写同一文件且无依赖路径——该族不参与判定,
|
|
@@ -800,7 +902,7 @@ export const ENTRIES = [
|
|
|
800
902
|
};
|
|
801
903
|
// drive 收敛面全量:每个转换点(含平行跳转与趟间回流)都断言 next 可达且与 guard 出口 NODE 一致
|
|
802
904
|
const drive = (nodeId, skill, prompt, prepare, { expectedNode } = {}) => {
|
|
803
|
-
|
|
905
|
+
declareNodeDeclarations(dir, env, nodeId, skill, prompt);
|
|
804
906
|
prepare();
|
|
805
907
|
assertExit(runGuard(['entry', nodeId], dir), 0);
|
|
806
908
|
const res = runGuard(['exit', nodeId, '--apply'], dir);
|
|
@@ -864,8 +966,13 @@ export const ENTRIES = [
|
|
|
864
966
|
}, { expectedNode: 'archive' });
|
|
865
967
|
// 归档出口:两侧均 NEXT: done
|
|
866
968
|
assertExit(runState(['skill-load', 'archive', 'flow-comet-archive', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
969
|
+
// 协议 archive.requiredSkillCalls = flow-comet-integration(guarded):出口覆盖判据要求该技能也有标记
|
|
970
|
+
assertExit(runState(['skill-load', 'archive', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
867
971
|
writeFile(dir, '.specs/archive/2026-08-28-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# 遗留问题\n\n无。\n');
|
|
868
|
-
|
|
972
|
+
// 归档提名随证据落盘:本 change 写了 6 份任务 SUMMARY(并行 4 份 + 串行 2 份,扫描份数按
|
|
973
|
+
// 同一清单对账)。提名门缺字段即拦,与本条被测的路由收敛判据无关。
|
|
974
|
+
assertExit(runState(['record', 'archive',
|
|
975
|
+
archiveRecordJson('archive complete', ['P01', 'P02', 'S01', 'P03', 'P04', 'S02'])], dir, env), 0);
|
|
869
976
|
assertExit(runGuard(['entry', 'archive'], dir), 0);
|
|
870
977
|
const resArch = runGuard(['exit', 'archive', '--apply'], dir);
|
|
871
978
|
assertExit(resArch, 0);
|
|
@@ -894,14 +1001,18 @@ export const ENTRIES = [
|
|
|
894
1001
|
// 驱动至 plan 出口(真实命令:init→open→design 见 driveThroughDesign,随后 plan 三连)
|
|
895
1002
|
driveThroughDesign(dir);
|
|
896
1003
|
writeTask({ S01: 'pending' });
|
|
897
|
-
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir, env), 0);
|
|
1004
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
1005
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):出口覆盖判据要求该技能也有标记
|
|
1006
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
898
1007
|
assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
|
|
899
1008
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
900
1009
|
assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
|
|
901
1010
|
// execute 完整完成(产物 + record + entry,真实命令)——仅差 completedNodes(欠账)
|
|
902
1011
|
writeTask({ S01: 'done' });
|
|
903
1012
|
writeFile(dir, '.specs/' + CHANGE_ID + '/S01-SUMMARY.md', execSummaryFixture('S01'));
|
|
904
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
|
|
1013
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
1014
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
1015
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
905
1016
|
assertExit(runState(['record', 'execute', '{"summary":"executed","parallelTakeoverApproved":true}'], dir, env), 0);
|
|
906
1017
|
assertExit(runGuard(['entry', 'execute'], dir), 0);
|
|
907
1018
|
// R-1 欠账漂移态:currentNode 漂移到文件推导下一节点 review(execute 未 completed)
|
|
@@ -940,7 +1051,9 @@ export const ENTRIES = [
|
|
|
940
1051
|
};
|
|
941
1052
|
driveThroughDesign(dir);
|
|
942
1053
|
writeTask({ P01: 'pending', S01: 'pending' });
|
|
943
|
-
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir, env), 0);
|
|
1054
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
1055
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):出口覆盖判据要求该技能也有标记
|
|
1056
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
944
1057
|
assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
|
|
945
1058
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
946
1059
|
assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
|
|
@@ -948,7 +1061,7 @@ export const ENTRIES = [
|
|
|
948
1061
|
// 发起委托前先 skill-load 声明(handoff request 前置门——先声明再发起委托,与既有委托链同序)
|
|
949
1062
|
writeTask({ P01: 'done', S01: 'pending' });
|
|
950
1063
|
writeFile(dir, '.specs/' + CHANGE_ID + '/P01-SUMMARY.md', execSummaryFixture('P01'));
|
|
951
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-subagent-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
|
|
1064
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-subagent-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
952
1065
|
assertExit(runHandoff(['request', 'P01', 'P01 委托', '--write-files', 'src/p01.mjs'], dir), 0);
|
|
953
1066
|
assertExit(runHandoff(['result', 'P01', fullContract('abcd1234abcd1234abcd1234abcd1234abcd1234', 'P01')], dir), 0);
|
|
954
1067
|
assertExit(runState(['record', 'subagent-execute', '{"summary":"wave 1 delegated and collected"}'], dir, env), 0);
|
|
@@ -995,14 +1108,18 @@ export const ENTRIES = [
|
|
|
995
1108
|
// 驱动至 execute(真实命令:init→open→design→plan 出口)
|
|
996
1109
|
driveThroughDesign(dir);
|
|
997
1110
|
writeTask({ S01: 'pending' });
|
|
998
|
-
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir, env), 0);
|
|
1111
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
1112
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):出口覆盖判据要求该技能也有标记
|
|
1113
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
|
|
999
1114
|
assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
|
|
1000
1115
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
1001
1116
|
assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
|
|
1002
1117
|
// execute 完整完成(产物 + record + entry,真实命令)
|
|
1003
1118
|
writeTask({ S01: 'done' });
|
|
1004
1119
|
writeFile(dir, '.specs/' + CHANGE_ID + '/S01-SUMMARY.md', execSummaryFixture('S01'));
|
|
1005
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
|
|
1120
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
1121
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
1122
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
1006
1123
|
assertExit(runState(['record', 'execute', '{"summary":"executed"}'], dir, env), 0);
|
|
1007
1124
|
assertExit(runGuard(['entry', 'execute'], dir), 0);
|
|
1008
1125
|
// 执行者自切 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 = [
|
|
@@ -86,7 +86,10 @@ export const ENTRIES = [
|
|
|
86
86
|
assertNodeLine(a21PostNext, 'review');
|
|
87
87
|
|
|
88
88
|
// ⑤ 回源 review 出口门禁真实执行:缺处置标记 → BLOCKED;补齐后同出口通过并推进 verify
|
|
89
|
-
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md'], dir, env), 0);
|
|
89
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
90
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
91
|
+
// 出口覆盖判据要求全部声明
|
|
92
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
90
93
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
91
94
|
writeFile(dir, '.specs/' + CHANGE_ID + '/REVIEW.md', fixBatchReviewDoc(false));
|
|
92
95
|
const gate = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
@@ -177,6 +180,8 @@ export const ENTRIES = [
|
|
|
177
180
|
|
|
178
181
|
// ⑤ 回源 verify 出口真实执行:验证命令落盘 + 推进 archive
|
|
179
182
|
assertExit(runState(['skill-load', 'verify', 'flow-comet-verify', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
183
|
+
// 协议 verify.requiredSkillCalls = flow-comet-integration(guarded):同一份协议文件、另一个技能面
|
|
184
|
+
assertExit(runState(['skill-load', 'verify', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
180
185
|
assertExit(runGuard(['entry', 'verify'], dir, env), 0);
|
|
181
186
|
const vf = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
182
187
|
assertExit(vf, 0);
|
|
@@ -247,7 +252,10 @@ export const ENTRIES = [
|
|
|
247
252
|
assertOut(rClosedExit, 'FIX-BATCH: 回源节点 review(execute 出口已完成)');
|
|
248
253
|
assertNotOut(rClosedExit, 'RETURN: 回源节点');
|
|
249
254
|
assertNodeLine(rClosedExit, 'review');
|
|
250
|
-
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md'], dir, env), 0);
|
|
255
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
256
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
257
|
+
// 出口覆盖判据要求全部声明
|
|
258
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
251
259
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
252
260
|
const rReviewPass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
253
261
|
assertExit(rReviewPass, 0);
|
|
@@ -280,7 +288,7 @@ export const ENTRIES = [
|
|
|
280
288
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', fixBatchParallelTaskText('done'));
|
|
281
289
|
writeFile(dir, '.specs/' + CHANGE_ID + '/P-FIX-01-SUMMARY.md', execSummaryFixture('P-FIX-01'));
|
|
282
290
|
// 委托前先加载节点技能声明(新 change 两层加载模型:request 命令要求标记在位)。
|
|
283
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
|
|
291
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
284
292
|
for (const taskId of ['T01', 'P-FIX-01']) {
|
|
285
293
|
assertExit(runHandoff(['request', taskId, taskId + ' 委托', '--write-files', 'src/' + taskId.toLowerCase() + '.mjs'], dir), 0);
|
|
286
294
|
assertExit(runHandoff(['result', taskId, fullContract('abcd1234abcd1234abcd1234abcd1234abcd1234', taskId)], dir), 0);
|
|
@@ -296,7 +304,10 @@ export const ENTRIES = [
|
|
|
296
304
|
if (pSt.currentNode !== 'review') {
|
|
297
305
|
throw new Error('并行修复第二趟出口应回源 review,实际 ' + JSON.stringify(pSt.currentNode));
|
|
298
306
|
}
|
|
299
|
-
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md'], dir, env), 0);
|
|
307
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
308
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
309
|
+
// 出口覆盖判据要求全部声明
|
|
310
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
300
311
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
301
312
|
const pReviewPass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
302
313
|
assertExit(pReviewPass, 0);
|
|
@@ -342,6 +353,8 @@ export const ENTRIES = [
|
|
|
342
353
|
assertNotOut(vClosedExit, 'RETURN: 回源节点');
|
|
343
354
|
assertNodeLine(vClosedExit, 'verify');
|
|
344
355
|
assertExit(runState(['skill-load', 'verify', 'flow-comet-verify', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
356
|
+
// 协议 verify.requiredSkillCalls = flow-comet-integration(guarded):同一份协议文件、另一个技能面
|
|
357
|
+
assertExit(runState(['skill-load', 'verify', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
345
358
|
assertExit(runGuard(['entry', 'verify'], dir, env), 0);
|
|
346
359
|
const vPass = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
347
360
|
assertExit(vPass, 0);
|
|
@@ -407,7 +420,9 @@ export const ENTRIES = [
|
|
|
407
420
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', fixBatchTwoFixTaskText('done', 'done'));
|
|
408
421
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
409
422
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-02-SUMMARY.md', execSummaryFixture('T-FIX-02'));
|
|
410
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
|
|
423
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
424
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
425
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
411
426
|
assertExit(runState(['record', 'execute', '{"summary":"fix wave two executed","parallelTakeoverApproved":true}'], dir, env), 0);
|
|
412
427
|
const wave2 = runGuard(['exit', 'execute', '--apply'], dir, env);
|
|
413
428
|
assertExit(wave2, 0);
|
|
@@ -466,7 +481,9 @@ export const ENTRIES = [
|
|
|
466
481
|
executionMode: 'subagent',
|
|
467
482
|
directOverride: false,
|
|
468
483
|
});
|
|
469
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
|
|
484
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
485
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
486
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
470
487
|
assertExit(runState(['record', 'execute', '{"summary":"legacy state closure","parallelTakeoverApproved":true}'], dir, env), 0);
|
|
471
488
|
const legacyExit = runGuard(['exit', 'execute', '--apply'], dir, env);
|
|
472
489
|
assertExit(legacyExit, 0);
|
|
@@ -500,7 +517,9 @@ export const ENTRIES = [
|
|
|
500
517
|
for (let i = 1; i <= n; i++) {
|
|
501
518
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-0' + i + '-SUMMARY.md', execSummaryFixture('T-FIX-0' + i));
|
|
502
519
|
}
|
|
503
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
|
|
520
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
521
|
+
// 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):出口覆盖判据要求该技能也有标记
|
|
522
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
|
|
504
523
|
// entry 记录 taskHash:签名值必须带算法版本前缀(新链路 vN 前缀形态)
|
|
505
524
|
assertExit(runGuard(['entry', 'execute'], dir, env), 0);
|
|
506
525
|
const stHash = readStateFile(dir);
|
|
@@ -628,7 +647,10 @@ export const ENTRIES = [
|
|
|
628
647
|
// 清掉本项先前 verify 子场景遗留的 TEST/UAT,使回程路由确定为 verify(夹具前提)
|
|
629
648
|
fs.rmSync(path.join(dir, '.specs', CHANGE_ID, 'TEST.md'), { force: true });
|
|
630
649
|
fs.rmSync(path.join(dir, '.specs', CHANGE_ID, 'UAT.md'), { force: true });
|
|
631
|
-
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md'], dir, env), 0);
|
|
650
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
651
|
+
// review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test):
|
|
652
|
+
// 出口覆盖判据要求全部声明
|
|
653
|
+
assertExit(runState(['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md'], dir, env), 0);
|
|
632
654
|
assertExit(runGuard(['entry', 'review'], dir, env), 0);
|
|
633
655
|
const skewExit = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
634
656
|
assertExit(skewExit, 0);
|
|
@@ -646,7 +668,7 @@ export const ENTRIES = [
|
|
|
646
668
|
run: (dir) => {
|
|
647
669
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
648
670
|
writeFile(dir, 'flow-kit/prompts/0-change.md', '# 阶段 0 · CHANGE\n\n## 角色\n\n你是 Changeer。\n');
|
|
649
|
-
const res = runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md'], dir);
|
|
671
|
+
const res = runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir);
|
|
650
672
|
assertExit(res, 0);
|
|
651
673
|
assertOut(res, 'SKILL-LOAD: open flow-comet-change');
|
|
652
674
|
const markerPath = path.join(dir, '.specs', CHANGE_ID, '.skill-loads', 'open-flow-comet-change.json');
|
|
@@ -697,10 +719,20 @@ export const ENTRIES = [
|
|
|
697
719
|
assertExit(res, 1);
|
|
698
720
|
assertOut(res, 'BLOCKED');
|
|
699
721
|
assertOut(res, '缺少对应声明标记');
|
|
700
|
-
assertOut(res, 'workflow-state.mjs skill-load open flow-comet-change');
|
|
701
722
|
// 拦截先于写入——evidence 不得落库
|
|
702
723
|
const st = readStateFile(dir);
|
|
703
724
|
if (st.evidence && st.evidence.open) throw new Error('拦截后不应写入 evidence: ' + JSON.stringify(st.evidence.open));
|
|
725
|
+
// 报文给出的声明命令必须**照抄能跑通**(解析打印文本 → 真执行 → 同一条 record 通过):裸脚本名
|
|
726
|
+
// 的旧形态在 shell 里 command not found,字符串断言钉不住「这条命令能不能用」。
|
|
727
|
+
const command = (res.output.match(/^\s*(node "[^"]+" skill-load [^\n]+)$/m) || [])[1];
|
|
728
|
+
assertTrue(typeof command === 'string', '缺声明标记的阻塞必须给出完整可执行命令(node "<脚本路径>" skill-load …):\n' + res.output);
|
|
729
|
+
installSkillTreeCopy(dir, path.join('.claude', 'skills'));
|
|
730
|
+
const replayed = runPrintedCommand(command, dir, { FLOW_COMET_RUN_ROOT: dir, FLOW_COMET_PROTOCOL: '' });
|
|
731
|
+
assertTrue(replayed.status === 0,
|
|
732
|
+
'照抄的声明命令跑不通\n 命令: ' + command + '\n exit ' + replayed.status + '\n' + replayed.output);
|
|
733
|
+
const recorded = runState(['record', 'open', JSON.stringify({ summary: 'done', completedChecks: ['required-skill:open.flow-comet-change'] })], dir);
|
|
734
|
+
assertExit(recorded, 0);
|
|
735
|
+
assertOut(recorded, 'EVIDENCE: open');
|
|
704
736
|
},
|
|
705
737
|
},
|
|
706
738
|
|
|
@@ -708,7 +740,7 @@ export const ENTRIES = [
|
|
|
708
740
|
name: 'B4 record:声明后记录通过',
|
|
709
741
|
run: (dir) => {
|
|
710
742
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
711
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-change'], dir), 0);
|
|
743
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
712
744
|
const res = runState(['record', 'open', JSON.stringify({ summary: 'done', completedChecks: ['required-skill:open.flow-comet-change'] })], dir);
|
|
713
745
|
assertExit(res, 0);
|
|
714
746
|
assertOut(res, 'EVIDENCE: open');
|
|
@@ -749,7 +781,7 @@ export const ENTRIES = [
|
|
|
749
781
|
name: 'B7 record:委托范围条目豁免(有委托通过 / 无委托拦截)',
|
|
750
782
|
run: (dir) => {
|
|
751
783
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
752
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev'], dir), 0);
|
|
784
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--templates', 'SUMMARY.md'], dir), 0);
|
|
753
785
|
const payload = JSON.stringify({ summary: 'delegated', completedChecks: ['required-skill:subagent-execute.flow-comet-dev'] });
|
|
754
786
|
// 无委托记录 → 拦截(handoff scope 条目以共用证据库的委托记录为证据)
|
|
755
787
|
const blocked = runState(['record', 'subagent-execute', payload], dir);
|
|
@@ -774,7 +806,9 @@ export const ENTRIES = [
|
|
|
774
806
|
name: 'B8 exit:协议声明标记校验(record 自动补通过 / 手动声明 / 空协议·损坏拦截)',
|
|
775
807
|
run: (dir) => {
|
|
776
808
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
777
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md'], dir), 0);
|
|
809
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
810
|
+
// open 该读两份协议、两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
811
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
778
812
|
writeIntakeArtifacts(dir);
|
|
779
813
|
writeFile(dir, 'flow-kit/prompts/0-change.md', '# 阶段 0 · CHANGE\n\n## 角色\n\n你是 Changeer。\n');
|
|
780
814
|
// ① M5: record 自动补声明标记 → 出口通过(无需手动 skill-load)
|
|
@@ -787,14 +821,14 @@ export const ENTRIES = [
|
|
|
787
821
|
assertOut(rAuto, 'ALL CHECKS PASSED');
|
|
788
822
|
assertNotOut(rAuto, 'BLOCKED');
|
|
789
823
|
// ② 手动 skill-load --prompt(protocol = basename)覆盖自动标记 → 出口通过
|
|
790
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md'], dir), 0);
|
|
824
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
791
825
|
const rPass = runGuard(['exit', 'open'], dir);
|
|
792
826
|
assertExit(rPass, 0);
|
|
793
827
|
assertOut(rPass, 'ALL CHECKS PASSED');
|
|
794
828
|
assertNotOut(rPass, 'BLOCKED');
|
|
795
829
|
// ③ 未传 --prompt → 标记 protocol = null → 拦截(fail-closed;open 两个 requiredSkillCalls 均覆盖为 null)
|
|
796
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-change'], dir), 0);
|
|
797
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement'], dir), 0);
|
|
830
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
831
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
798
832
|
const rNull = runGuard(['exit', 'open'], dir);
|
|
799
833
|
assertExit(rNull, 1);
|
|
800
834
|
assertOut(rNull, 'exit 缺协议声明标记');
|
|
@@ -811,7 +845,9 @@ export const ENTRIES = [
|
|
|
811
845
|
name: 'B9 旧项目兼容:record 自动补声明后照常通过',
|
|
812
846
|
run: (dir) => {
|
|
813
847
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
814
|
-
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md'], dir), 0);
|
|
848
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
849
|
+
// open 该读两份协议、两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
850
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
815
851
|
// 旧格式记录:completedChecks 无 required-skill 条目 → 不校验标记,通过
|
|
816
852
|
const rA = runState(['record', 'open', JSON.stringify({ summary: 'legacy', completedChecks: ['unit-tests'] })], dir);
|
|
817
853
|
assertExit(rA, 0);
|
|
@@ -21,7 +21,7 @@ export const ENTRIES = [
|
|
|
21
21
|
writeState(dir, baseState('execute'));
|
|
22
22
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
|
|
23
23
|
'# TASK\n\n<task id="T01" status="done" parallel="true">\n <action>实现 T01</action>\n <write_files>src/t1.mjs</write_files>\n <verify>node --check src/t1.mjs</verify>\n</task>\n');
|
|
24
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
24
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
25
25
|
writeFile(dir, 'src/t1.mjs', 'export const x = 1;\n');
|
|
26
26
|
execFileSync('git', ['add', 'src/t1.mjs'], { cwd: dir });
|
|
27
27
|
execFileSync('git', ['-c', 'user.name=t', '-c', 'user.email=t@t', 'commit', '-qm', 'feat: t1'], { cwd: dir });
|
|
@@ -255,7 +255,7 @@ export const ENTRIES = [
|
|
|
255
255
|
if (!fs.readFileSync(parallelTaskPath, 'utf8').includes('<task id="P16" parallel="true" status="pending">')) {
|
|
256
256
|
throw new Error('并行 × 零提交锚的前提失效:TASK.md 未标 parallel="true"');
|
|
257
257
|
}
|
|
258
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
258
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
259
259
|
const stParallel = readStateFile(dir);
|
|
260
260
|
stParallel.currentNode = 'subagent-execute';
|
|
261
261
|
stParallel.enteredNodes = ['open', 'design', 'plan', 'execute', 'subagent-execute'];
|
|
@@ -359,7 +359,7 @@ export const ENTRIES = [
|
|
|
359
359
|
execFileSync('git', ['add', 'src/p02.mjs'], { cwd: dir });
|
|
360
360
|
execFileSync('git', ['-c', 'user.name=t', '-c', 'user.email=t@t', 'commit', '-qm', 'feat: p02'], { cwd: dir });
|
|
361
361
|
const p02Hash = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: dir, encoding: 'utf8' }).trim();
|
|
362
|
-
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
362
|
+
assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
363
363
|
const ownershipStatePath = path.join(dir, '.flow-comet', 'flow-comet-state.json');
|
|
364
364
|
const ownershipBytes = fs.readFileSync(ownershipStatePath, 'utf8');
|
|
365
365
|
const wrongNode = runHandoff(['request', 'P02', 'P02 委托', '--write-files', 'src/p02.mjs'], dir, ownershipEnv);
|
|
@@ -382,7 +382,7 @@ export const ENTRIES = [
|
|
|
382
382
|
if (readStateFile(dir).currentNode !== 'subagent-execute') {
|
|
383
383
|
throw new Error('next 未按路由校正 state.currentNode: ' + JSON.stringify(readStateFile(dir).currentNode));
|
|
384
384
|
}
|
|
385
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
385
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
386
386
|
assertExit(runGuard(['entry', 'subagent-execute'], dir), 0);
|
|
387
387
|
const correctedRequest = runHandoff(['request', 'P02', 'P02 委托', '--write-files', 'src/p02.mjs'], dir, ownershipEnv);
|
|
388
388
|
assertExit(correctedRequest, 0);
|
|
@@ -648,7 +648,7 @@ export const ENTRIES = [
|
|
|
648
648
|
const hash = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: dir, encoding: 'utf8' }).trim();
|
|
649
649
|
// ① 空交接拦截:record 仅写空 handoffResult → 出口缺证据(无委托不可 exit)
|
|
650
650
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
651
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
651
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
652
652
|
assertExit(runState(['record', 'subagent-execute', '{"handoffResult":{}}'], dir), 0);
|
|
653
653
|
const stEmpty = readStateFile(dir);
|
|
654
654
|
stEmpty.currentNode = 'subagent-execute';
|
|
@@ -703,7 +703,7 @@ export const ENTRIES = [
|
|
|
703
703
|
const rDeclBlock = runGuard(['exit', 'subagent-execute'], dir);
|
|
704
704
|
assertExit(rDeclBlock, 1);
|
|
705
705
|
assertOut(rDeclBlock, 'exit 缺协议声明标记');
|
|
706
|
-
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
|
|
706
|
+
assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
|
|
707
707
|
const rDeclPass = runGuard(['exit', 'subagent-execute'], dir);
|
|
708
708
|
assertExit(rDeclPass, 0);
|
|
709
709
|
assertOut(rDeclPass, 'ALL CHECKS PASSED');
|