flow-comet 1.6.4 → 1.6.5
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 +21 -3
- 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/entry-detail.md +8 -2
- package/.flow-comet/skills/flow-comet/reference/workflow-protocol.json +22 -0
- package/.flow-comet/skills/flow-comet/scripts/evolve.mjs +174 -0
- package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +3 -1
- package/.flow-comet/skills/flow-comet/scripts/health.mjs +28 -4
- package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +41 -18
- package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +16 -16
- package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +6 -6
- package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +9 -7
- package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +17 -13
- package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +154 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-artifact-skeleton.mjs +406 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +206 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +458 -60
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +38 -58
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-template-fidelity.mjs +642 -230
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +85 -14
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-admin.mjs +43 -5
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +15 -1
- package/.flow-comet/skills/flow-comet/scripts/lib/state-explain.mjs +18 -1
- package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +60 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +73 -9
- package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +21 -1
- package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +9 -0
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +212 -0
- package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +15 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +4 -4
- package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +20 -10
- package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +4 -1
- package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +6 -6
- package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +13 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +2125 -0
- package/.flow-comet/skills/flow-comet/scripts/system-test.mjs +6 -5
- package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +74 -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 +13 -10
- 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 +11 -7
- package/.flow-comet/skills/flow-comet-requirement/SKILL.md +1 -1
- package/.flow-comet/skills/flow-comet-review/SKILL.md +15 -9
- package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +13 -3
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +11 -8
- package/.flow-comet/skills/flow-comet-task/SKILL.md +1 -1
- 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
|
@@ -341,6 +341,13 @@ export function validateProtocolSchema(protocol) {
|
|
|
341
341
|
if (node.requiredSkillCalls !== undefined && !Array.isArray(node.requiredSkillCalls)) {
|
|
342
342
|
throw new Error('workflow protocol node.requiredSkillCalls must be an array');
|
|
343
343
|
}
|
|
344
|
+
// 可选字段 templates(节点 → 产出物模板 basename 清单):缺省 = 该节点不声明模板。
|
|
345
|
+
// 只校验形态(非空字符串数组),集合语义由加载链按 C3/C12 判定——schema 不持有节点映射。
|
|
346
|
+
if (node.templates !== undefined
|
|
347
|
+
&& (!Array.isArray(node.templates)
|
|
348
|
+
|| node.templates.some((name) => typeof name !== 'string' || name.trim() === ''))) {
|
|
349
|
+
throw new Error('workflow protocol node.templates must be an array of non-empty strings');
|
|
350
|
+
}
|
|
344
351
|
}
|
|
345
352
|
if (Object.prototype.hasOwnProperty.call(protocol, 'writeWhitelist')) {
|
|
346
353
|
checkWriteWhitelistShape(protocol.writeWhitelist);
|
|
@@ -397,3 +404,208 @@ export const SKILL_PROTOCOL_FILES = {
|
|
|
397
404
|
'flow-comet-review': ['6-review.md'],
|
|
398
405
|
'flow-comet-integration': ['7-integration.md'],
|
|
399
406
|
};
|
|
407
|
+
|
|
408
|
+
// ---------- 产出物模板:节点级声明(加载链的单一语义来源) ----------
|
|
409
|
+
//
|
|
410
|
+
// 内置节点的产出物模板映射 = C3 的唯一权威表达处。required = 节点级必需模板;optional 表达「条件模板」
|
|
411
|
+
// (design 的 UI-DESIGN 仅前端 change 适用)。前端判定不在本模块:入口打印的条件行由 guard-uidesign
|
|
412
|
+
// 的 frontendCriterion 决定,避免在协议层写第二份前端判据。
|
|
413
|
+
//
|
|
414
|
+
// 与 reference/artifact-templates.json 的关系:登记表是「模板内容骨架」的权威(file / 段形 / 指纹),
|
|
415
|
+
// 本表只表达「哪个节点该声明哪些模板」(加载链面);两者用同一模板基名键相交。
|
|
416
|
+
export const NODE_ARTIFACT_TEMPLATES = {
|
|
417
|
+
open: { required: ['CHANGE', 'REQUIREMENT'] },
|
|
418
|
+
design: { required: ['DESIGN'], optional: ['UI-DESIGN'] },
|
|
419
|
+
plan: { required: ['TASK'] },
|
|
420
|
+
execute: { required: ['SUMMARY'] },
|
|
421
|
+
'subagent-execute': { required: ['SUMMARY'] },
|
|
422
|
+
review: { required: ['REVIEW', 'TEST'] },
|
|
423
|
+
verify: { required: [] },
|
|
424
|
+
archive: { required: [] },
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// 模板文件根(指针行的相对根)——模板文件本身的绝对位置由登记表的 file 字段承载,这里只拼声明名。
|
|
428
|
+
export const TEMPLATE_ROOT = 'flow-kit/templates';
|
|
429
|
+
|
|
430
|
+
// 模板名归一:去空白与尾随 .md(声明允许 `DESIGN` / `DESIGN.md` 两种写法);大小写保留书写者原样,
|
|
431
|
+
// 比较一律走 templateKeyOf 的小写键(登记表键大写,手写声明常常小写)。
|
|
432
|
+
export function normalizeTemplateName(value) {
|
|
433
|
+
return String(value ?? '').trim().replace(/\.md$/i, '');
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export function templateKeyOf(value) {
|
|
437
|
+
return normalizeTemplateName(value).toLowerCase();
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// 逗号分隔的模板清单(`--templates CHANGE.md,REQUIREMENT.md`;单模板可省略逗号)→ 去重保序数组。
|
|
441
|
+
export function parseTemplateList(value) {
|
|
442
|
+
const names = [];
|
|
443
|
+
const seen = new Set();
|
|
444
|
+
for (const raw of String(value ?? '').split(',')) {
|
|
445
|
+
const name = normalizeTemplateName(raw);
|
|
446
|
+
if (name === '') continue;
|
|
447
|
+
const key = templateKeyOf(name);
|
|
448
|
+
if (seen.has(key)) continue;
|
|
449
|
+
seen.add(key);
|
|
450
|
+
names.push(name);
|
|
451
|
+
}
|
|
452
|
+
return names;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// --templates 原始参数收集:支持 `--templates a,b` 与 `--templates=a,b`,可重复出现(累加去重)。
|
|
456
|
+
// 后随参数是另一个选项(以 -- 开头)时不把它当成模板名(fail-closed 地当作「空清单」)。
|
|
457
|
+
// 返回 { provided, values }:provided 区分「未传该参数」与「传了空清单」——前者对内置节点是缺失声明。
|
|
458
|
+
export function findTemplatesArg(cliArgs) {
|
|
459
|
+
let provided = false;
|
|
460
|
+
const names = [];
|
|
461
|
+
const collect = (raw) => {
|
|
462
|
+
provided = true;
|
|
463
|
+
for (const name of parseTemplateList(raw)) {
|
|
464
|
+
if (!names.some((existing) => templateKeyOf(existing) === templateKeyOf(name))) names.push(name);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
for (let index = 0; index < (cliArgs ?? []).length; index++) {
|
|
468
|
+
const arg = cliArgs[index];
|
|
469
|
+
if (arg === '--templates') {
|
|
470
|
+
const next = cliArgs[index + 1];
|
|
471
|
+
const hasValue = typeof next === 'string' && !next.startsWith('--');
|
|
472
|
+
collect(hasValue ? next : '');
|
|
473
|
+
if (hasValue) index += 1;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
if (typeof arg === 'string' && arg.startsWith('--templates=')) {
|
|
477
|
+
collect(arg.slice('--templates='.length));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return { provided, values: names };
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// 节点 → 模板声明。内置节点取引擎映射(协议副本删掉 node.templates 也不失效——内置节点不依赖协议
|
|
484
|
+
// 自称);自定义协议节点取协议里的 node.templates(ADR-002 特化层:未声明 = 零模板)。
|
|
485
|
+
export function nodeTemplateDeclaration(node) {
|
|
486
|
+
if (!node || typeof node !== 'object') return { source: 'none', required: [], optional: [] };
|
|
487
|
+
const builtin = NODE_ARTIFACT_TEMPLATES[node.id];
|
|
488
|
+
if (builtin) {
|
|
489
|
+
return { source: 'builtin', required: [...builtin.required], optional: [...(builtin.optional ?? [])] };
|
|
490
|
+
}
|
|
491
|
+
const declared = Array.isArray(node.templates)
|
|
492
|
+
? node.templates.filter((name) => typeof name === 'string' && name.trim() !== '').map(normalizeTemplateName)
|
|
493
|
+
: [];
|
|
494
|
+
return declared.length > 0
|
|
495
|
+
? { source: 'protocol', required: declared, optional: [] }
|
|
496
|
+
: { source: 'none', required: [], optional: [] };
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// 声明集合比对(C11):required ⊆ declared ⊆ required ∪ optional。返回 { missing, extra }——两者
|
|
500
|
+
// 皆空即通过。extra 覆盖「多写」与「错名」(都不在允许集合里)。
|
|
501
|
+
export function templateDeclarationProblems(declaration, declared) {
|
|
502
|
+
const required = new Map(declaration.required.map((name) => [templateKeyOf(name), name]));
|
|
503
|
+
const allowed = new Set([
|
|
504
|
+
...required.keys(),
|
|
505
|
+
...(declaration.optional ?? []).map((name) => templateKeyOf(name)),
|
|
506
|
+
]);
|
|
507
|
+
const seen = new Map((declared ?? []).map((name) => [templateKeyOf(name), name]));
|
|
508
|
+
const missing = [...required].filter(([key]) => !seen.has(key)).map(([, name]) => name);
|
|
509
|
+
const extra = [...seen].filter(([key]) => !allowed.has(key)).map(([, name]) => name);
|
|
510
|
+
return { missing, extra };
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// 声明清单 → 易读形态(报文用;空清单写「零模板」——比空字符串诚实)。
|
|
514
|
+
export function describeTemplateList(names) {
|
|
515
|
+
return Array.isArray(names) && names.length > 0 ? names.join('、') : '零模板';
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// 模板基名 → 指针路径(`DESIGN` → `flow-kit/templates/DESIGN.md`)。
|
|
519
|
+
export function templatePointerPath(name) {
|
|
520
|
+
return TEMPLATE_ROOT + '/' + normalizeTemplateName(name) + '.md';
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// 重新声明的命令指引(skill-load 校验失败与 record 声明核对两处共用):两处本说的是同一件事
|
|
524
|
+
// 「怎么重新声明」——各拼一份必然分叉(命令形态改一次要改两地方)。零模板节点不拼 --templates
|
|
525
|
+
// (省略即空集,与 C11 的「可省略」一致);无 skill 名的场景用 <skill> 占位。
|
|
526
|
+
// --prompt 一并拼上:模板与提示词是同一次声明的两面,而 skill-load 重跑会**覆写**同一标记——
|
|
527
|
+
// 只补 --templates 的指引会把 protocol 写成 null,下一次 exit 反被判「缺协议声明标记」(恢复步骤
|
|
528
|
+
// 自己弄坏协议声明)。路径取该节点的首个内置协议文件,与入口的 READ PROMPT 同源;自定义节点没有
|
|
529
|
+
// 内置映射(协议自己也声明提示词路径)→ 不拼,不编造路径也不打占位符。
|
|
530
|
+
export function templateDeclareCommand(declaration, { nodeId, skillName } = {}) {
|
|
531
|
+
const skill = typeof skillName === 'string' && skillName !== '' ? skillName : '<skill>';
|
|
532
|
+
const flag = declaration.required.length > 0
|
|
533
|
+
? ' --templates ' + declaration.required.map((name) => name + '.md').join(',')
|
|
534
|
+
: '';
|
|
535
|
+
const promptFile = (NODE_PROTOCOL_FILES[nodeId] ?? [])[0];
|
|
536
|
+
const promptFlag = typeof promptFile === 'string' ? ' --prompt ' + promptPointerPath(promptFile) : '';
|
|
537
|
+
return 'workflow-state.mjs skill-load ' + nodeId + ' ' + skill + flag + promptFlag;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// 指针行(入口与 explain 共用:同一判据一份实现,两处输出措辞一致)。
|
|
541
|
+
// label:内置入口用 `READ TEMPLATE`,现问通道用 `TEMPLATE`;conditional=true 时追出条件模板行。
|
|
542
|
+
export function templatePointerLines(declaration, options = {}) {
|
|
543
|
+
const label = typeof options.label === 'string' && options.label !== '' ? options.label : 'TEMPLATE';
|
|
544
|
+
const lines = declaration.required.map((name) => label + ': ' + templatePointerPath(name));
|
|
545
|
+
if (options.conditional === true) {
|
|
546
|
+
for (const name of declaration.optional ?? []) {
|
|
547
|
+
lines.push(label + '(条件模板): ' + templatePointerPath(name) + '(仅前端 change)');
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return lines;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// ---------- 节点协议提示词:加载链的另一半 ----------
|
|
554
|
+
//
|
|
555
|
+
// 与模板并列的两条权威:提示词(flow-kit/prompts/)是**步骤权威**——这一步怎么做、交代什么;
|
|
556
|
+
// 模板(flow-kit/templates/)是**段形权威**——产出长什么样。两者都在 entry 打印、都由 skill-load
|
|
557
|
+
// 声明,缺一即未完成加载。
|
|
558
|
+
//
|
|
559
|
+
// 路径根与映射各只有一处:映射复用既有的 NODE_PROTOCOL_FILES(出口协议声明校验与 M5 自动补声明
|
|
560
|
+
// 共用),本段只提供指针形态与声明一致性判据,不复制映射表。
|
|
561
|
+
|
|
562
|
+
export const PROMPT_ROOT = 'flow-kit/prompts';
|
|
563
|
+
|
|
564
|
+
// 条件提示词(与条件模板同构):只对特定技能适用的协议文件——必读清单之外的协议面成员,参与声明
|
|
565
|
+
// 一致性判据;入口按前端判据追出(非前端不打印)。目前唯一的条件件是 design 节点的 UI-DESIGN 阶段:
|
|
566
|
+
// 前端 change 才加载 flow-comet-ui-design 并声明 `2a-ui-design.md`。
|
|
567
|
+
export const NODE_CONDITIONAL_PROMPTS = {
|
|
568
|
+
design: ['2a-ui-design.md'],
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// 节点 → 上游协议提示文件(仅内置节点有 vendored 提示词)。自定义协议节点由 compose 只组合已装技能,
|
|
572
|
+
// 提示词路径仍由 skill-load --prompt 显式声明——不在协议里编造一份(与模板的 C12 语义同构)。
|
|
573
|
+
export function nodePromptFiles(node) {
|
|
574
|
+
if (!node || typeof node !== 'object') return [];
|
|
575
|
+
const files = NODE_PROTOCOL_FILES[node.id];
|
|
576
|
+
return Array.isArray(files) ? [...files] : [];
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// 提示词文件 → 指针路径(`2-design.md` → `flow-kit/prompts/2-design.md`)。
|
|
580
|
+
export function promptPointerPath(file) {
|
|
581
|
+
return PROMPT_ROOT + '/' + file;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// 入口指针行:一行一个协议文件(open / review 这类多文件节点各一行)。零提示词节点返回空数组——
|
|
585
|
+
// 与零模板节点同语义(不打印,也不编造路径)。
|
|
586
|
+
// conditional=true 时追出条件提示词行(与 templatePointerLines 的条件行同形:同一前端判据、同一措辞
|
|
587
|
+
// 形态);非前端 change 上条件文件只是「不适用」,不是缺件,故不打印。
|
|
588
|
+
export function promptPointerLines(node, options = {}) {
|
|
589
|
+
const lines = nodePromptFiles(node).map((file) => 'READ PROMPT: ' + promptPointerPath(file));
|
|
590
|
+
if (options.conditional === true) {
|
|
591
|
+
for (const file of NODE_CONDITIONAL_PROMPTS[node?.id] ?? []) {
|
|
592
|
+
lines.push('READ PROMPT(条件提示词): ' + promptPointerPath(file) + '(仅前端 change)');
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return lines;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// 声明一致性判据(入口侧):skill-load 声明的 --prompt 必须落在该节点的协议面内——
|
|
599
|
+
// 节点协议文件 ∪ 该节点的条件提示词。返回 null(通过)或 { declared, expected };expected 供报文
|
|
600
|
+
// 给出可照抄的路径。未声明(null / 空串)不在此判——缺失由出口「缺协议声明标记」门负责,
|
|
601
|
+
// 本判据只判「声明了但声明错」这一形态。
|
|
602
|
+
export function promptDeclarationConflict({ node, declaredProtocol } = {}) {
|
|
603
|
+
const nodeFiles = nodePromptFiles(node);
|
|
604
|
+
if (nodeFiles.length === 0) return null;
|
|
605
|
+
const declared = typeof declaredProtocol === 'string'
|
|
606
|
+
? (declaredProtocol.replaceAll('\\', '/').split('/').filter((part) => part !== '').pop() ?? '')
|
|
607
|
+
: '';
|
|
608
|
+
if (declared === '') return null;
|
|
609
|
+
const expected = [...nodeFiles, ...(NODE_CONDITIONAL_PROMPTS[node?.id] ?? [])];
|
|
610
|
+
return expected.includes(declared) ? null : { declared, expected };
|
|
611
|
+
}
|
|
@@ -54,9 +54,12 @@ export const ENTRIES = [
|
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
|
|
57
|
-
// 2: open exit
|
|
57
|
+
// 2: open exit 模板缺席——CHANGE.md 缺 Why 段:命名段判据跳过,但跳过必须可见(C9)
|
|
58
|
+
// 模板整份缺席(夹具没有 flow-kit/templates/)时 pick 不再回落到命名段兜底正则 ⇒ 「缺必填段」
|
|
59
|
+
// 判据不生效;但「不阻断」不等于「静默通过」——产出物结构门禁必须逐工件报到「未校验(模板缺失)」,
|
|
60
|
+
// 跳过因此自证(L-079)。模板在场但该段名缺席时 fallback 仍生效,见 TA-21 的反向构造。
|
|
58
61
|
{
|
|
59
|
-
name: '02 open exit
|
|
62
|
+
name: '02 open exit 模板缺席:CHANGE 缺 Why 段不阻断,但显式报到「未校验(模板缺失)」',
|
|
60
63
|
run: (dir) => {
|
|
61
64
|
const st = baseState('open');
|
|
62
65
|
st.evidence.open = { summary: 'intake complete' };
|
|
@@ -64,16 +67,21 @@ export const ENTRIES = [
|
|
|
64
67
|
writeFile(dir, '.specs/' + CHANGE_ID + '/CHANGE.md', '# CHANGE\n\n## 变更目标\n\n## 方案\n');
|
|
65
68
|
writeFile(dir, '.specs/' + CHANGE_ID + '/REQUIREMENT.md', '# REQUIREMENT\n\n## 用户故事\n\n## 验收准则(AC)\n');
|
|
66
69
|
const res = runGuard(['exit', 'open'], dir);
|
|
67
|
-
assertExit(res,
|
|
68
|
-
assertOut(res, '
|
|
69
|
-
|
|
70
|
+
assertExit(res, 0);
|
|
71
|
+
assertOut(res, '未校验(模板缺失): CHANGE.md');
|
|
72
|
+
assertNotOut(res, '缺必填段');
|
|
73
|
+
assertNotOut(res, 'BLOCKED');
|
|
70
74
|
},
|
|
71
75
|
},
|
|
72
76
|
|
|
73
77
|
// 3: open exit BLOCKED——REQUIREMENT.md 缺验收段(且无 Given 豁免)
|
|
78
|
+
// 判据面是模板派生的段名表,故夹具带 REQUIREMENT 模板:模板缺席时该判据按 C9 跳过(见第 2 例),
|
|
79
|
+
// 这里测的是「模板在场」的真实路径。
|
|
74
80
|
{
|
|
75
81
|
name: '03 open exit BLOCKED:REQUIREMENT 缺验收段',
|
|
76
82
|
run: (dir) => {
|
|
83
|
+
writeFile(dir, 'flow-kit/templates/REQUIREMENT.md',
|
|
84
|
+
'# REQUIREMENT 模板\n\n## 用户故事(User Story)\n## 验收准则(Acceptance Criteria)\n');
|
|
77
85
|
const st = baseState('open');
|
|
78
86
|
st.evidence.open = { summary: 'intake complete' };
|
|
79
87
|
writeState(dir, st);
|
|
@@ -102,9 +110,11 @@ export const ENTRIES = [
|
|
|
102
110
|
},
|
|
103
111
|
|
|
104
112
|
// 5: design exit BLOCKED——缺 ## 决策清单 段
|
|
113
|
+
// 同第 3 例:判据面是模板派生的段名表,夹具带 DESIGN 模板(模板缺席时该判据按 C9 跳过)。
|
|
105
114
|
{
|
|
106
115
|
name: '05 design exit BLOCKED:缺决策清单',
|
|
107
116
|
run: (dir) => {
|
|
117
|
+
writeFile(dir, 'flow-kit/templates/DESIGN.md', '# DESIGN 模板\n\n## 0. 技术栈选型\n## 1. 技术决策清单\n');
|
|
108
118
|
const st = baseState('design');
|
|
109
119
|
st.evidence.design = { summary: 'design done' };
|
|
110
120
|
writeState(dir, st);
|
|
@@ -56,7 +56,7 @@ export const ENTRIES = [
|
|
|
56
56
|
writeFile(dir, 'flow-kit/prompts/0-change.md', '# 阶段 0 · CHANGE\n\n## 角色\n\n你是 Changeer。\n');
|
|
57
57
|
writeState(dir, baseState('open'));
|
|
58
58
|
fs.mkdirSync(path.join(dir, '.specs', CHANGE_ID), { recursive: true });
|
|
59
|
-
const res = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md']);
|
|
59
|
+
const res = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md']);
|
|
60
60
|
assertExit(res, 0);
|
|
61
61
|
assertOut(res, 'SKILL-LOAD: open flow-comet-change → .skill-loads/open-flow-comet-change.json');
|
|
62
62
|
const markerPath = path.join(dir, '.specs', CHANGE_ID, '.skill-loads', 'open-flow-comet-change.json');
|
|
@@ -139,7 +139,7 @@ export const ENTRIES = [
|
|
|
139
139
|
run: (dir) => {
|
|
140
140
|
writeState(dir, baseState('open'));
|
|
141
141
|
fs.mkdirSync(path.join(dir, '.specs', CHANGE_ID), { recursive: true });
|
|
142
|
-
const sl = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change']);
|
|
142
|
+
const sl = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change', '--templates', 'CHANGE.md,REQUIREMENT.md']);
|
|
143
143
|
assertExit(sl, 0);
|
|
144
144
|
assertOut(sl, 'SKILL-LOAD: open flow-comet-change');
|
|
145
145
|
const res = runStateWithProtocol(dir, ['record', 'open', JSON.stringify({ summary: 'done', completedChecks: ['required-skill:open.flow-comet-change'] })]);
|
|
@@ -189,7 +189,7 @@ export const ENTRIES = [
|
|
|
189
189
|
assertOut(resBlock, 'exit 缺协议声明标记');
|
|
190
190
|
// ② 真实链路:skill-load --prompt 写入标记(protocol = basename)→ exit 通过
|
|
191
191
|
const markerPath = path.join(loadsDir, 'open-flow-comet-change.json');
|
|
192
|
-
const sl = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md']);
|
|
192
|
+
const sl = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md']);
|
|
193
193
|
assertExit(sl, 0);
|
|
194
194
|
assertOut(sl, 'SKILL-LOAD: open flow-comet-change');
|
|
195
195
|
const marker = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
@@ -202,7 +202,7 @@ export const ENTRIES = [
|
|
|
202
202
|
assertNotOut(resPass, 'BLOCKED');
|
|
203
203
|
// ③ skill-load 未传 --prompt → 标记 protocol = null → exit BLOCKED(fail-closed:
|
|
204
204
|
// 无协议声明不可通过——指引补 skill-load --prompt)
|
|
205
|
-
const slNull = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change']);
|
|
205
|
+
const slNull = runStateWithProtocol(dir, ['skill-load', 'open', 'flow-comet-change', '--templates', 'CHANGE.md,REQUIREMENT.md']);
|
|
206
206
|
assertExit(slNull, 0);
|
|
207
207
|
const markerNull = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
208
208
|
if (markerNull.protocol !== null) {
|
|
@@ -419,7 +419,8 @@ export const ENTRIES = [
|
|
|
419
419
|
what: '## 做了什么\n\n实现 T01(TDD:先写失败场景再实现)。',
|
|
420
420
|
files: '## 改动文件\n\n| 文件 | 性质 | 说明 |\n|---|---|---|\n| src/t1.mjs | 修改 | 实现 T01 |',
|
|
421
421
|
verify: '## verify 输出\n\n```\nnode --check src/t1.mjs\n```',
|
|
422
|
-
sixDim: '## 6 维自查\n\n- 功能: 通过(brooks-review 已跑)\n- 性能: 无影响\n- 安全: 无影响\n- 兼容: 通过\n- 可观测: 通过\n- 可维护: 通过'
|
|
422
|
+
sixDim: '## 6 维自查\n\n- 功能: 通过(brooks-review 已跑)\n- 性能: 无影响\n- 安全: 无影响\n- 兼容: 通过\n- 可观测: 通过\n- 可维护: 通过'
|
|
423
|
+
+ '\n\n### 已知接受 + 理由\n\n- 无(夹具)。\n\n### 已知小问题\n\n- 无(夹具)。',
|
|
423
424
|
db: '## 数据库迁移\n\nN/A:本任务无 schema 变更。',
|
|
424
425
|
bounds: '## 越界检查\n\n仅修改 src/t1.mjs,无越界。',
|
|
425
426
|
breaking: '## 破坏性变更\n\nN/A:本任务不涉及破坏性变更。',
|
|
@@ -427,17 +428,26 @@ export const ENTRIES = [
|
|
|
427
428
|
newWork: '## 是否触发新工作\n\n无。',
|
|
428
429
|
done: '## 完成判定\n\n- TASK.md 中对应任务已勾选:是',
|
|
429
430
|
method: '## 自检方法\n\nbrooks-review',
|
|
431
|
+
// LESSONS 扫描 = 登记的增量段(位于自检方法之后或文末)——SUMMARY 出口的必填增量段,
|
|
432
|
+
// 夹具缺它会被增量段门禁拦下,掩盖本场景被测的标题/首部/段序判据。
|
|
433
|
+
lessons: '## LESSONS 扫描\n\n无 active 条目命中(夹具)。',
|
|
430
434
|
};
|
|
431
435
|
// 模板序 = flow-kit/templates/SUMMARY.md 全部 H2(含 5 个条件段);## 自检方法 不属骨架,
|
|
432
|
-
//
|
|
436
|
+
// 单独按位置校核(紧随 ## 越界检查、或位于骨架段全部之后两种合法位置;其后允许跟登记的
|
|
437
|
+
// 增量段 ## LESSONS 扫描)。
|
|
433
438
|
const skeletonOrder = [sectionText.what, sectionText.files, sectionText.verify, sectionText.sixDim,
|
|
434
439
|
sectionText.db, sectionText.bounds, sectionText.breaking, sectionText.deviation, sectionText.newWork, sectionText.done];
|
|
435
|
-
const fullSections = [...skeletonOrder, sectionText.method]; //
|
|
436
|
-
const afterBoundsSections = [
|
|
437
|
-
|
|
438
|
-
|
|
440
|
+
const fullSections = [...skeletonOrder, sectionText.method, sectionText.lessons]; // 自检方法在骨架段之后(合法位置一)
|
|
441
|
+
const afterBoundsSections = [
|
|
442
|
+
...skeletonOrder.slice(0, 6), sectionText.method, sectionText.lessons, ...skeletonOrder.slice(6),
|
|
443
|
+
]; // 紧随越界(合法位置二)
|
|
444
|
+
const illegalSelfSections = [
|
|
445
|
+
...skeletonOrder.slice(0, 4), sectionText.method, sectionText.lessons, ...skeletonOrder.slice(4),
|
|
446
|
+
]; // 自检方法夹在中间(非法)
|
|
447
|
+
const missingTailSections = [...skeletonOrder.slice(0, 9), sectionText.method, sectionText.lessons]; // 缺尾段 完成判定
|
|
439
448
|
const outOfOrderSections = [
|
|
440
|
-
...skeletonOrder.slice(0, 5), sectionText.bounds, sectionText.db, ...skeletonOrder.slice(6),
|
|
449
|
+
...skeletonOrder.slice(0, 5), sectionText.bounds, sectionText.db, ...skeletonOrder.slice(6),
|
|
450
|
+
sectionText.method, sectionText.lessons,
|
|
441
451
|
]; // 数据库迁移排到越界检查之后(段序偏离)
|
|
442
452
|
const compose = (title, order) =>
|
|
443
453
|
[title, '', header, '', '---', '', order.join('\n\n')].join('\n');
|
|
@@ -469,7 +479,7 @@ export const ENTRIES = [
|
|
|
469
479
|
assertOut(res2, 'BLOCKED');
|
|
470
480
|
// ③ 新 change:段序乱(自检方法提前、做了什么滞后)→ BLOCK
|
|
471
481
|
const scrambled = [
|
|
472
|
-
sectionText.verify, sectionText.bounds, sectionText.sixDim, sectionText.method,
|
|
482
|
+
sectionText.verify, sectionText.bounds, sectionText.sixDim, sectionText.method, sectionText.lessons,
|
|
473
483
|
sectionText.what, sectionText.files, sectionText.db, sectionText.breaking,
|
|
474
484
|
sectionText.deviation, sectionText.newWork, sectionText.done,
|
|
475
485
|
];
|
|
@@ -1342,7 +1352,7 @@ export const ENTRIES = [
|
|
|
1342
1352
|
},
|
|
1343
1353
|
|
|
1344
1354
|
// 171: 入口文档首部 Change ID 新 change 强制——标题/段序合规但缺 `- **Change ID**:`
|
|
1345
|
-
// 首部字段:新 change open 出口 BLOCKED
|
|
1355
|
+
// 首部字段:新 change open 出口 BLOCKED(模板保真门的文案「首部缺字段: Change ID」);旧 change WARN 渐进。
|
|
1346
1356
|
// (对齐 AC「标题·首部·段序」统一强制口径——此前仅 softWarning 与承诺不符。)
|
|
1347
1357
|
{
|
|
1348
1358
|
name: '171 入口首部 Change ID 新 BLOCK / 旧 WARN',
|
|
@@ -1368,7 +1378,7 @@ export const ENTRIES = [
|
|
|
1368
1378
|
const resBad = runGuard(['exit', 'open'], dir);
|
|
1369
1379
|
assertExit(resBad, 1);
|
|
1370
1380
|
assertOut(resBad, 'BLOCKED');
|
|
1371
|
-
assertOut(resBad, '
|
|
1381
|
+
assertOut(resBad, '首部缺字段: Change ID');
|
|
1372
1382
|
// ② 新 change 含首部字段 → 通过
|
|
1373
1383
|
writeChange(true);
|
|
1374
1384
|
const resGood = runGuard(['exit', 'open'], dir);
|
|
@@ -1042,7 +1042,10 @@ export const ENTRIES = [
|
|
|
1042
1042
|
'## verify 输出\n\n```\nnode --check src/t1.mjs\n```',
|
|
1043
1043
|
'## 6 维自查\n\n- 功能: 通过(brooks-review 已跑)\n- 性能: 无影响\n- 安全: 无影响\n- 兼容: 通过\n- 可观测: 通过\n- 可维护: 通过',
|
|
1044
1044
|
'## 越界检查\n\n仅修改 src/t1.mjs,无越界。',
|
|
1045
|
-
'## 自检方法\n\nbrooks-review',
|
|
1045
|
+
'## 自检方法\n\nbrooks-review',
|
|
1046
|
+
// LESSONS 扫描 = 登记的必填增量段(位于自检方法之后或文末):缺它会被增量段门禁拦下,
|
|
1047
|
+
// 掩盖本场景被测的漂移容忍判据。
|
|
1048
|
+
'## LESSONS 扫描\n\n无 active 条目命中(夹具)。', '',
|
|
1046
1049
|
].join('\n'));
|
|
1047
1050
|
// 漂移态:completedNodes=[open,design,plan](execute 未 completed——欠账),currentNode=review
|
|
1048
1051
|
// (路由已越过 execute——execute 证据/产物齐);evidence.execute + enteredNodes 含 execute(防 R2 拦)
|
|
@@ -338,12 +338,12 @@ export const ENTRIES = [
|
|
|
338
338
|
...handoffFor(['T-FIX-01']),
|
|
339
339
|
};
|
|
340
340
|
writeState(dir, after);
|
|
341
|
-
assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md']), 0);
|
|
341
|
+
assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
|
|
342
342
|
const recDoneExit = runGuard(['exit', 'execute', '--apply'], dir);
|
|
343
343
|
assertExit(recDoneExit, 0);
|
|
344
344
|
assertOut(recDoneExit, 'FIX-BATCH: 回源节点 review(execute 出口已完成)');
|
|
345
345
|
assertOut(recDoneExit, 'NODE: review');
|
|
346
|
-
assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md']), 0);
|
|
346
|
+
assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md']), 0);
|
|
347
347
|
assertExit(runGuard(['entry', 'review'], dir), 0);
|
|
348
348
|
const recDoneReview = runGuard(['exit', 'review', '--apply'], dir);
|
|
349
349
|
assertExit(recDoneReview, 0);
|
|
@@ -386,7 +386,7 @@ export const ENTRIES = [
|
|
|
386
386
|
...handoffFor(['T-FIX-01']),
|
|
387
387
|
};
|
|
388
388
|
writeState(dir, after);
|
|
389
|
-
assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md']), 0);
|
|
389
|
+
assertExit(runStateWithProtocol(dir, ['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
|
|
390
390
|
const recDoneVerifyExit = runGuard(['exit', 'execute', '--apply'], dir);
|
|
391
391
|
assertExit(recDoneVerifyExit, 0);
|
|
392
392
|
assertOut(recDoneVerifyExit, 'FIX-BATCH: 回源节点 verify(execute 出口已完成)');
|
|
@@ -448,7 +448,7 @@ export const ENTRIES = [
|
|
|
448
448
|
...handoffFor(['P-FIX-01']),
|
|
449
449
|
};
|
|
450
450
|
writeState(dir, after);
|
|
451
|
-
assertExit(runStateWithProtocol(dir, ['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md']), 0);
|
|
451
|
+
assertExit(runStateWithProtocol(dir, ['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
|
|
452
452
|
const rParExit = runGuard(['exit', 'subagent-execute', '--apply'], dir);
|
|
453
453
|
assertExit(rParExit, 0);
|
|
454
454
|
assertOut(rParExit, 'FIX-BATCH: 回源节点 review(subagent-execute 出口已完成)');
|
|
@@ -463,7 +463,7 @@ export const ENTRIES = [
|
|
|
463
463
|
|| typeof parFamilyExit.taskSetSignature !== 'string' || parFamilyExit.taskSetSignature === '') {
|
|
464
464
|
throw new Error('并行修复出口应记录本 change + taskSetSignature 的家族出口事件,实际 ' + JSON.stringify(parFamilyExit));
|
|
465
465
|
}
|
|
466
|
-
assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md']), 0);
|
|
466
|
+
assertExit(runStateWithProtocol(dir, ['skill-load', 'review', 'flow-comet-review', '--prompt', 'flow-kit/prompts/6-review.md', '--templates', 'REVIEW.md,TEST.md']), 0);
|
|
467
467
|
assertExit(runGuard(['entry', 'review'], dir), 0);
|
|
468
468
|
const rParSource = runGuard(['exit', 'review', '--apply'], dir);
|
|
469
469
|
assertExit(rParSource, 0);
|
|
@@ -501,7 +501,7 @@ export const ENTRIES = [
|
|
|
501
501
|
...handoffFor(['P-FIX-01']),
|
|
502
502
|
};
|
|
503
503
|
writeState(dir, after);
|
|
504
|
-
assertExit(runStateWithProtocol(dir, ['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md']), 0);
|
|
504
|
+
assertExit(runStateWithProtocol(dir, ['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md']), 0);
|
|
505
505
|
const rDoneParExit = runGuard(['exit', 'subagent-execute', '--apply'], dir);
|
|
506
506
|
assertExit(rDoneParExit, 0);
|
|
507
507
|
assertOut(rDoneParExit, 'FIX-BATCH: 回源节点 review(subagent-execute 出口已完成)');
|
|
@@ -74,6 +74,7 @@ import {
|
|
|
74
74
|
frontendCriterionProseProblems,
|
|
75
75
|
frontendCriterionRedirectProblems,
|
|
76
76
|
intelFieldToken,
|
|
77
|
+
maintainerFacePresent,
|
|
77
78
|
singleSourceImportProblems,
|
|
78
79
|
uniqueTempNameHits,
|
|
79
80
|
writeDesignExitFixture,
|
|
@@ -611,21 +612,28 @@ export const ENTRIES = [
|
|
|
611
612
|
// 284: 本仓 CONTEXT 的七段校验 + 可选的 `## evolve 元数据` 段语义——缺席不报(没跑过架构
|
|
612
613
|
// 沉淀的项目不补段);在场则三字段必须齐(跑过一次却写残的半成品正是要拦的形态);判据
|
|
613
614
|
// **限定在段内**(别处的同名字段不得让残缺的 evolve 段蒙混过关)。
|
|
614
|
-
// ① 是本仓真实文件的**维护者形态**断言(.specs/ 被 gitignore
|
|
615
|
-
//
|
|
615
|
+
// ① 是本仓真实文件的**维护者形态**断言(.specs/ 被 gitignore):先过维护者面门控(docs/internal/
|
|
616
|
+
// 缺席 = 载体/CI 形态),再查流程工件文件本身是否在场——两种结构性缺席都输出可见 SKIP 行
|
|
617
|
+
// (未验证 ≠ 通过),**维护者面与文件都在场时判据逐字不变**;②~⑤ 恒检(夹具驱动)。
|
|
616
618
|
{
|
|
617
619
|
name: '284 CONTEXT 七段校验 + evolve 元数据可选段:缺席不报·在场缺一即报·判据限段内',
|
|
618
620
|
run: async () => {
|
|
619
621
|
const validate = requireModuleExport(contextInitModule, 'validateContext', 'context-init.mjs');
|
|
620
622
|
|
|
621
|
-
// ① 本仓 CONTEXT.md
|
|
622
|
-
|
|
623
|
+
// ① 本仓 CONTEXT.md 通过七段校验(真实文件,非夹具)——先过维护者面门控:载体(安装副本)
|
|
624
|
+
// 自带的 .specs/CONTEXT.md 是载体自己的上下文,与本仓 CONTEXT 同名不同物(e2e 实测只有 3 个
|
|
625
|
+
// H2)。拿它当本仓证据 = 让载体形态静默通过或判红,故维护者面缺席时显式 SKIP。
|
|
626
|
+
if (!maintainerFacePresent()) {
|
|
627
|
+
console.log('SKIP: 284 的本仓 CONTEXT 面(载体缺失维护者面:docs/internal/ 不在本检出)'
|
|
628
|
+
+ '——本次检出未校验本仓 CONTEXT.md 的七段与 evolve 元数据段语义,请在维护者主树重跑本套件'
|
|
629
|
+
+ '(跳过 ≠ 已通过,未验证 ≠ 通过)');
|
|
630
|
+
} else if (fs.existsSync(REPO_CONTEXT_FILE)) {
|
|
623
631
|
const repo = await validate(REPO_ROOT);
|
|
624
632
|
assertEqual(repo.missingSections.length, 0, '本仓 CONTEXT.md 缺段: ' + JSON.stringify(repo.missingSections));
|
|
625
633
|
assertEqual(repo.formatIssues.length, 0, '本仓 CONTEXT.md 格式问题: ' + JSON.stringify(repo.formatIssues));
|
|
626
634
|
} else {
|
|
627
635
|
console.log('SKIP: 284 的本仓 CONTEXT 面(.specs/CONTEXT.md 为流程工件面,可能结构性缺席)'
|
|
628
|
-
+ '——本仓 CONTEXT 缺席 =
|
|
636
|
+
+ '——本仓 CONTEXT 缺席 = 非维护者工作副本形态;本次检出未校验本仓 CONTEXT.md 的七段与 evolve 元数据段语义,'
|
|
629
637
|
+ '请在维护者主树重跑本套件');
|
|
630
638
|
}
|
|
631
639
|
|