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.
Files changed (89) hide show
  1. package/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
  2. package/.flow-comet/skills/flow-comet/SKILL.md +32 -18
  3. package/.flow-comet/skills/flow-comet/reference/commit-discipline.md +2 -2
  4. package/.flow-comet/skills/flow-comet/reference/decision-points.md +5 -5
  5. package/.flow-comet/skills/flow-comet/reference/dirty-worktree.md +1 -1
  6. package/.flow-comet/skills/flow-comet/reference/entry-detail.md +30 -11
  7. package/.flow-comet/skills/flow-comet/reference/fix-loop.md +4 -4
  8. package/.flow-comet/skills/flow-comet/reference/init-detection.md +1 -1
  9. package/.flow-comet/skills/flow-comet/reference/platform-facts.md +2 -2
  10. package/.flow-comet/skills/flow-comet/reference/post-archive-handoff.md +264 -0
  11. package/.flow-comet/skills/flow-comet/reference/recovery.md +1 -1
  12. package/.flow-comet/skills/flow-comet/reference/replan.md +1 -1
  13. package/.flow-comet/skills/flow-comet/scripts/comet-check.mjs +1 -0
  14. package/.flow-comet/skills/flow-comet/scripts/comet-hook-guard.mjs +270 -30
  15. package/.flow-comet/skills/flow-comet/scripts/context-init.mjs +26 -23
  16. package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +14 -94
  17. package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +122 -11
  18. package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +79 -40
  19. package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +11 -9
  20. package/.flow-comet/skills/flow-comet/scripts/items/e.mjs +52 -10
  21. package/.flow-comet/skills/flow-comet/scripts/items/f.mjs +1 -1
  22. package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +128 -56
  23. package/.flow-comet/skills/flow-comet/scripts/items/k.mjs +357 -3
  24. package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +26 -1
  25. package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +6 -2
  26. package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +29 -21
  27. package/.flow-comet/skills/flow-comet/scripts/lib/ac-coverage.mjs +317 -0
  28. package/.flow-comet/skills/flow-comet/scripts/lib/fix-loop-node.mjs +4 -15
  29. package/.flow-comet/skills/flow-comet/scripts/lib/guard-artifact-skeleton.mjs +47 -5
  30. package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +357 -219
  31. package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +725 -309
  32. package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +182 -54
  33. package/.flow-comet/skills/flow-comet/scripts/lib/guard-state-io.mjs +8 -6
  34. package/.flow-comet/skills/flow-comet/scripts/lib/guard-template-fidelity.mjs +224 -83
  35. package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +17 -28
  36. package/.flow-comet/skills/flow-comet/scripts/lib/lessons-hits.mjs +160 -0
  37. package/.flow-comet/skills/flow-comet/scripts/lib/run-root.mjs +21 -0
  38. package/.flow-comet/skills/flow-comet/scripts/lib/section-body.mjs +92 -0
  39. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-admin.mjs +61 -33
  40. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +663 -205
  41. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-recovery.mjs +68 -9
  42. package/.flow-comet/skills/flow-comet/scripts/lib/state-determine.mjs +11 -4
  43. package/.flow-comet/skills/flow-comet/scripts/lib/state-explain.mjs +92 -13
  44. package/.flow-comet/skills/flow-comet/scripts/lib/state-io.mjs +232 -11
  45. package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +140 -74
  46. package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +8 -4
  47. package/.flow-comet/skills/flow-comet/scripts/lib/task-graph.mjs +84 -31
  48. package/.flow-comet/skills/flow-comet/scripts/lib/test-assertions.mjs +0 -3
  49. package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +248 -24
  50. package/.flow-comet/skills/flow-comet/scripts/lib/test-helpers.mjs +63 -3
  51. package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +181 -8
  52. package/.flow-comet/skills/flow-comet/scripts/lib/wave-projection.mjs +340 -0
  53. package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +132 -20
  54. package/.flow-comet/skills/flow-comet/scripts/route-node.mjs +12 -5
  55. package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +1564 -54
  56. package/.flow-comet/skills/flow-comet/scripts/scenarios/b.mjs +1489 -38
  57. package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +1466 -243
  58. package/.flow-comet/skills/flow-comet/scripts/scenarios/d.mjs +743 -24
  59. package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +220 -92
  60. package/.flow-comet/skills/flow-comet/scripts/scenarios/f.mjs +657 -21
  61. package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +41 -27
  62. package/.flow-comet/skills/flow-comet/scripts/scenarios/h.mjs +285 -9
  63. package/.flow-comet/skills/flow-comet/scripts/scenarios/i.mjs +7 -6
  64. package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +21 -15
  65. package/.flow-comet/skills/flow-comet/scripts/scenarios/k.mjs +8 -5
  66. package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +45 -36
  67. package/.flow-comet/skills/flow-comet/scripts/scenarios/m.mjs +2 -2
  68. package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +2381 -85
  69. package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +135 -2
  70. package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +143 -16
  71. package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +339 -103
  72. package/.flow-comet/skills/flow-comet/scripts/workflow-state.mjs +5 -2
  73. package/.flow-comet/skills/flow-comet-archive/SKILL.md +33 -11
  74. package/.flow-comet/skills/flow-comet-change/SKILL.md +1 -1
  75. package/.flow-comet/skills/flow-comet-design/SKILL.md +5 -3
  76. package/.flow-comet/skills/flow-comet-dev/SKILL.md +2 -2
  77. package/.flow-comet/skills/flow-comet-execute/SKILL.md +37 -13
  78. package/.flow-comet/skills/flow-comet-integration/SKILL.md +10 -4
  79. package/.flow-comet/skills/flow-comet-plan/GUIDANCE.md +1 -1
  80. package/.flow-comet/skills/flow-comet-plan/SKILL.md +13 -6
  81. package/.flow-comet/skills/flow-comet-review/SKILL.md +21 -12
  82. package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +1 -1
  83. package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +43 -18
  84. package/.flow-comet/skills/flow-comet-task/SKILL.md +4 -2
  85. package/.flow-comet/skills/flow-comet-ui-design/SKILL.md +2 -2
  86. package/.flow-comet/skills/flow-comet-verify/SKILL.md +1 -1
  87. package/README.md +2 -2
  88. package/package.json +1 -1
  89. package/scripts/dsh-bridge.mjs +238 -21
@@ -22,6 +22,7 @@ import {
22
22
  routeNodeModule,
23
23
  strictSummary,
24
24
  writeIntakeArtifacts,
25
+ writeNodeDeclarationMarkers,
25
26
  } from '../lib/test-fixtures.mjs';
26
27
  import {
27
28
  FIX_RETURN_FAMILY_COMPLETED,
@@ -87,6 +88,7 @@ export const ENTRIES = [
87
88
  at: '2026-09-23T00:00:00.000Z', taskSetSignature: normalSignature,
88
89
  }],
89
90
  }));
91
+ writeNodeDeclarationMarkers(dir, 'execute');
90
92
  const beforeNormal = readScenarioState(dir);
91
93
  const resNormal = runGuard(['exit', 'execute', '--apply'], dir);
92
94
  assertExit(resNormal, 0);
@@ -197,8 +199,8 @@ export const ENTRIES = [
197
199
  verifyFailures: 0,
198
200
  executionMode: 'subagent',
199
201
  directOverride: false,
200
- newChange: true,
201
202
  });
203
+ writeNodeDeclarationMarkers(dir, 'execute');
202
204
  const res = runGuard(['exit', 'execute', '--apply'], dir);
203
205
  assertExit(res, 0);
204
206
  assertOut(res, 'FIX-BATCH: 回源节点 verify(execute 出口已完成)');
@@ -239,11 +241,13 @@ export const ENTRIES = [
239
241
  verifyFailures: 0,
240
242
  executionMode: 'subagent',
241
243
  directOverride: false,
242
- newChange: true,
243
244
  };
244
245
  // ① 新 change:review 源直接 exit review --apply → BLOCKED + 恢复指引(不得静默放行)
245
246
  writeFile(dir, taskPath, fixBatchTaskText('pending'));
246
247
  writeState(dir, reviewState);
248
+ // 本场景先后 exit review 与 execute 两个节点:两个节点的必需声明各写一份(真实流程同形)。
249
+ writeNodeDeclarationMarkers(dir, 'review');
250
+ writeNodeDeclarationMarkers(dir, 'execute');
247
251
  const resBlock = runGuard(['exit', 'review', '--apply'], dir);
248
252
  assertExit(resBlock, 1);
249
253
  assertOut(resBlock, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
@@ -339,11 +343,16 @@ export const ENTRIES = [
339
343
  };
340
344
  writeState(dir, after);
341
345
  assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
346
+ // 协议 execute.requiredSkillCalls = flow-comet-dev(guarded):节点实现技能与必需技能是两个声明面,
347
+ // 出口的覆盖判据要求后者也有标记(只声明实现技能时覆盖缺口会被拦下)。
348
+ assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
342
349
  const recDoneExit = runGuard(['exit', 'execute', '--apply'], dir);
343
350
  assertExit(recDoneExit, 0);
344
351
  assertOut(recDoneExit, 'FIX-BATCH: 回源节点 review(execute 出口已完成)');
345
352
  assertOut(recDoneExit, 'NODE: review');
346
353
  assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md']), 0);
354
+ // review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test)
355
+ assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md']), 0);
347
356
  assertExit(runGuard(['entry', 'review'], dir), 0);
348
357
  const recDoneReview = runGuard(['exit', 'review', '--apply'], dir);
349
358
  assertExit(recDoneReview, 0);
@@ -387,11 +396,14 @@ export const ENTRIES = [
387
396
  };
388
397
  writeState(dir, after);
389
398
  assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
399
+ assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
390
400
  const recDoneVerifyExit = runGuard(['exit', 'execute', '--apply'], dir);
391
401
  assertExit(recDoneVerifyExit, 0);
392
402
  assertOut(recDoneVerifyExit, 'FIX-BATCH: 回源节点 verify(execute 出口已完成)');
393
403
  assertOut(recDoneVerifyExit, 'NODE: verify');
394
404
  assertExit(runStateWithProtocol(dir, ['skill-load', 'verify', 'flow-comet-verify', '--prompt', 'flow-kit/prompts/7-integration.md']), 0);
405
+ // 协议 verify.requiredSkillCalls = flow-comet-integration(guarded):同一份协议文件、另一个技能面
406
+ assertExit(runStateWithProtocol(dir, ['skill-load', 'verify', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md']), 0);
395
407
  assertExit(runGuard(['entry', 'verify'], dir), 0);
396
408
  const recDoneVerify = runGuard(['exit', 'verify', '--apply'], dir);
397
409
  assertExit(recDoneVerify, 0);
@@ -400,13 +412,13 @@ export const ENTRIES = [
400
412
  if (!fs.existsSync(gateMarker) || fs.readFileSync(gateMarker, 'utf8') !== 'GATE-RAN') {
401
413
  throw new Error('闭合后 verify 出口未真实执行 TEST.md 验证命令(副作用文件缺失/内容不符)');
402
414
  }
403
- // ④ 旧 change(无 newChange 标记)pending 同路径:渐进 WARN 不阻断(向后兼容)
415
+ // ④ 同一形态(无任何新旧标记字段)pending 同路径:同判 BLOCKED(单轨,无渐进侧)
404
416
  writeFile(dir, taskPath, fixBatchTaskText('pending'));
405
- writeState(dir, { ...reviewState, newChange: false });
417
+ writeState(dir, { ...reviewState });
406
418
  const resOld = runGuard(['exit', 'review'], dir);
407
- assertExit(resOld, 0);
408
- assertOut(resOld, 'FIX-BATCH WARN');
409
- assertOut(resOld, 'ALL CHECKS PASSED');
419
+ assertExit(resOld, 1);
420
+ assertOut(resOld, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
421
+ assertNotOut(resOld, 'ALL CHECKS PASSED');
410
422
  // ④b 过渡态渐进(feature 之前创建的 state 无 exit execute 签名字段):全 done 也不得
411
423
  // 仅凭「签名缺席」误判未闭合——无签名记录 → done 变体不成立,源节点出口保持可走
412
424
  writeFile(dir, taskPath, fixBatchTaskText('done'));
@@ -464,6 +476,8 @@ export const ENTRIES = [
464
476
  throw new Error('并行修复出口应记录本 change + taskSetSignature 的家族出口事件,实际 ' + JSON.stringify(parFamilyExit));
465
477
  }
466
478
  assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md']), 0);
479
+ // review 该读两份协议、协议声明两个 guarded 技能(flow-comet-review / flow-comet-test)
480
+ assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-test', '--prompt', 'flow-kit/prompts/5-test.md', '--templates', 'REVIEW.md,TEST.md']), 0);
467
481
  assertExit(runGuard(['entry', 'review'], dir), 0);
468
482
  const rParSource = runGuard(['exit', 'review', '--apply'], dir);
469
483
  assertExit(rParSource, 0);
@@ -546,7 +560,6 @@ export const ENTRIES = [
546
560
  verifyFailures: 0,
547
561
  executionMode: 'subagent',
548
562
  directOverride: false,
549
- newChange: true,
550
563
  };
551
564
  // ① review 源:pending Fix 任务在场 → NODE: execute + 审计行 + 机器字段归位写盘
552
565
  writeFile(dir, taskPath, fixBatchTaskText('pending'));
@@ -603,7 +616,6 @@ export const ENTRIES = [
603
616
  verifyFailures: 0,
604
617
  executionMode: 'subagent',
605
618
  directOverride: false,
606
- newChange: true,
607
619
  };
608
620
  // ③ 反例:全 done(无 pending Fix 任务)→ 非回退态,不得归位 execute(回程逻辑另行覆盖)
609
621
  let after;
@@ -647,7 +659,6 @@ export const ENTRIES = [
647
659
  verifyFailures: 0,
648
660
  executionMode: 'subagent',
649
661
  directOverride: false,
650
- newChange: true,
651
662
  };
652
663
  // ④ done-but-unclosed 回退态(全 done + history 最新 exit execute 签名仍是追加前值):
653
664
  // next 同样显式归位 execute(修复前 done 变体无恢复通道,next 停在源节点)。
@@ -691,7 +702,6 @@ export const ENTRIES = [
691
702
  verifyFailures: 0,
692
703
  executionMode: 'subagent',
693
704
  directOverride: false,
694
- newChange: true,
695
705
  };
696
706
  // ⑤ review 源 + 并行 pending Fix 任务:next 必须归位 subagent-execute(并行路由目标),
697
707
  // 不得停在源节点,也不得错配回 execute。
@@ -765,7 +775,6 @@ export const ENTRIES = [
765
775
  verifyFailures: 0,
766
776
  executionMode: 'subagent',
767
777
  directOverride: false,
768
- newChange: true,
769
778
  };
770
779
  // ⑧ m-12 next 入口第 1~3 轮递增:逐轮重置驻留 review,审计后缀第 n/3 轮且计数器同步 +1
771
780
  writeFile(dir, taskPath, fixBatchTaskText('pending'));
@@ -856,7 +865,6 @@ export const ENTRIES = [
856
865
  verifyFailures: 0,
857
866
  executionMode: 'subagent',
858
867
  directOverride: false,
859
- newChange: true,
860
868
  };
861
869
  // ① 真实回程态(review 已 entry)→ 审计行 + NODE: review + state 只读不改写
862
870
  writeState(dir, base);
@@ -929,7 +937,6 @@ export const ENTRIES = [
929
937
  verifyFailures: 0,
930
938
  executionMode: 'subagent',
931
939
  directOverride: false,
932
- newChange: true,
933
940
  };
934
941
  // ① 真实回程态(verify 已 entry)→ 审计行 + NODE: verify + state 只读不改写
935
942
  writeState(dir, base);
@@ -994,7 +1001,6 @@ export const ENTRIES = [
994
1001
  verifyFailures: 0,
995
1002
  executionMode: 'subagent',
996
1003
  directOverride: false,
997
- newChange: true,
998
1004
  });
999
1005
  const res = runStateWithProtocol(dir, ['next']);
1000
1006
  assertExit(res, 0);
@@ -42,6 +42,7 @@ import {
42
42
  runPlanExit,
43
43
  strictSummary,
44
44
  writeIntakeArtifacts,
45
+ writeNodeDeclarationMarkers,
45
46
  } from '../lib/test-fixtures.mjs';
46
47
  import {
47
48
  REENTRY_EXPECTED_INTERSECTION,
@@ -370,7 +371,6 @@ export const ENTRIES = [
370
371
  run: (dir) => {
371
372
  writeReentryChangeDir(dir);
372
373
  const legacyState = reentryArchiveState();
373
- delete legacyState.newChange;
374
374
  writeState(dir, legacyState);
375
375
  const blockedBytes = readStateBytes(dir);
376
376
  const resBlocked = runReenter(dir, 'verify');
@@ -635,7 +635,6 @@ export const ENTRIES = [
635
635
  // ① plan 出口(既有判定路径)对同一输入的机器分类
636
636
  const planState = baseState('plan');
637
637
  planState.evidence.plan = { summary: 'plan done' };
638
- planState.newChange = true;
639
638
  writeState(dir, planState);
640
639
  const planRes = runPlanExit(dir, taskContent);
641
640
  assertExit(planRes, 1);
@@ -903,8 +902,12 @@ export const ENTRIES = [
903
902
  }
904
903
  }
905
904
  if (replanProblems(stateText).length !== 0) throw new Error('反向构造还原后未复绿');
906
- if (!/WARN: TASK\.md 同文件跨任务且无依赖路径(旧 change 渐进不阻断)/.test(stateText)) {
907
- throw new Error('replan 的第三族必须保留旧 change 渐进分支(WARN 不阻断)');
905
+ // 单轨:replan 的第三族不再有渐进分支——源码里必须是 BLOCKED 且带「replan 不做校验豁免」口径
906
+ if (!/BLOCKED: TASK\.md 同文件跨任务且无依赖路径/.test(stateText)) {
907
+ throw new Error('replan 的第三族必须是单轨 BLOCKED(无渐进分支)');
908
+ }
909
+ if (/旧 change 渐进不阻断/.test(stateText)) {
910
+ throw new Error('replan 的第三族不得残留旧 change 渐进分支');
908
911
  }
909
912
  },
910
913
  },
@@ -949,7 +952,6 @@ export const ENTRIES = [
949
952
  // 修复族对 → exit 0 且不出现该族消息(BLOCKED / WARN 两形态都不许有)。
950
953
  const crossState = baseState('plan');
951
954
  crossState.evidence.plan = { summary: 'plan done' };
952
- crossState.newChange = true;
953
955
  writeState(dir, crossState);
954
956
  const plainRes = runPlanExit(dir, CROSS_TASK_PLAIN_PAIR);
955
957
  assertExit(plainRes, 1);
@@ -1126,6 +1128,7 @@ export const ENTRIES = [
1126
1128
  // 判据 / 计数。
1127
1129
  writeIntakeArtifacts(dir);
1128
1130
  writeState(dir, replanExecuteState());
1131
+ writeNodeDeclarationMarkers(dir, 'execute');
1129
1132
  assertExit(runGuard(['entry', 'execute'], dir), 0);
1130
1133
  // 任务集修订(#119 死锁现场):新增计划外的并行就绪任务
1131
1134
  writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', REPLAN_TASK_REVISED);
@@ -18,12 +18,6 @@ import {
18
18
  } from '../lib/test-helpers.mjs';
19
19
  import {
20
20
  CHANGE_ID,
21
- REPO_ROOT,
22
- SCRIPTS_DIR,
23
- SIDE_CONTEXT_SCAN,
24
- SIDE_EVOLVE,
25
- SIDE_HEALTH,
26
- SKILL_PROTOCOL_FILE,
27
21
  contextInitModule,
28
22
  copyEngineTree,
29
23
  engineConsumersOf,
@@ -33,14 +27,23 @@ import {
33
27
  handoffFor,
34
28
  hasNamedImport,
35
29
  makeTmp,
30
+ REPO_ROOT,
36
31
  requireModuleExport,
37
32
  runSideScript,
38
- skillTreeDocFiles,
33
+ SCRIPTS_DIR,
34
+ SIDE_CONTEXT_SCAN,
35
+ SIDE_EVOLVE,
36
+ SIDE_HEALTH,
37
+ SKILL_PROTOCOL_FILE,
39
38
  skillsRootForScriptsDir,
39
+ skillTreeDocFiles,
40
40
  stateSchemaModule,
41
+ strictSummary,
41
42
  timeSingleSourceConsumerProblems,
42
43
  timeUtilsModule,
43
44
  treeFingerprint,
45
+ writeAllNodeDeclarationMarkers,
46
+ writeNodeDeclarationMarkers,
44
47
  } from '../lib/test-fixtures.mjs';
45
48
  import {
46
49
  REPLAN_STALE_SIGNATURE,
@@ -97,13 +100,14 @@ export const ENTRIES = [
97
100
  writeState(dir, st);
98
101
  writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
99
102
  '# TASK\n\n<task id="T01" parallel="false" status="done"><action>串行任务已完成但缺 SUMMARY</action><write_files>src/t1.mjs</write_files><verify>node --check src/t1.mjs</verify></task>\n');
103
+ writeFile(dir, '.specs/' + CHANGE_ID + '/T01-SUMMARY.md', strictSummary('T01'));
100
104
  const res = runGuard(['exit', 'execute', '--apply'], dir);
101
105
  assertExit(res, 1);
102
106
  assertOut(res, 'BLOCKED');
103
- assertOut(res, 'task-summaries');
104
107
  assertOut(res, 'EMPTY-EXIT 未生效');
105
108
  assertNotOut(res, '豁免已生效');
106
109
  // 反向子锚:全并行 change 时豁免仍生效,且输出被跳过项清单(补既有全 parallel 通过锚)
110
+ writeNodeDeclarationMarkers(dir, 'execute');
107
111
  writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
108
112
  '# TASK\n\n<task id="P01" parallel="true" status="pending"><action>并行任务</action><write_files>src/p1.mjs</write_files><verify>node --check src/p1.mjs</verify></task>\n');
109
113
  const resParallel = runGuard(['exit', 'execute', '--apply'], dir);
@@ -678,9 +682,10 @@ export const ENTRIES = [
678
682
  {
679
683
  name: '285 ui-design 门四类:前端齐备放行 / 前端缺件 BLOCK / 非前端可见跳过 / 旧 change WARN',
680
684
  run: (dir) => {
685
+ writeNodeDeclarationMarkers(dir, 'design', { frontend: true });
681
686
  // 正例:前端(「视觉调性」段在场且未标注不适用)+ 工件齐备 + 真实声明
682
687
  writeDesignExitFixture(dir, {
683
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: true,
688
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: true,
684
689
  });
685
690
  const positive = runGuardWithProtocol(dir, ['exit', 'design']);
686
691
  assertExit(positive, 0);
@@ -689,7 +694,7 @@ export const ENTRIES = [
689
694
 
690
695
  // 负例 A:前端缺 UI-DESIGN.md → BLOCKED + 两条恢复路径
691
696
  writeDesignExitFixture(dir, {
692
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
697
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
693
698
  });
694
699
  const missingArtifact = runGuardWithProtocol(dir, ['exit', 'design']);
695
700
  assertExit(missingArtifact, 1);
@@ -698,7 +703,7 @@ export const ENTRIES = [
698
703
 
699
704
  // 负例 B:工件齐备但缺 `required-skill:design.flow-comet-ui-design` → BLOCKED(出口不再自动补写)
700
705
  writeDesignExitFixture(dir, {
701
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: false,
706
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: false,
702
707
  });
703
708
  const missingDeclaration = runGuardWithProtocol(dir, ['exit', 'design']);
704
709
  assertExit(missingDeclaration, 1);
@@ -707,21 +712,20 @@ export const ENTRIES = [
707
712
 
708
713
  // 越界:非前端(「视觉调性」段标注不适用)→ 可见跳过,不要求工件、也不要求该声明
709
714
  writeDesignExitFixture(dir, {
710
- newChange: true, visualTone: VISUAL_TONE_NOT_APPLICABLE, uiDesign: false, declareUiDesign: false,
715
+ visualTone: VISUAL_TONE_NOT_APPLICABLE, uiDesign: false, declareUiDesign: false,
711
716
  });
712
717
  const nonFrontend = runGuardWithProtocol(dir, ['exit', 'design']);
713
718
  assertExit(nonFrontend, 0);
714
719
  assertOut(nonFrontend, 'UI-DESIGN: skipped(非前端)');
715
720
  assertOut(nonFrontend, 'ALL CHECKS PASSED');
716
721
 
717
- // 恢复:旧 change 前端缺件 → WARN 渐进(不阻断,也不静默放行)
722
+ // 同构缺件(无任何新旧标记字段)→ 同判 BLOCKED(单轨,无渐进侧)
718
723
  writeDesignExitFixture(dir, {
719
- newChange: false, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
724
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
720
725
  });
721
726
  const legacy = runGuardWithProtocol(dir, ['exit', 'design']);
722
- assertExit(legacy, 0);
723
- assertOut(legacy, 'UI-DESIGN WARN: 缺 .specs/' + CHANGE_ID + '/UI-DESIGN.md');
724
- assertOut(legacy, '旧 change 渐进不阻断');
727
+ assertExit(legacy, 1);
728
+ assertOut(legacy, 'BLOCKED: design 出口缺 UI-DESIGN.md');
725
729
  },
726
730
  },
727
731
 
@@ -818,11 +822,14 @@ export const ENTRIES = [
818
822
  });
819
823
  assertTrue(pointerStripped.some((problem) => problem.includes('指针不在场')),
820
824
  '抽掉各册指针未被判违规: ' + JSON.stringify(pointerStripped));
821
- // 行为口径的散文锚:非前端可见跳过 + 旧 change 渐进(与 285 的行为断言同源)
825
+ // 行为口径的散文锚:非前端可见跳过 + 同一形态一个判级(与 285 的行为断言同源)。
826
+ // 分级双轨已退役:正向锚单轨表述,负向锚旧「旧 change 渐进 WARN」措辞零残留——两侧共守,
827
+ // 回流即红(旧锁要求「旧 change」在场,等于给已退役的分级背书)。
822
828
  const uiDesignSkill = fs.readFileSync(texts['flow-comet-ui-design/SKILL.md'], 'utf8');
823
829
  assertTrue(uiDesignSkill.includes('UI-DESIGN: skipped(非前端)'), 'ui-design 技能缺非前端跳过口径');
824
- assertTrue(uiDesignSkill.includes('旧 change') && uiDesignSkill.includes('WARN'),
825
- 'ui-design 技能缺旧 change 渐进口径');
830
+ assertTrue(uiDesignSkill.includes('同一形态一个判级'), 'ui-design 技能缺单轨判级口径(同一形态一个判级)');
831
+ assertTrue(!/旧\s*change[^。\n]{0,24}(WARN|渐进)/.test(uiDesignSkill),
832
+ 'ui-design 技能残留旧分级口径(旧 change 渐进 WARN 应零残留)');
826
833
  },
827
834
  },
828
835
 
@@ -854,7 +861,7 @@ export const ENTRIES = [
854
861
  assertOut(setRes, 'CONFIG: last_evolve_at = ' + baseline);
855
862
 
856
863
  // ② 真实 init 换 change——跨 change 的全部动作就是这一步(不碰 writeState)
857
- const secondInit = runStateWithProtocol(dir, ['init', CHANGE_ID + '-2', '--init-skip']);
864
+ const secondInit = runStateWithProtocol(dir, ['init', CHANGE_ID + '-2', '--init-skip', '--replace', CHANGE_ID, '--reason', '验证跨 change 保留演化基线']);
858
865
  assertExit(secondInit, 0);
859
866
  const state = JSON.parse(readStateBytes(dir));
860
867
  assertEqual(state.activeChange, CHANGE_ID + '-2', 'init 后 activeChange');
@@ -888,10 +895,11 @@ export const ENTRIES = [
888
895
  {
889
896
  name: '288 ui-design 门按协议绑定键控:删绑定门退场(可见行)/ 在场仍拦 / 其它绑定零改动 / 写回即恢复',
890
897
  run: (dir) => {
898
+ writeNodeDeclarationMarkers(dir, 'design', { frontend: true });
891
899
  // 负例:协议删掉该绑定 → 前端判据成立且缺件也不再拦(门随绑定退场)
892
900
  writeUiDesignBindingVariant(dir, 'absent');
893
901
  writeDesignExitFixture(dir, {
894
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
902
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
895
903
  });
896
904
  const absent = runGuardWithProtocol(dir, ['exit', 'design']);
897
905
  assertExit(absent, 0);
@@ -903,7 +911,7 @@ export const ENTRIES = [
903
911
  // 越界:绑定缺席时 design 的另一 guarded 绑定(flow-comet-design)仍由出口自动补写——
904
912
  // 零真实声明也放行,证明自动补语义只在登记表命中的绑定上改道
905
913
  writeDesignExitFixture(dir, {
906
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: false, declareDesign: false,
914
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: false, declareDesign: false,
907
915
  });
908
916
  const otherBindings = runGuardWithProtocol(dir, ['exit', 'design']);
909
917
  assertExit(otherBindings, 0);
@@ -912,7 +920,7 @@ export const ENTRIES = [
912
920
  // 正例:协议写回 guarded 绑定 → 同一夹具、同一 change 立刻恢复拦截(与既有语义逐字一致)
913
921
  writeUiDesignBindingVariant(dir, 'guarded');
914
922
  writeDesignExitFixture(dir, {
915
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
923
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
916
924
  });
917
925
  const guardedInPlace = runGuardWithProtocol(dir, ['exit', 'design']);
918
926
  assertExit(guardedInPlace, 1);
@@ -921,7 +929,7 @@ export const ENTRIES = [
921
929
 
922
930
  // 恢复:补齐工件 + 真实声明 → 出口放行(恢复路径未被键控改动波及)
923
931
  writeDesignExitFixture(dir, {
924
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: true,
932
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: true,
925
933
  });
926
934
  const recovered = runGuardWithProtocol(dir, ['exit', 'design']);
927
935
  assertExit(recovered, 0);
@@ -936,10 +944,11 @@ export const ENTRIES = [
936
944
  {
937
945
  name: '289 ui-design 门按协议等级键控:调回 advisory 不再拦且自动补写原语义 / 写回 guarded 即恢复',
938
946
  run: (dir) => {
947
+ writeNodeDeclarationMarkers(dir, 'design', { frontend: true });
939
948
  // 负例:等级调回 advisory → 缺工件 + 零真实声明也放行(自动补写保持原语义)
940
949
  writeUiDesignBindingVariant(dir, 'advisory');
941
950
  writeDesignExitFixture(dir, {
942
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: false,
951
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: false,
943
952
  });
944
953
  const advisory = runGuardWithProtocol(dir, ['exit', 'design']);
945
954
  assertExit(advisory, 0);
@@ -950,7 +959,7 @@ export const ENTRIES = [
950
959
 
951
960
  // 越界:同一节点的另一 guarded 绑定零真实声明仍放行(自动补语义未被本次键控改道)
952
961
  writeDesignExitFixture(dir, {
953
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: false, declareDesign: false,
962
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: false, declareDesign: false,
954
963
  });
955
964
  const otherBindings = runGuardWithProtocol(dir, ['exit', 'design']);
956
965
  assertExit(otherBindings, 0);
@@ -959,7 +968,7 @@ export const ENTRIES = [
959
968
  // 正例:等级写回 guarded → 缺件与缺声明双拦截同时回来
960
969
  writeUiDesignBindingVariant(dir, 'guarded');
961
970
  writeDesignExitFixture(dir, {
962
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
971
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: false, declareUiDesign: true,
963
972
  });
964
973
  const guardedInPlace = runGuardWithProtocol(dir, ['exit', 'design']);
965
974
  assertExit(guardedInPlace, 1);
@@ -968,7 +977,7 @@ export const ENTRIES = [
968
977
 
969
978
  // 恢复:补齐工件 + 真实声明 → 放行
970
979
  writeDesignExitFixture(dir, {
971
- newChange: true, visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: true,
980
+ visualTone: VISUAL_TONE_APPLICABLE, uiDesign: true, declareUiDesign: true,
972
981
  });
973
982
  const recovered = runGuardWithProtocol(dir, ['exit', 'design']);
974
983
  assertExit(recovered, 0);
@@ -984,9 +993,10 @@ export const ENTRIES = [
984
993
  {
985
994
  name: '290 负向标记结构约束:独立行·行首·字段值位跳过并回显片段 / 自然句子·子维度字段·段外标记不关闸',
986
995
  run: (dir) => {
996
+ writeNodeDeclarationMarkers(dir, 'design', { frontend: true });
987
997
  // 负例:自然句子(标记词在行首且后接「于」,句内再出现一次)→ 判据仍是前端 ⇒ 缺件 BLOCKED
988
998
  writeDesignExitFixture(dir, {
989
- newChange: true, visualTone: VISUAL_TONE_NATURAL_SENTENCE, uiDesign: false, declareUiDesign: true,
999
+ visualTone: VISUAL_TONE_NATURAL_SENTENCE, uiDesign: false, declareUiDesign: true,
990
1000
  });
991
1001
  const naturalSentence = runGuardWithProtocol(dir, ['exit', 'design']);
992
1002
  assertExit(naturalSentence, 1);
@@ -997,7 +1007,7 @@ export const ENTRIES = [
997
1007
  // 负例(结构形态的越界面):子维度字段 `- 暗色主题:不适用` 是结构形态但主体不是本 change
998
1008
  // 的适用性 ⇒ 仍判前端(标签表把可误伤的字段形态挡在外面)
999
1009
  writeDesignExitFixture(dir, {
1000
- newChange: true, visualTone: VISUAL_TONE_SUBDIMENSION_FIELD, uiDesign: false, declareUiDesign: true,
1010
+ visualTone: VISUAL_TONE_SUBDIMENSION_FIELD, uiDesign: false, declareUiDesign: true,
1001
1011
  });
1002
1012
  const subDimensionField = runGuardWithProtocol(dir, ['exit', 'design']);
1003
1013
  assertExit(subDimensionField, 1);
@@ -1006,7 +1016,6 @@ export const ENTRIES = [
1006
1016
 
1007
1017
  // 越界:标记出现在「视觉调性」段之外的独立行 → 不参与判据(判据限段内)
1008
1018
  writeDesignExitFixture(dir, {
1009
- newChange: true,
1010
1019
  visualTone: VISUAL_TONE_APPLICABLE,
1011
1020
  changeTail: '\n## 范围排除(Out of Scope)\n\n不适用。\n',
1012
1021
  uiDesign: false,
@@ -1019,7 +1028,7 @@ export const ENTRIES = [
1019
1028
 
1020
1029
  // 正例 A:独立行(带括注理由)→ 可见跳过 + 回显命中片段
1021
1030
  writeDesignExitFixture(dir, {
1022
- newChange: true, visualTone: VISUAL_TONE_NOT_APPLICABLE, uiDesign: false, declareUiDesign: false,
1031
+ visualTone: VISUAL_TONE_NOT_APPLICABLE, uiDesign: false, declareUiDesign: false,
1023
1032
  });
1024
1033
  const standalone = runGuardWithProtocol(dir, ['exit', 'design']);
1025
1034
  assertExit(standalone, 0);
@@ -1029,7 +1038,7 @@ export const ENTRIES = [
1029
1038
 
1030
1039
  // 正例 B:字段值位(`- 适用性:不适用(…)`)→ 同样判非前端(结构形态之二,非行首)
1031
1040
  writeDesignExitFixture(dir, {
1032
- newChange: true, visualTone: VISUAL_TONE_FIELD_MARKER, uiDesign: false, declareUiDesign: false,
1041
+ visualTone: VISUAL_TONE_FIELD_MARKER, uiDesign: false, declareUiDesign: false,
1033
1042
  });
1034
1043
  const fieldValue = runGuardWithProtocol(dir, ['exit', 'design']);
1035
1044
  assertExit(fieldValue, 0);
@@ -1039,7 +1048,7 @@ export const ENTRIES = [
1039
1048
 
1040
1049
  // 正例 C:行首形态(标记 + 破折号理由,非独立行)→ 同样判非前端
1041
1050
  writeDesignExitFixture(dir, {
1042
- newChange: true, visualTone: VISUAL_TONE_LINE_HEAD_MARKER, uiDesign: false, declareUiDesign: false,
1051
+ visualTone: VISUAL_TONE_LINE_HEAD_MARKER, uiDesign: false, declareUiDesign: false,
1043
1052
  });
1044
1053
  const lineHead = runGuardWithProtocol(dir, ['exit', 'design']);
1045
1054
  assertExit(lineHead, 0);
@@ -1049,7 +1058,7 @@ export const ENTRIES = [
1049
1058
 
1050
1059
  // 恢复:把调性段改成结构形态(标注路径)→ 同一 change 放行,命中片段一并回显
1051
1060
  writeDesignExitFixture(dir, {
1052
- newChange: true, visualTone: VISUAL_TONE_NOT_APPLICABLE, uiDesign: false, declareUiDesign: false,
1061
+ visualTone: VISUAL_TONE_NOT_APPLICABLE, uiDesign: false, declareUiDesign: false,
1053
1062
  });
1054
1063
  const recovered = runGuardWithProtocol(dir, ['exit', 'design']);
1055
1064
  assertExit(recovered, 0);
@@ -915,7 +915,7 @@ export const ENTRIES = [
915
915
 
916
916
  // ② 段缺席(CONTEXT 不含 intel-scan 段)→ 无可比对面 → 零提示
917
917
  writeFile(dir, '.specs/CONTEXT.md', contextFixtureText({ intelSection: false }));
918
- const noSection = runStateWithProtocol(dir, ['init', CHANGE_ID + '-no-section']);
918
+ const noSection = runStateWithProtocol(dir, ['init', CHANGE_ID + '-no-section', '--replace', CHANGE_ID, '--reason', '验证段缺席零误报']);
919
919
  assertExit(noSection, 0);
920
920
  assertNotOut(noSection, 'INIT-NOTICE');
921
921
 
@@ -923,7 +923,7 @@ export const ENTRIES = [
923
923
  // 写入」长期不可见);占位词元之后的说明不参与判定(类别由词元决定)
924
924
  writeFile(dir, '.specs/CONTEXT.md',
925
925
  contextFixtureText().replace(INTEL_FIELD_VALUE, '(待扫描)'));
926
- const placeholder = runStateWithProtocol(dir, ['init', CHANGE_ID + '-placeholder']);
926
+ const placeholder = runStateWithProtocol(dir, ['init', CHANGE_ID + '-placeholder', '--replace', CHANGE_ID + '-no-section', '--reason', '验证占位取值不静默']);
927
927
  assertExit(placeholder, 0);
928
928
  assertOut(placeholder, 'INIT-NOTICE');
929
929
  assertOut(placeholder, '段内取值不是合法时间戳');