flow-comet 1.6.5 → 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 +17 -5
- package/.flow-comet/skills/flow-comet/reference/commit-discipline.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/entry-detail.md +23 -4
- 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 +97 -3
- package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +38 -2
- package/.flow-comet/skills/flow-comet/scripts/items/e.mjs +52 -10
- package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +16 -3
- package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +2 -0
- package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +4 -0
- package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +20 -11
- 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 +47 -5
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +297 -131
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +616 -151
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +96 -45
- 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 +204 -51
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +7 -9
- 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 +38 -20
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +439 -134
- 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 +92 -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 +94 -39
- package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +6 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/task-graph.mjs +84 -31
- package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +57 -7
- 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 +158 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/wave-projection.mjs +341 -0
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +92 -17
- package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +1439 -11
- package/.flow-comet/skills/flow-comet/scripts/scenarios/b.mjs +1202 -8
- package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +1204 -76
- package/.flow-comet/skills/flow-comet/scripts/scenarios/d.mjs +753 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +32 -1
- package/.flow-comet/skills/flow-comet/scripts/scenarios/f.mjs +582 -3
- package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +5 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/i.mjs +5 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +16 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/k.mjs +2 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +5 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +2041 -66
- package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +135 -0
- package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +143 -16
- 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-execute/SKILL.md +30 -6
- package/.flow-comet/skills/flow-comet-plan/SKILL.md +10 -3
- package/.flow-comet/skills/flow-comet-review/SKILL.md +20 -11
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +33 -8
- package/.flow-comet/skills/flow-comet-task/SKILL.md +2 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/dsh-bridge.mjs +2 -2
|
@@ -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 = [
|
|
@@ -87,6 +87,9 @@ export const ENTRIES = [
|
|
|
87
87
|
|
|
88
88
|
// ⑤ 回源 review 出口门禁真实执行:缺处置标记 → BLOCKED;补齐后同出口通过并推进 verify
|
|
89
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);
|
|
@@ -248,6 +253,9 @@ export const ENTRIES = [
|
|
|
248
253
|
assertNotOut(rClosedExit, 'RETURN: 回源节点');
|
|
249
254
|
assertNodeLine(rClosedExit, 'review');
|
|
250
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);
|
|
@@ -297,6 +305,9 @@ export const ENTRIES = [
|
|
|
297
305
|
throw new Error('并行修复第二趟出口应回源 review,实际 ' + JSON.stringify(pSt.currentNode));
|
|
298
306
|
}
|
|
299
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);
|
|
@@ -408,6 +421,8 @@ export const ENTRIES = [
|
|
|
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
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);
|
|
@@ -467,6 +482,8 @@ export const ENTRIES = [
|
|
|
467
482
|
directOverride: false,
|
|
468
483
|
});
|
|
469
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);
|
|
@@ -501,6 +518,8 @@ export const ENTRIES = [
|
|
|
501
518
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-0' + i + '-SUMMARY.md', execSummaryFixture('T-FIX-0' + i));
|
|
502
519
|
}
|
|
503
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);
|
|
@@ -629,6 +648,9 @@ export const ENTRIES = [
|
|
|
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
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);
|
|
@@ -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
|
|
|
@@ -775,6 +807,8 @@ export const ENTRIES = [
|
|
|
775
807
|
run: (dir) => {
|
|
776
808
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
777
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)
|
|
@@ -812,6 +846,8 @@ export const ENTRIES = [
|
|
|
812
846
|
run: (dir) => {
|
|
813
847
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
814
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);
|
|
@@ -103,18 +103,26 @@ function customProtocol() {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
//
|
|
107
|
-
|
|
106
|
+
// 协议变体(绑定面三态;`enforcement` 是出口覆盖判据的单一开关):
|
|
107
|
+
// · base —— 无 requiredSkillCalls:节点没有声明义务;
|
|
108
|
+
// · skill —— main scope 绑定、未登记等级:声明照旧由出口代记(required-skill 条目自动补写);
|
|
109
|
+
// · guarded —— main scope 绑定 + enforcement='guarded':该技能必须自己有一条声明标记。
|
|
110
|
+
function customProtocolVariant(variant) {
|
|
108
111
|
const p = customProtocol();
|
|
109
|
-
|
|
112
|
+
if (variant === 'skill') {
|
|
113
|
+
p.nodes[0].requiredSkillCalls = [{ skill: 'flow-comet-brainstorm', scope: 'main' }];
|
|
114
|
+
} else if (variant === 'guarded') {
|
|
115
|
+
p.nodes[0].requiredSkillCalls = [{ skill: 'flow-comet-brainstorm', scope: 'main', enforcement: 'guarded' }];
|
|
116
|
+
} else if (variant !== 'base') {
|
|
117
|
+
throw new Error('未知协议变体: ' + variant);
|
|
118
|
+
}
|
|
110
119
|
return p;
|
|
111
120
|
}
|
|
112
121
|
|
|
113
|
-
//
|
|
114
|
-
function writeCustomProtocol(dir,
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
fs.writeFileSync(file, JSON.stringify(proto, null, 2) + '\n', 'utf8');
|
|
122
|
+
// 写入自定义协议文件(变体见上),返回绝对路径
|
|
123
|
+
function writeCustomProtocol(dir, variant = 'base') {
|
|
124
|
+
const file = path.join(dir, variant === 'base' ? 'custom-protocol.json' : 'custom-protocol-' + variant + '.json');
|
|
125
|
+
fs.writeFileSync(file, JSON.stringify(customProtocolVariant(variant), null, 2) + '\n', 'utf8');
|
|
118
126
|
return file;
|
|
119
127
|
}
|
|
120
128
|
|
|
@@ -148,9 +156,9 @@ export const ENTRIES = [
|
|
|
148
156
|
},
|
|
149
157
|
|
|
150
158
|
{
|
|
151
|
-
name: 'E2
|
|
159
|
+
name: 'E2 自定义协议:声明机制与出口全链路(含技能绑定与 guarded 覆盖)',
|
|
152
160
|
run: (dir) => {
|
|
153
|
-
const custom = writeCustomProtocol(dir,
|
|
161
|
+
const custom = writeCustomProtocol(dir, 'skill');
|
|
154
162
|
assertExit(runState(['init', 'cp-skill', '--protocol', custom], dir), 0);
|
|
155
163
|
const env = { FLOW_COMET_PROTOCOL: custom };
|
|
156
164
|
// 自定义节点 skill-load 声明(协议节点集合动态校验)
|
|
@@ -179,6 +187,40 @@ export const ENTRIES = [
|
|
|
179
187
|
const envLoad = runGuard(['exit', 'bogus'], dir, env);
|
|
180
188
|
assertExit(envLoad, 1);
|
|
181
189
|
assertOut(envLoad, 'Unknown workflow Node');
|
|
190
|
+
|
|
191
|
+
// guarded 变体的出口覆盖判据(自定义协议路径):协议把绑定登记为 enforcement='guarded' 时,
|
|
192
|
+
// 出口要求该技能**各自**有声明标记——同节点上已声明的另一个技能不构成覆盖(record 只校验载荷里
|
|
193
|
+
// 出现的 required-skill 条目,覆盖判据要的是「每个 guarded 绑定各有一条标记」)。
|
|
194
|
+
// 对照:同一夹具换成未登记等级的绑定(skill 变体)时零该技能声明照样放行——等级是唯一开关。
|
|
195
|
+
const guardedProtocol = writeCustomProtocol(dir, 'guarded');
|
|
196
|
+
const guardedEnv = { FLOW_COMET_PROTOCOL: guardedProtocol };
|
|
197
|
+
assertExit(runState(['init', 'cp-guard', '--protocol', guardedProtocol], dir), 0);
|
|
198
|
+
assertExit(runState(['skill-load', 'brainstorm', 'flow-comet-tdd'], dir, guardedEnv), 0);
|
|
199
|
+
assertExit(runState(['record', 'brainstorm', '{"summary":"brainstorm done"}'], dir, guardedEnv), 0);
|
|
200
|
+
writeFile(dir, '.specs/cp-guard/notes.md', '# notes\n');
|
|
201
|
+
assertExit(runGuard(['entry', 'brainstorm'], dir, guardedEnv), 0);
|
|
202
|
+
const uncovered = runGuard(['exit', 'brainstorm'], dir, guardedEnv);
|
|
203
|
+
assertExit(uncovered, 1);
|
|
204
|
+
assertOut(uncovered, '缺协议声明标记');
|
|
205
|
+
assertOut(uncovered, '缺必需技能声明: flow-comet-brainstorm');
|
|
206
|
+
// 补上该绑定自己的标记 → 同一出口放行
|
|
207
|
+
assertExit(runState(['skill-load', 'brainstorm', 'flow-comet-brainstorm'], dir, guardedEnv), 0);
|
|
208
|
+
const covered = runGuard(['exit', 'brainstorm', '--apply'], dir, guardedEnv);
|
|
209
|
+
assertExit(covered, 0);
|
|
210
|
+
assertOut(covered, 'ALL CHECKS PASSED');
|
|
211
|
+
assertNotOut(covered, '缺协议声明标记');
|
|
212
|
+
// 对照:未登记等级的同一绑定 → 只声明别的技能也放行(覆盖判据不在这条路径上生效)
|
|
213
|
+
const plainProtocol = writeCustomProtocol(dir, 'skill');
|
|
214
|
+
const plainEnv = { FLOW_COMET_PROTOCOL: plainProtocol };
|
|
215
|
+
assertExit(runState(['init', 'cp-plain', '--protocol', plainProtocol], dir), 0);
|
|
216
|
+
assertExit(runState(['skill-load', 'brainstorm', 'flow-comet-tdd'], dir, plainEnv), 0);
|
|
217
|
+
assertExit(runState(['record', 'brainstorm', '{"summary":"brainstorm done"}'], dir, plainEnv), 0);
|
|
218
|
+
writeFile(dir, '.specs/cp-plain/notes.md', '# notes\n');
|
|
219
|
+
assertExit(runGuard(['entry', 'brainstorm'], dir, plainEnv), 0);
|
|
220
|
+
const ungated = runGuard(['exit', 'brainstorm'], dir, plainEnv);
|
|
221
|
+
assertExit(ungated, 0);
|
|
222
|
+
assertOut(ungated, 'ALL CHECKS PASSED');
|
|
223
|
+
assertNotOut(ungated, '缺协议声明标记');
|
|
182
224
|
},
|
|
183
225
|
},
|
|
184
226
|
|
|
@@ -108,6 +108,8 @@ function seedExecuteEntryState(dir, taskText) {
|
|
|
108
108
|
driveThroughDesign(dir);
|
|
109
109
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', taskText);
|
|
110
110
|
assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
111
|
+
// 协议 plan.requiredSkillCalls = flow-comet-task(guarded):出口覆盖判据要求该技能也有标记
|
|
112
|
+
assertExit(runState(['skill-load', 'plan', 'flow-comet-task', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
|
|
111
113
|
assertExit(runState(['record', 'plan', '{"summary":"plan done"}'], dir), 0);
|
|
112
114
|
assertExit(runGuard(['entry', 'plan'], dir), 0);
|
|
113
115
|
const planExit = runGuard(['exit', 'plan', '--apply'], dir);
|
|
@@ -146,18 +148,27 @@ export const ENTRIES = [
|
|
|
146
148
|
assertExit(runState(['init', CHANGE_ID], dir), 0);
|
|
147
149
|
assertExit(runState(['skill-load', 'verify', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir), 0);
|
|
148
150
|
writeFile(dir, '.specs/' + CHANGE_ID + '/UAT.md', '# UAT\n\n通过\n');
|
|
151
|
+
// verify 出口先跑 AC 覆盖判据(新 change):夹具给出可判的最小一对——准则清单 + 1.1 矩阵行
|
|
152
|
+
// (矩阵行写在围栏外;围栏里的编号只是书写样例,不计覆盖)。本项被测的是验证命令的真实执行,
|
|
153
|
+
// 不是 AC 覆盖,故这里只补输入面、不动任何断言。
|
|
154
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md',
|
|
155
|
+
'# REQUIREMENT\n\n- **Change ID**: ' + CHANGE_ID
|
|
156
|
+
+ '\n\n## 用户故事\n\n- US-1:作为执行者,我想让验证命令真的被执行。'
|
|
157
|
+
+ '\n\n## 验收准则(AC)\n\n- **AC-1**: Given 夹具前置 When 夹具动作 Then 夹具结果\n');
|
|
158
|
+
const acCoverageBlock = '## 第 1 轮 · 功能测试\n\n### 1.1 测试矩阵(AC → 用例)\n\n'
|
|
159
|
+
+ '| AC | 类型 | 用例文件 / UAT | 状态 |\n|---|---|---|---|\n| AC-1 | unit | baseline.js | ✅ |\n\n';
|
|
149
160
|
assertExit(runState(['record', 'verify', '{"summary":"verified"}'], dir), 0);
|
|
150
161
|
const st = readStateFile(dir);
|
|
151
162
|
st.currentNode = 'verify';
|
|
152
163
|
writeState(dir, st);
|
|
153
164
|
// ① 快速命令 → 出口通过
|
|
154
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', '# TEST\n\n## 验证命令\n\n```bash\nnode -e "1"\n```\n');
|
|
165
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', '# TEST\n\n' + acCoverageBlock + '## 验证命令\n\n```bash\nnode -e "1"\n```\n');
|
|
155
166
|
assertExit(runGuard(['entry', 'verify'], dir), 0);
|
|
156
167
|
const pass = runGuard(['exit', 'verify'], dir);
|
|
157
168
|
assertExit(pass, 0);
|
|
158
169
|
assertOut(pass, 'ALL CHECKS PASSED');
|
|
159
170
|
// ② 缺省超时(未设 env)保持大值:耗时命令通过
|
|
160
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', '# TEST\n\n## 验证命令\n\n```bash\nnode -e "setTimeout(()=>{}, 1500)"\n```\n');
|
|
171
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', '# TEST\n\n' + acCoverageBlock + '## 验证命令\n\n```bash\nnode -e "setTimeout(()=>{}, 1500)"\n```\n');
|
|
161
172
|
const defaultTimeout = runGuard(['exit', 'verify'], dir);
|
|
162
173
|
assertExit(defaultTimeout, 0);
|
|
163
174
|
assertOut(defaultTimeout, 'ALL CHECKS PASSED');
|
|
@@ -175,7 +186,7 @@ export const ENTRIES = [
|
|
|
175
186
|
throw new Error('exit verify 失败计数未按 change 写入: ' + JSON.stringify(stTimed.verifyFailuresByChange));
|
|
176
187
|
}
|
|
177
188
|
// ④ 无验证命令 → 拦截(严格版要求)
|
|
178
|
-
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', '# TEST\n\n无验证命令段。\n');
|
|
189
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/TEST.md', '# TEST\n\n' + acCoverageBlock + '无验证命令段。\n');
|
|
179
190
|
const noCmd = runGuard(['exit', 'verify'], dir);
|
|
180
191
|
assertExit(noCmd, 1);
|
|
181
192
|
assertOut(noCmd, 'BLOCKED: TEST.md 需声明 ## 验证命令 段');
|
|
@@ -592,6 +603,8 @@ export const ENTRIES = [
|
|
|
592
603
|
}
|
|
593
604
|
// 源节点(verify)出口真实重跑:验证命令落盘副作用 + 推进 archive
|
|
594
605
|
assertExit(runState(['skill-load', 'verify', 'flow-comet-verify', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
606
|
+
// 协议 verify.requiredSkillCalls = flow-comet-integration(guarded):同一份协议文件、另一个技能面
|
|
607
|
+
assertExit(runState(['skill-load', 'verify', 'flow-comet-integration', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
|
|
595
608
|
assertExit(runState(['record', 'verify', '{"summary":"回源复验完成"}'], dir, env), 0);
|
|
596
609
|
assertExit(runGuard(['entry', 'verify'], dir, env), 0);
|
|
597
610
|
const verifyExit = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
@@ -210,6 +210,8 @@ const RAW_ENTRIES = [
|
|
|
210
210
|
gitInit(dir);
|
|
211
211
|
assertExit(runState(['init', CHANGE_ID, '--init-skip'], dir), 0);
|
|
212
212
|
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
213
|
+
// open 该读两份协议、协议声明两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
214
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
213
215
|
assertExit(runState(['skill-load', 'design', 'flow-comet-design', '--prompt', 'flow-kit/prompts/2-design.md', '--templates', 'DESIGN.md'], dir), 0);
|
|
214
216
|
writeIntakeArtifacts(dir);
|
|
215
217
|
// ① entry open 记录进入标记
|
|
@@ -361,6 +361,8 @@ export const ENTRIES = [
|
|
|
361
361
|
writeFile(dir, 'flow-kit/templates/CHANGE.md', '# CHANGE 模板(夹具)\n\n## Why(为什么做)\n\n## 视觉调性(前端项目必填)\n');
|
|
362
362
|
writeFile(dir, 'flow-kit/templates/DESIGN.md', '# DESIGN 模板(夹具)\n\n## 0. 技术栈选定\n\n## 1. 决策清单\n');
|
|
363
363
|
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
364
|
+
// open 该读两份协议、协议声明两个必需技能:出口覆盖判据要求全部声明,夹具两条都写下
|
|
365
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
364
366
|
// 前端判据要的是「视觉调性段在场且未标不适用」:intake 夹具直接写实质调性(不追加同名段)。
|
|
365
367
|
writeIntakeArtifacts(dir, CHANGE_ID, { visualTone: '现代、克制的工具型界面。' });
|
|
366
368
|
assertExit(runState(['record', 'open', '{"summary":"intake complete"}'], dir), 0);
|
|
@@ -401,6 +403,8 @@ export const ENTRIES = [
|
|
|
401
403
|
const nfChange = CHANGE_ID + '-nf';
|
|
402
404
|
assertExit(runState(['init', nfChange, '--init-skip'], dir), 0);
|
|
403
405
|
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
406
|
+
// 第二个 change 的 open 同样要覆盖两份协议与两个必需技能(出口覆盖判据按节点核对)
|
|
407
|
+
assertExit(runState(['skill-load', 'open', 'flow-comet-requirement', '--prompt', 'flow-kit/prompts/1-requirement.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
404
408
|
// 段内自然句子(非结构形态)→ 前端判据不认,仍判前端;写在同一段里,不追加同名段。
|
|
405
409
|
writeIntakeArtifacts(dir, nfChange, { visualTone: '不适用于暗色主题,本 change 仅覆盖浅色分支。' });
|
|
406
410
|
assertExit(runState(['record', 'open', '{"summary":"intake complete"}'], dir), 0);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import fs from 'fs';
|
|
10
10
|
import path from 'path';
|
|
11
11
|
import { spawnSync } from 'child_process';
|
|
12
|
-
import { assertExit, assertNotOut, assertOut, assertTrue, runState, writeState } from '../lib/test-helpers.mjs';
|
|
12
|
+
import { assertExit, assertNotOut, assertOut, assertTrue, installSkillTreeCopy, runPrintedCommand, runState, writeState } from '../lib/test-helpers.mjs';
|
|
13
13
|
import { CHANGE_ID, SCRIPTS_DIR, applyDistributionSurface, readStateFile } from '../lib/system-fixtures.mjs';
|
|
14
14
|
|
|
15
15
|
const DESIGN_SKILL_ARGS = ['skill-load', 'design', 'flow-comet-design', '--prompt', 'flow-kit/prompts/2-design.md'];
|
|
@@ -42,17 +42,26 @@ const RAW_ENTRIES = [
|
|
|
42
42
|
assertOut(extra, 'BLOCKED');
|
|
43
43
|
assertOut(extra, '多写/错名: TASK');
|
|
44
44
|
assertOut(extra, '映射要求: DESIGN');
|
|
45
|
-
|
|
45
|
+
// 命令形态与守卫侧的派生同形(同一装配):脚本路径 + 该节点全部 --prompt + 模板全清单 + 协议
|
|
46
|
+
// 上下文,四个面一次给全;且**照抄能跑通**——解析打印文本 → 真执行,标记的 protocol 必须仍在,
|
|
47
|
+
// 否则下一次 exit 会被「缺协议声明标记」拦下(恢复步骤自己弄坏协议声明)。
|
|
46
48
|
assertNotOut(extra, '--prompt <');
|
|
47
|
-
const declareLine = extra.output.
|
|
48
|
-
assertTrue(declareLine
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
const declareLine = (extra.output.match(/^\s*(node "[^"]+" skill-load design [^\n]+)$/m) || [])[1];
|
|
50
|
+
assertTrue(typeof declareLine === 'string',
|
|
51
|
+
'BLOCKED 报文应给出可照抄的重新声明命令(node "<脚本路径>" skill-load …):\n' + extra.output);
|
|
52
|
+
for (const fragment of [
|
|
53
|
+
'--prompt flow-kit/prompts/2-design.md',
|
|
54
|
+
'--templates DESIGN.md',
|
|
55
|
+
'--protocol "reference/workflow-protocol.json"',
|
|
56
|
+
]) {
|
|
57
|
+
assertTrue(declareLine.includes(fragment),
|
|
58
|
+
'重新声明命令缺 ' + fragment + '(命令与判据不是同一份形态): ' + declareLine);
|
|
59
|
+
}
|
|
60
|
+
// 真跑一遍:打印的是权威源设计形态(.claude/skills/…),按安装布局把技能树复制进夹具才可解析。
|
|
61
|
+
installSkillTreeCopy(dir, path.join('.claude', 'skills'));
|
|
62
|
+
const replayed = runPrintedCommand(declareLine, dir, { FLOW_COMET_RUN_ROOT: dir, FLOW_COMET_PROTOCOL: '' });
|
|
63
|
+
assertTrue(replayed.status === 0,
|
|
64
|
+
'照抄的重新声明命令跑不通\n 命令: ' + declareLine + '\n exit ' + replayed.status + '\n' + replayed.output);
|
|
56
65
|
const redeclaredMarker = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
57
66
|
assertTrue(redeclaredMarker.protocol === '2-design.md',
|
|
58
67
|
'照抄重新声明命令后 protocol 不应变成 null,实际: ' + JSON.stringify(redeclaredMarker.protocol));
|