create-yss-spec 3.3.4 → 3.3.7

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 (171) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/template/instance-runtime.js +8 -2
  4. package/src/validation/snapshot.js +7 -0
  5. package/template/.agents/skills/.strategic-design-skills-manifest.json +7 -5
  6. package/template/.agents/skills/archify/SKILL.md +1 -1
  7. package/template/.agents/skills/code-review/SKILL.md +6 -0
  8. package/template/.agents/skills/i-have-adhd/LICENSE +21 -0
  9. package/template/.agents/skills/i-have-adhd/SKILL.md +26 -0
  10. package/template/.agents/skills/i-have-adhd/agents/openai.yaml +6 -0
  11. package/template/.agents/skills/i-have-adhd/references/yss-adaptation.md +21 -0
  12. package/template/.agents/skills/i-have-adhd/tests/verify-integration.mjs +63 -0
  13. package/template/.agents/skills/prototype-review/SKILL.md +2 -0
  14. package/template/.agents/skills/yss-implementation-contract-compiler/SKILL.md +6 -0
  15. package/template/.agents/skills/yss-implementation-contract-compiler/references/boundaries.md +10 -0
  16. package/template/.agents/skills/yss-openapi-governance/SKILL.md +6 -0
  17. package/template/.agents/skills/yss-product-lifecycle/SKILL.md +3 -1
  18. package/template/.agents/skills/yss-product-lifecycle/references/orchestration-contract.yaml +12 -0
  19. package/template/.agents/skills/yss-prototype-stage/SKILL.md +6 -0
  20. package/template/.agents/skills/yss-research/SKILL.md +6 -0
  21. package/template/.agents/skills/yss-stage-decision/SKILL.md +19 -4
  22. package/template/.agents/skills/yss-stage-decision/references/domain-strategy-contract.md +4 -3
  23. package/template/.agents/skills/yss-stage-decision/references/domain-strategy-v2.schema.json +8 -0
  24. package/template/.agents/skills/yss-stage-decision/references/domain-strategy-v3.schema.json +8 -0
  25. package/template/.agents/skills/yss-stage-decision/references/domain-strategy.schema.json +75 -5
  26. package/template/.agents/skills/yss-stage-decision/references/stage-decision-package-contract.md +4 -4
  27. package/template/.agents/skills/yss-stage-decision/references/stage-decision-package-v2.schema.json +8 -0
  28. package/template/.agents/skills/yss-stage-decision/references/stage-decision-package-v3.schema.json +8 -0
  29. package/template/.agents/skills/yss-stage-decision/references/stage-decision-package.schema.json +59 -9
  30. package/template/.agents/skills/yss-stage-decision/references/validation-rules.md +2 -2
  31. package/template/.agents/skills/yss-stage-decision/scripts/migrate-contract-v3.mjs +143 -0
  32. package/template/.agents/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +46 -4
  33. package/template/.agents/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +48 -4
  34. package/template/.agents/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +42 -13
  35. package/template/.agents/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +37 -5
  36. package/template/.agents/skills/yss-stage-decision/tests/run-scenarios.mjs +116 -23
  37. package/template/.agents/skills/yss-technical-design/SKILL.md +6 -0
  38. package/template/.codex/skills/archify/SKILL.md +1 -1
  39. package/template/.codex/skills/code-review/SKILL.md +6 -0
  40. package/template/.codex/skills/i-have-adhd/LICENSE +21 -0
  41. package/template/.codex/skills/i-have-adhd/SKILL.md +26 -0
  42. package/template/.codex/skills/i-have-adhd/agents/openai.yaml +6 -0
  43. package/template/.codex/skills/i-have-adhd/references/yss-adaptation.md +21 -0
  44. package/template/.codex/skills/i-have-adhd/tests/verify-integration.mjs +63 -0
  45. package/template/.codex/skills/prototype-review/SKILL.md +2 -0
  46. package/template/.codex/skills/yss-implementation-contract-compiler/SKILL.md +6 -0
  47. package/template/.codex/skills/yss-implementation-contract-compiler/references/boundaries.md +10 -0
  48. package/template/.codex/skills/yss-openapi-governance/SKILL.md +6 -0
  49. package/template/.codex/skills/yss-product-lifecycle/SKILL.md +3 -1
  50. package/template/.codex/skills/yss-product-lifecycle/references/orchestration-contract.yaml +12 -0
  51. package/template/.codex/skills/yss-prototype-stage/SKILL.md +6 -0
  52. package/template/.codex/skills/yss-research/SKILL.md +6 -0
  53. package/template/.codex/skills/yss-stage-decision/SKILL.md +19 -4
  54. package/template/.codex/skills/yss-stage-decision/references/domain-strategy-contract.md +4 -3
  55. package/template/.codex/skills/yss-stage-decision/references/domain-strategy-v2.schema.json +8 -0
  56. package/template/.codex/skills/yss-stage-decision/references/domain-strategy-v3.schema.json +8 -0
  57. package/template/.codex/skills/yss-stage-decision/references/domain-strategy.schema.json +75 -5
  58. package/template/.codex/skills/yss-stage-decision/references/stage-decision-package-contract.md +4 -4
  59. package/template/.codex/skills/yss-stage-decision/references/stage-decision-package-v2.schema.json +8 -0
  60. package/template/.codex/skills/yss-stage-decision/references/stage-decision-package-v3.schema.json +8 -0
  61. package/template/.codex/skills/yss-stage-decision/references/stage-decision-package.schema.json +59 -9
  62. package/template/.codex/skills/yss-stage-decision/references/validation-rules.md +2 -2
  63. package/template/.codex/skills/yss-stage-decision/scripts/migrate-contract-v3.mjs +143 -0
  64. package/template/.codex/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +46 -4
  65. package/template/.codex/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +48 -4
  66. package/template/.codex/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +42 -13
  67. package/template/.codex/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +37 -5
  68. package/template/.codex/skills/yss-stage-decision/tests/run-scenarios.mjs +116 -23
  69. package/template/.codex/skills/yss-technical-design/SKILL.md +6 -0
  70. package/template/.cursor/skills/archify/SKILL.md +1 -1
  71. package/template/.cursor/skills/code-review/SKILL.md +6 -0
  72. package/template/.cursor/skills/i-have-adhd/LICENSE +21 -0
  73. package/template/.cursor/skills/i-have-adhd/SKILL.md +26 -0
  74. package/template/.cursor/skills/i-have-adhd/agents/openai.yaml +6 -0
  75. package/template/.cursor/skills/i-have-adhd/references/yss-adaptation.md +21 -0
  76. package/template/.cursor/skills/i-have-adhd/tests/verify-integration.mjs +63 -0
  77. package/template/.cursor/skills/prototype-review/SKILL.md +2 -0
  78. package/template/.cursor/skills/yss-implementation-contract-compiler/SKILL.md +6 -0
  79. package/template/.cursor/skills/yss-implementation-contract-compiler/references/boundaries.md +10 -0
  80. package/template/.cursor/skills/yss-openapi-governance/SKILL.md +6 -0
  81. package/template/.cursor/skills/yss-product-lifecycle/SKILL.md +3 -1
  82. package/template/.cursor/skills/yss-product-lifecycle/references/orchestration-contract.yaml +12 -0
  83. package/template/.cursor/skills/yss-prototype-stage/SKILL.md +6 -0
  84. package/template/.cursor/skills/yss-research/SKILL.md +6 -0
  85. package/template/.cursor/skills/yss-stage-decision/SKILL.md +19 -4
  86. package/template/.cursor/skills/yss-stage-decision/references/domain-strategy-contract.md +4 -3
  87. package/template/.cursor/skills/yss-stage-decision/references/domain-strategy-v2.schema.json +8 -0
  88. package/template/.cursor/skills/yss-stage-decision/references/domain-strategy-v3.schema.json +8 -0
  89. package/template/.cursor/skills/yss-stage-decision/references/domain-strategy.schema.json +75 -5
  90. package/template/.cursor/skills/yss-stage-decision/references/stage-decision-package-contract.md +4 -4
  91. package/template/.cursor/skills/yss-stage-decision/references/stage-decision-package-v2.schema.json +8 -0
  92. package/template/.cursor/skills/yss-stage-decision/references/stage-decision-package-v3.schema.json +8 -0
  93. package/template/.cursor/skills/yss-stage-decision/references/stage-decision-package.schema.json +59 -9
  94. package/template/.cursor/skills/yss-stage-decision/references/validation-rules.md +2 -2
  95. package/template/.cursor/skills/yss-stage-decision/scripts/migrate-contract-v3.mjs +143 -0
  96. package/template/.cursor/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +46 -4
  97. package/template/.cursor/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +48 -4
  98. package/template/.cursor/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +42 -13
  99. package/template/.cursor/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +37 -5
  100. package/template/.cursor/skills/yss-stage-decision/tests/run-scenarios.mjs +116 -23
  101. package/template/.cursor/skills/yss-technical-design/SKILL.md +6 -0
  102. package/template/.pi/skills/archify/SKILL.md +1 -1
  103. package/template/.pi/skills/code-review/SKILL.md +6 -0
  104. package/template/.pi/skills/i-have-adhd/LICENSE +21 -0
  105. package/template/.pi/skills/i-have-adhd/SKILL.md +26 -0
  106. package/template/.pi/skills/i-have-adhd/agents/openai.yaml +6 -0
  107. package/template/.pi/skills/i-have-adhd/references/yss-adaptation.md +21 -0
  108. package/template/.pi/skills/i-have-adhd/tests/verify-integration.mjs +63 -0
  109. package/template/.pi/skills/prototype-review/SKILL.md +2 -0
  110. package/template/.pi/skills/yss-implementation-contract-compiler/SKILL.md +6 -0
  111. package/template/.pi/skills/yss-implementation-contract-compiler/references/boundaries.md +10 -0
  112. package/template/.pi/skills/yss-openapi-governance/SKILL.md +6 -0
  113. package/template/.pi/skills/yss-product-lifecycle/SKILL.md +3 -1
  114. package/template/.pi/skills/yss-product-lifecycle/references/orchestration-contract.yaml +12 -0
  115. package/template/.pi/skills/yss-prototype-stage/SKILL.md +6 -0
  116. package/template/.pi/skills/yss-research/SKILL.md +6 -0
  117. package/template/.pi/skills/yss-stage-decision/SKILL.md +19 -4
  118. package/template/.pi/skills/yss-stage-decision/references/domain-strategy-contract.md +4 -3
  119. package/template/.pi/skills/yss-stage-decision/references/domain-strategy-v2.schema.json +8 -0
  120. package/template/.pi/skills/yss-stage-decision/references/domain-strategy-v3.schema.json +8 -0
  121. package/template/.pi/skills/yss-stage-decision/references/domain-strategy.schema.json +75 -5
  122. package/template/.pi/skills/yss-stage-decision/references/stage-decision-package-contract.md +4 -4
  123. package/template/.pi/skills/yss-stage-decision/references/stage-decision-package-v2.schema.json +8 -0
  124. package/template/.pi/skills/yss-stage-decision/references/stage-decision-package-v3.schema.json +8 -0
  125. package/template/.pi/skills/yss-stage-decision/references/stage-decision-package.schema.json +59 -9
  126. package/template/.pi/skills/yss-stage-decision/references/validation-rules.md +2 -2
  127. package/template/.pi/skills/yss-stage-decision/scripts/migrate-contract-v3.mjs +143 -0
  128. package/template/.pi/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +46 -4
  129. package/template/.pi/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +48 -4
  130. package/template/.pi/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +42 -13
  131. package/template/.pi/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +37 -5
  132. package/template/.pi/skills/yss-stage-decision/tests/run-scenarios.mjs +116 -23
  133. package/template/.pi/skills/yss-technical-design/SKILL.md +6 -0
  134. package/template/docs/agents/yss-skill-registry.yaml +22 -0
  135. package/template/docs/plan/templates/plan-template.md +8 -4
  136. package/template/docs/process/document-writing.md +77 -0
  137. package/template/docs/process/frontend-backend-delivery.md +7 -4
  138. package/template/docs/process/schemas/backend-delivery.schema.json +4 -0
  139. package/template/docs/process/schemas/frontend-delivery-acceptance-v1.schema.json +200 -0
  140. package/template/docs/process/schemas/frontend-delivery-acceptance.schema.json +37 -3
  141. package/template/docs/process/schemas/frontend-strategic-preflight.schema.json +32 -0
  142. package/template/docs/process/schemas/lifecycle-checkpoint.schema.json +2 -1
  143. package/template/docs/process/schemas/strategic-consumer-feedback.schema.json +40 -0
  144. package/template/docs/process/schemas/strategic-design-handoff-v3.schema.json +743 -0
  145. package/template/docs/process/schemas/strategic-design-handoff-v4.schema.json +712 -0
  146. package/template/docs/process/schemas/strategic-feedback-adjudication.schema.json +42 -0
  147. package/template/docs/process/schemas/strategic-handoff-domain-strategy-v3.schema.json +216 -0
  148. package/template/docs/process/schemas/strategic-handoff-import-receipt.schema.json +39 -0
  149. package/template/docs/process/schemas/strategic-handoff-stage-decision-package-v3.schema.json +148 -0
  150. package/template/docs/process/strategic-handoff-package.md +37 -4
  151. package/template/docs/process/templates/lifecycle-checkpoint-template.yaml +1 -0
  152. package/template/docs/process/templates/stage-checkpoint-template.md +1 -0
  153. package/template/docs/templates/examples/lifecycle-writing-examples.md +138 -0
  154. package/template/docs/templates/spec-template.md +16 -3
  155. package/template/docs/templates/vertical-slice-ticket-template.md +8 -4
  156. package/template/scripts/lib/approval-record.mjs +2 -1
  157. package/template/scripts/lib/backend-delivery.mjs +15 -3
  158. package/template/scripts/lib/frontend-delivery-boundary.mjs +20 -4
  159. package/template/scripts/lib/frontend-delivery.mjs +66 -2
  160. package/template/scripts/lib/profile-skill-sync.mjs +336 -0
  161. package/template/scripts/lib/strategic-feedback.mjs +33 -0
  162. package/template/scripts/lib/strategic-handoff-consumption.mjs +5 -0
  163. package/template/scripts/lib/strategic-handoff-io.mjs +1 -0
  164. package/template/scripts/lib/strategic-handoff.mjs +101 -10
  165. package/template/scripts/lib/user-decision-reuse.mjs +38 -0
  166. package/template/scripts/strategic-feedback +10 -0
  167. package/template/scripts/sync-profile-skills +43 -0
  168. package/template/scripts/verify-frontend-strategic-preflight +12 -0
  169. package/template/skills-lock.json +38 -20
  170. package/template.manifest.json +1 -0
  171. package/template.snapshot.json +6 -5
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: i-have-adhd
3
+ description: 在研发文档起草、修订、审查报告和交接表达时,按 YSS 中文规范组织具体、完整、可执行的输出;仅作用于当前文档工作。
4
+ license: MIT
5
+ ---
6
+
7
+ # i-have-adhd · YSS 适配
8
+
9
+ 为当前产物应用 `docs/process/document-writing.md`;该文是中文写法的唯一权威来源。需要例子时读取 `docs/templates/examples/lifecycle-writing-examples.md`。本技能是原资产所有者的配套技能,不持有业务决定、批准或生命周期状态。
10
+
11
+ ## 触发与作用域
12
+
13
+ 调用者在当前工作包含研究结论、Plan、Spec、设计说明、契约解释正文、Ticket、审查、交接、发布或复盘时,设置条件 `lifecycle-document-output` 并加载本技能。进度与会签表达也属于文档输出;纯代码修改、命令执行和后续无关会话不激活此条件。
14
+
15
+ 每次调用只覆盖输入指定的文档或报告。工作结束即结束本次作用域;用户后续要求正常表达或不使用本技能时遵从当前要求,不继承先前启用状态。不假设读者具有任何诊断。
16
+
17
+ ## 执行
18
+
19
+ 1. 接收产物类型、读者、允许改动范围和可读权威输入;先读共用规范,再读取对应阶段指引。字段、版本或规则来源不明确时保留缺口并回交原所有者,不补造业务决定。
20
+ 2. 先写当前问题、结论或交付行为,再提供依据和必要细节;按顺序动作、规则比较和因果说明选择编号、表格或段落。删除无信息的修饰和重复,不设置字数或规则数量上限。
21
+ 3. 对照输入核查主体、条件、例外、量词、范围、数值、证据、未决项、责任、时点和依赖。保持原 API 标识、schema、冻结行为、状态及批准证据;发现冲突时交回所有者,不以润色名义修复事实。
22
+ 4. 返回调整后的正文及必要的缺口说明,由原工作单元执行现有验证。明确区分已验证结果、估算和未知原因;未执行测试不写通过,多项实质阻塞全部保留。已授权工作由原执行者继续,不把可完成的操作转交用户。
23
+
24
+ 研究仍使用原研究证据合同;代码审查保留原轴、严重性、定位和结论;契约保持机器结构。共用规范不可读时停止受影响的文档改写并报告缺失引用,不妨碍独立的已授权工作。
25
+
26
+ 来源、固定版本和适配差异见 [YSS 适配说明](references/yss-adaptation.md)。只安装项目技能,不安装上游全局插件、hook 或会话持久模式。
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "i-have-adhd · YSS 文档配套"
3
+ short_description: "按当前研发文档任务应用中文写作规范,保持规则与证据完整"
4
+ default_prompt: "使用 i-have-adhd 配套技能改善当前研发文档表达,保留所有业务规则、证据、未决项和原批准状态。"
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,21 @@
1
+ # i-have-adhd 的 YSS 适配
2
+
3
+ 上游:`ayghri/i-have-adhd`;固定 revision:`7b9069b39972e269e61bd95c2f66ebb90cac6a02`;许可证见技能目录 `LICENSE`。
4
+
5
+ 原始文件来自 [固定版本目录](https://github.com/ayghri/i-have-adhd/tree/7b9069b39972e269e61bd95c2f66ebb90cac6a02/skills/i-have-adhd)。未经改写的来源基线保存在模板维护证据中;`upstream-files.json` 记录逐文件 SHA-256,`skills-lock.json` 记录上游目录哈希和当前技能目录哈希。基线不进入实例默认加载面。
6
+
7
+ | 上游行为 | YSS 适配 |
8
+ |---|---|
9
+ | 用户显式调用、会话持续 | 原技能名保留;文档工作按 `lifecycle-document-output` 条件调用,任务结束即失效 |
10
+ | 对读者作 ADHD 假设 | 面向所有文档读者,不引入诊断假设 |
11
+ | 行动前置、步骤编号、删除套话 | 消费中文写作规范,按产物类型决定信息顺序和格式 |
12
+ | 展示进度、下一步和具体时间 | 报告实际变化和全部必要阻塞;时间有依据才估算,不把工作推给用户 |
13
+ | 压缩可见列表 | 完整性优先,不设规则数量上限 |
14
+ | 原因与修复直接陈述 | 区分已知现象、待验证原因和实际验证结果 |
15
+ | 平台专属 agent 配置 | 不安装上游 Gemini 持久提示;项目 OpenAI 配置只描述当前文档配套用途 |
16
+
17
+ 生命周期仍拥有门禁、状态、批准和资产;本技能没有独立授权、审批或分支流程。正文规则只在 `docs/process/document-writing.md` 维护;本文件只解释来源差异。
18
+
19
+ 注册表将本技能声明为模型可调用、实例默认可发现的通用工作流 core 技能(仍只作为文档配套);调用者以条件依赖加载。上游 `disable-model-invocation: true` 在适配版移除;作用域由本技能触发条件限定,不延续上游会话开关。
20
+
21
+ 验证只证明来源、路由、投影和合同符合预期。中文文档质量需通过真实生成评估,不以结构检查或作者自检代替盲评效果。
@@ -0,0 +1,63 @@
1
+ // Structural and real dependency-resolution checks; not a model-output quality evaluation.
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import {pathToFileURL} from 'node:url';
6
+
7
+ const root=path.resolve(process.argv[2] || '.');
8
+ const read=ref=>fs.readFileSync(path.join(root,ref),'utf8');
9
+ const {parse}=await import(pathToFileURL(path.join(root,'scripts/vendor/yaml.mjs')));
10
+ const registry=parse(read('docs/agents/yss-skill-registry.yaml'));
11
+ const skill=registry.skills.find(x=>x.id==='i-have-adhd');
12
+ assert.equal(skill.instance_default_discoverable,true);
13
+ assert.equal(registry.invocation_contract.overrides['i-have-adhd'].invocation_mode,'model');
14
+ assert.ok(registry.invocation_contract.overrides['i-have-adhd'].exclusion_conditions.includes('unrelated-conversation'));
15
+ assert.ok(registry.invocation_contract.overrides['i-have-adhd'].exclusion_conditions.includes('user-disabled'));
16
+ const entry=read('.agents/skills/i-have-adhd/SKILL.md');
17
+ assert.ok(!entry.includes('disable-model-invocation: true'));
18
+ assert.equal(parse(read('.agents/skills/i-have-adhd/agents/openai.yaml')).policy.allow_implicit_invocation,true);
19
+ const lock=JSON.parse(read('skills-lock.json'));
20
+ const locked=lock.skills.shared['i-have-adhd'];
21
+ assert.equal(locked.source,'ayghri/i-have-adhd');
22
+ assert.equal(locked.sourceRevision,'7b9069b39972e269e61bd95c2f66ebb90cac6a02');
23
+ assert.notEqual(locked.upstreamHash,locked.effectiveHash);
24
+ const {treeHash}=await import(pathToFileURL(path.join(root,'scripts/lib/skill-supply-chain.mjs')));
25
+ assert.equal(treeHash(path.join(root,'.agents/skills/i-have-adhd')),locked.effectiveHash);
26
+ for (const target of locked.targets) {
27
+ const skillPath=target.endsWith('/i-have-adhd')?target:path.join(target,'i-have-adhd');
28
+ assert.equal(treeHash(path.join(root,skillPath)),locked.effectiveHash,`projection ${target}`);
29
+ }
30
+ for(const ref of ['docs/process/document-writing.md','docs/templates/examples/lifecycle-writing-examples.md']) {
31
+ assert.ok(read(ref).length);
32
+ assert.ok(!read(ref).includes('.template-source/'));
33
+ }
34
+ const callers=Object.entries(registry.skill_dependencies).filter(([,deps])=>deps.some(d=>d.skill==='i-have-adhd'));
35
+ assert.ok(callers.length>0);
36
+ for(const [owner,deps] of callers) {
37
+ const edge=deps.find(d=>d.skill==='i-have-adhd');
38
+ assert.equal(edge.type,'context-conditional');
39
+ assert.equal(edge.when,'lifecycle-document-output');
40
+ assert.ok(read(`.agents/skills/${owner}/SKILL.md`).includes('`i-have-adhd`'));
41
+ }
42
+ const orchestrator=registry.skills.find(x=>['yss-product-lifecycle','yss-strategic-design','harness-orchestrator'].includes(x.id)).id;
43
+ const contract=parse(read(`.agents/skills/${orchestrator}/references/orchestration-contract.yaml`));
44
+ assert.equal(contract.document_writing.supporting_skill,'i-have-adhd');
45
+ assert.equal(contract.document_writing.condition,'lifecycle-document-output');
46
+ assert.equal(contract.document_writing.scope,'current-document-work-only');
47
+ assert.equal(contract.document_writing.gate_and_status_semantics,'unchanged');
48
+
49
+ // Compile using the actual repository resolver, with and without the condition and again without it.
50
+ const compiler=path.join(root,'scripts/lib/implementation-contract-compiler.mjs');
51
+ if(fs.existsSync(compiler)) {
52
+ const api=await import(pathToFileURL(compiler));
53
+ const capability=registry.capabilities.find(c=>c.id==='governance.implementation-contract');
54
+ assert.ok(capability);
55
+ const run=conditions=>api.compileImplementationContract({registry,compilerContract:api.loadCompilerContract(),requiredCapabilities:[capability.id],conditions,root});
56
+ const off=run([]),on=run(['lifecycle-document-output']),next=run([]);
57
+ assert.ok(!off.required_skills.includes('i-have-adhd'));
58
+ assert.ok(on.required_skills.includes('i-have-adhd'));
59
+ assert.ok(!next.required_skills.includes('i-have-adhd'));
60
+ assert.equal(on.status,'draft');
61
+ console.log('PASS: actual resolver excludes code-only, includes document output, does not persist condition or approve the contract.');
62
+ } else console.log('N/A: this strategic-only template has no implementation compiler; conditional route verified in registry and orchestration contract.');
63
+ console.log(`PASS: source, license metadata, ${locked.targets.length} projections, ${callers.length} callers, scope and readable writing inputs. Model output quality not measured.`);
@@ -7,6 +7,8 @@ description: Use when independently reviewing low-fidelity UI, interaction specs
7
7
 
8
8
  Use this skill as the independent low-fidelity review in `yss-prototype-stage`. The review is fail-closed: if the design cannot drive calibrated requirements, API, frontend acceptance, and slices, send it back to product design. `yss-product-lifecycle` alone records the resulting `check.prototype-reviewed` decision.
9
9
 
10
+ 文档输出时按 `lifecycle-document-output` 条件调用 `i-have-adhd`,读取 `docs/process/document-writing.md`;作用域仅限当前产物,派发时传递条件及引用。
11
+
10
12
  ## Trigger Boundary
11
13
 
12
14
  Run this independent gate only when UI changes affect a primary user flow, navigation, permissions, exception/recovery states, state transitions, or OpenAPI implications. For copy edits, token/color/spacing adjustments, and isolated visual fixes with no behavior, state, permission, navigation, or API impact, record `not-applicable` with the impact assessment; do not create prototype-review artifacts.
@@ -7,6 +7,12 @@ description: Use when a YSS vertical slice is entering implementation, spans mul
7
7
 
8
8
  阶段 7 的实现合同编译器。它把已批准的生命周期资产、垂直切片、capability 和窄 Recipe 编译为 `Slice Implementation Contract` v2 草案;不批准合同、不写业务代码、不设置 `ready-for-agent`。
9
9
 
10
+ 文档输出时按 `lifecycle-document-output` 条件调用 `i-have-adhd`,读取 `docs/process/document-writing.md`;作用域仅限当前产物,派发时传递条件及引用。
11
+
12
+ ## 文档写作
13
+
14
+ 撰写实现合同的解释正文和切片交接说明前,读取 `docs/process/document-writing.md` 的共用写法及工程契约 / Ticket 指引;不改变结构化合同、批准状态或就绪条件。
15
+
10
16
  ## 输入
11
17
 
12
18
  先读取 Spec、切片 Ticket、需求冻结、适用的原型确认、OpenAPI Freeze/no-impact、系统/数据架构、Design Review、Build Architecture Checklist、实现仓库和验证命令。输入缺失、未批准或 `stale` 时输出 `blocked`,交回 `yss-product-lifecycle`。
@@ -18,6 +18,7 @@
18
18
 
19
19
  | Capability | Primary skill | Task modes |
20
20
  | --- | --- | --- |
21
+ | `writing.lifecycle-document` | `i-have-adhd` | `guidance` |
21
22
  | `architecture.technical-design` | `yss-technical-design` | `guidance`, `integration`, `review-input` |
22
23
  | `architecture.mvc-design` | `yss-mvc-design` | `guidance`, `integration`, `review-input` |
23
24
  | `layer.mvc-service` | `yss-application` | `guidance`, `integration`, `slice-implementation`, `troubleshooting`, `review-input` |
@@ -105,8 +106,16 @@
105
106
 
106
107
  | Skill | Dependency | Type | Condition |
107
108
  | --- | --- | --- | --- |
109
+ | `prototype-review` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
110
+ | `yss-implementation-contract-compiler` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
111
+ | `yss-openapi-governance` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
112
+ | `yss-stage-decision` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
113
+ | `yss-research` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
114
+ | `yss-product-lifecycle` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
115
+ | `code-review` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
108
116
  | `code-review` | `yss-repository` | `context-conditional` | `backend-persistence-impact` |
109
117
  | `code-review` | `yss-mybatis` | `context-conditional` | `backend-persistence-impact` |
118
+ | `yss-prototype-stage` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
110
119
  | `yss-prototype-stage` | `prototype-review` | `review-only` | — |
111
120
  | `yss-prototype-stage` | `yss-design-system` | `coordination-only` | — |
112
121
  | `yss-prototype-stage` | `yss-antdv-next-design` | `context-conditional` | `h2-vue-antdv-next-default` |
@@ -118,6 +127,7 @@
118
127
  | `yss-domain` | `domain-modeling` | `coordination-only` | — |
119
128
  | `yss-domain` | `yss-tactical-design` | `context-conditional` | `tactical-domain` |
120
129
  | `yss-domain` | `lombok` | `context-conditional` | `pojo` |
130
+ | `yss-technical-design` | `i-have-adhd` | `context-conditional` | `lifecycle-document-output` |
121
131
  | `yss-technical-design` | `yss-tactical-design` | `coordination-only` | `domain-driven` |
122
132
  | `yss-technical-design` | `yss-mvc-design` | `coordination-only` | `layered-mvc` |
123
133
  | `yss-mvc-design` | `yss-openapi-draft-review` | `review-only` | `api-impact` |
@@ -15,6 +15,12 @@ Spec / 设计输入 → OpenAPI YAML Draft → 审查与 Freeze → JSON 派生
15
15
 
16
16
  YSS DTO 的可复用 HTTP/JSON 映射由 `.agents/skills/yss-dto/references/openapi-wire-profile.yaml` 单一维护。它描述公开 wire shape,不是 Java 字段或 getter 清单;本 skill 必须消费 profile,不能在治理文档、feature YAML 和 JSON 中各自发明 `SingleResult`、`PageResult` 或 `PageQuery` 字段表。
17
17
 
18
+ 文档输出时按 `lifecycle-document-output` 条件调用 `i-have-adhd`,读取 `docs/process/document-writing.md`;作用域仅限当前产物,派发时传递条件及引用。
19
+
20
+ ## 文档写作
21
+
22
+ 编写接口说明和契约评审交接正文前,读取 `docs/process/document-writing.md` 的共用写法及工程契约指引;协议标识、schema、冻结状态和验证记录按原合同保存。
23
+
18
24
  ## 边界与职责
19
25
 
20
26
  使用 `yss-openapi-governance`:
@@ -7,6 +7,8 @@ description: 编排 YSS 产品或模块从机会调研到 Spec、原型、技术
7
7
 
8
8
  生命周期单一主控:识别请求、仓库身份和最近可信阶段,计算可执行 frontier,派发并验收工作单元;业务设计、实现和独立审查交给专项 skill。
9
9
 
10
+ 文档按 `document_writing` 条件调用 `i-have-adhd`,并传递 `docs/process/document-writing.md` 规范。
11
+
10
12
  ## 事实源与按需加载
11
13
 
12
14
  先读 `yss-project.yaml`、`CONTEXT.md`、相关 ADR、父 Ticket/checkpoint 和当前资产,按需加载合同子树:
@@ -25,7 +27,7 @@ description: 编排 YSS 产品或模块从机会调研到 Spec、原型、技术
25
27
  scripts/query-lifecycle-context --mode route --stage stage.plan --work-unit work-unit.plan-requirements --include execution_efficiency
26
28
  ```
27
29
 
28
- `--include` 接受编排合同的顶层键;非法模式、ID 或合同键必须失败。查询结果只是带摘要的权威事实投影,不成为新的事实源。解释性细节按需读取 `references/orchestration.md`、`references/state-model.md`、`references/artifact-dependencies.md`、`references/user-decisions.md` 和 `references/matt-yss-adapter.md`,达到最小充分证据后停止扩展上下文。
30
+ `--include` 接受编排合同的顶层键;非法模式、ID 或合同键必须失败。结果为权威投影;细节按需读 `references/orchestration.md`、`references/state-model.md`、`references/artifact-dependencies.md`、`references/user-decisions.md` 和 `references/matt-yss-adapter.md`,证据充分即停止加载。
29
31
 
30
32
  按 `execution_efficiency` 合并查询、复用未变资料并验证当前资产;产品流转不重跑模板套件。词汇对账、恢复核验及门禁不变,执行细节见 `references/orchestration.md`。
31
33
 
@@ -1,4 +1,16 @@
1
1
  schema_version: 1
2
+ document_writing:
3
+ supporting_skill: i-have-adhd
4
+ condition: lifecycle-document-output
5
+ scope: current-document-work-only
6
+ dispatch: pass-condition-and-reference-to-document-owner
7
+ reference: docs/process/document-writing.md
8
+ examples: docs/templates/examples/lifecycle-writing-examples.md
9
+ load_when: [lifecycle-document-draft, lifecycle-document-revision, progress-or-decision-presentation]
10
+ dispatch_input: include-reference-for-document-work
11
+ artifact_ownership: unchanged
12
+ gate_and_status_semantics: unchanged
13
+
2
14
  backend_architecture_identity_policy:
3
15
  source: docs/agents/yss-skill-registry.yaml#architecture_profiles
4
16
  schema: docs/process/schemas/backend-architecture-identity.schema.json
@@ -7,6 +7,12 @@ description: Use when a YSS feature has product-design impact on a primary flow,
7
7
 
8
8
  把产品设计影响收敛为跨 Agent 一致的原型交付物、证据和生命周期回流合同。它不替代 `yss-product-lifecycle` 的门禁裁决,也不把原型当作生产前端代码。
9
9
 
10
+ 文档输出时按 `lifecycle-document-output` 条件调用 `i-have-adhd`,读取 `docs/process/document-writing.md`;作用域仅限当前产物,派发时传递条件及引用。
11
+
12
+ ## 文档写作
13
+
14
+ 起草或修订交互说明、状态说明和设计结论前,读取 `docs/process/document-writing.md` 的共用写法及产品设计指引;原型视觉和行为仍消费当前设计合同。
15
+
10
16
  ## 进入条件与主入口
11
17
 
12
18
  - 先由 `yss-product-lifecycle` 判断产品设计影响;无行为变化的孤立视觉修复记录 `not-applicable`,不创建空资产。
@@ -9,6 +9,12 @@ Investigate facts that a YSS decision depends on. Produce evidence and bounded c
9
9
 
10
10
  `research` is a deprecated compatibility alias. Use `yss-research` in new assets and routing.
11
11
 
12
+ 文档输出时按 `lifecycle-document-output` 条件调用 `i-have-adhd`,读取 `docs/process/document-writing.md`;作用域仅限当前产物,派发时传递条件及引用。
13
+
14
+ ## 文档写作
15
+
16
+ 撰写研究简报或结论前,读取 `docs/process/document-writing.md` 的共用写法和研究指引;既有证据结构、来源限定和校验器要求保持完整。
17
+
12
18
  ## Profiles
13
19
 
14
20
  - `technical-evidence`: standards, official documentation, source code, third-party APIs, framework behavior, protocols, or implementation constraints. Decision-bearing claims must trace to primary sources.
@@ -7,6 +7,12 @@ description: 编排 Plan 到 Spec 入口的方案决策与业务边界、协作
7
7
 
8
8
  `yss-stage-decision` 是由生命周期主控调度的上游决策技能,负责把需求、产品、商务输入和业务边界与规则设计结果整理成可审查、可版本化、可被下游消费的方案决策包。它不替代生命周期主控,也不生成产品代码、原型、OpenAPI 或垂直切片 Ticket。
9
9
 
10
+ 文档输出时按 `lifecycle-document-output` 条件调用 `i-have-adhd`,读取 `docs/process/document-writing.md`;作用域仅限当前产物,派发时传递条件及引用。
11
+
12
+ ## 文档写作
13
+
14
+ 撰写方案决策包和业务边界说明前,读取 `docs/process/document-writing.md` 的共用写法及 Plan 指引;原业务规则、决定依据和未决项完整保留。
15
+
10
16
  ## 适用边界
11
17
 
12
18
  - 适用于 `project-instance` 的 Plan → Spec 入口。
@@ -18,13 +24,22 @@ description: 编排 Plan 到 Spec 入口的方案决策与业务边界、协作
18
24
 
19
25
  Plan 的目标与退出条件由 `docs/process/lifecycle-registry.yaml` 持有;从 `docs/plan/templates/plan-template.md` 汇总输入。旧资产按 `docs/process/plan-migration.md` 重新整理并核查,关键未决项不得延期到 Spec,非关键项记录责任人、解决时点与接收方。
20
26
 
21
- 1. 读取 `yss-project.yaml`、`CONTEXT.md`、既有 Plan/Spec、ADR 和父 Ticket/checkpoint。
27
+ 1. 读取 `yss-project.yaml`、`CONTEXT.md`、既有 Plan/Spec、ADR 和当前 profile 的主索引/checkpoint;按 `yss-product-lifecycle` 的 `request-triage` 区分事实确认、产品决定、门禁确认和普通澄清。
22
28
  2. 分离事实、决策、假设、约束和未决项;技术事实走 `yss-research` 的 `technical-evidence`,领域边界、业务规则、MVP、非目标、成功标准或阶段推进依据等决策证据走 `strategy-evidence`,市场/竞品事实走 `competitive-intelligence`。
23
29
  3. 从业务故事、已发生的事实、规则、责任人和失败路径识别业务板块与业务责任区,不从数据库表或调用链直接反推边界。
24
30
  4. 为每个业务责任区建立统一业务词汇;对跨责任区协作记录规则提供方、规则使用方、业务决策权、信息传递方向和口径转换负责人。
25
31
  5. 记录待确认的关键业务对象,不提前指定技术模型。
26
- 6. 生成 schema v2 `domain_strategy` 和 `stage_decision_package`,使用 `context_snapshot` 绑定根 `CONTEXT.md`、术语身份、完整文档 digest、引用术语 digest、证据和下游影响映射。
27
- 7. 运行 Schema、根路径、术语引用、digest、语义一致性和传播验证;发现关键冲突时返回 `blocked`,不得生成 `approved` 包。v1 字符串引用只读并返回 `migration-required`;可唯一定位的旧锚点用 `scripts/migrate-context-references.mjs` 迁移,歧义引用不得猜测。
32
+ 6. 生成 schema v3 `domain_strategy` 和 `stage_decision_package`,使用稳定规则、场景、决定、假设、约束、成功标准、测试 seam 和 downstream mapping ID,并以 `context_snapshot` 绑定根 `CONTEXT.md`、术语身份、完整文档 digest、引用术语 digest和证据。
33
+ 7. 运行 Schema、唯一性、悬空引用、根路径、术语引用、digest、语义一致性和传播验证;发现关键冲突时返回 `blocked`,不得生成 `approved` 包。v2 仅只读;修改或重发必须使用 `scripts/migrate-contract-v3.mjs` 显式迁移为 `draft` 并重新批准。v1 字符串引用先用 `scripts/migrate-context-references.mjs` 迁移到 v2;歧义引用不得猜测。
34
+
35
+ ## 控制面引用
36
+
37
+ - 用户决定遵循 `docs/process/lifecycle/references/user-decisions.md`:决定必须绑定资产、版本、范围和证据;范围、风险、摘要或失效条件变化后重新确认。
38
+ - checkpoint 是唯一机器状态源,业务 Ticket 只保存追踪引用,不复制阶段状态。
39
+ - 每次批准、重发和消费者流转前执行 `context_reconciliation`,核验 `CONTEXT.md` 的全文与引用术语双摘要。
40
+ - 技术事实与第三方行为走 `yss-research` 的 `technical-evidence`;产品策略依据走 `strategy-evidence`;市场与竞品判断走 `competitive-intelligence`。
41
+ - 修改本 Skill 时只编辑 `.agents/skills` 权威副本,再由 `maintaining-skills` 生成投影和 `skills-lock.json`。
42
+ - 本 Skill 只能标记影响、提出待解决问题和选择消费者能力;不得预选后端架构族,不得进入技术设计或实现流程,也不得授权实现。
28
43
 
29
44
  ## 语义方向规则
30
45
 
@@ -50,7 +65,7 @@ Plan 的目标与退出条件由 `docs/process/lifecycle-registry.yaml` 持有
50
65
  - 不在业务方案设计阶段生成技术模型、生产代码或 API 契约。
51
66
  - 不把模板 Fixture 当作具体项目的业务事实。
52
67
 
53
- 详细合同、字段和验证规则见 `references/domain-strategy-contract.md`、`references/stage-decision-package-contract.md` 与 `references/validation-rules.md`。机器可读合同分别为 `references/domain-strategy.schema.json` 和 `references/stage-decision-package.schema.json`;对应验证器为 `scripts/validate-domain-strategy.mjs` 与 `scripts/validate-stage-decision-package.mjs`。
68
+ 详细合同、字段和验证规则见 `references/domain-strategy-contract.md`、`references/stage-decision-package-contract.md` 与 `references/validation-rules.md`。当前机器可读合同分别为 `references/domain-strategy-v3.schema.json` 和 `references/stage-decision-package-v3.schema.json`;v2 schema 仅用于历史读取。对应验证器为 `scripts/validate-domain-strategy.mjs` 与 `scripts/validate-stage-decision-package.mjs`。
54
69
 
55
70
  ## 战略交接快照包
56
71
 
@@ -2,9 +2,10 @@
2
2
 
3
3
  ## 顶层结构
4
4
 
5
- 机器可读合同使用 `references/domain-strategy.schema.json`。顶层必须包含:
5
+ 当前机器可读合同使用 `references/domain-strategy-v3.schema.json`;`references/domain-strategy-v2.schema.json` 仅用于历史读取。顶层必须包含:
6
6
 
7
- - `schema_version: 2`、`domain_strategy_id`、`domain_version`、`status`;
7
+ - `schema_version: 3`、`domain_strategy_id`、`domain_version`、`status`、`traceability_version: 1`;
8
+ - 带稳定 `rule_id` 与证据的 `rule_catalog`;
8
9
  - `contexts`、`subdomains`、`relationships`、`scenarios`;
9
10
  - `concept_candidates`、`invariants`、`context_snapshot`;
10
11
  - `downstream_mapping`、`evidence_refs`、`approval`。
@@ -29,4 +30,4 @@
29
30
 
30
31
  ## 便携交付的逐条追溯
31
32
 
32
- 正式导出要求 `traceability_version: 1`、`rule_catalog`、场景 `rule_refs / critical / success_results` 和不变量 `rule_ref`。已有 v2 文档继续只读兼容;缺稳定规则 ID 或未重新批准时禁止正式导出。具体合同见 `docs/process/strategic-handoff-package.md`,不得由导出器发明业务身份。
33
+ 正式导出要求场景 `rule_refs / critical / success_results / evidence_refs` 和不变量 `rule_ref / evidence_refs`。`downstream_mapping` 必须使用稳定 `mapping_id`、来源 ID、消费者能力、影响项、传播规则和证据。已有 v2 文档继续只读兼容;修改或重发须显式迁移为 v3 `draft` 并重新批准。具体合同见 `docs/process/strategic-handoff-package.md`,不得由导出器发明业务身份。
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yss.local/schemas/domain-strategy-v2-compat.json",
4
+ "allOf": [
5
+ {"$ref": "domain-strategy.schema.json"},
6
+ {"properties": {"schema_version": {"const": 2}}, "required": ["schema_version"]}
7
+ ]
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yss.local/schemas/domain-strategy-v3.json",
4
+ "allOf": [
5
+ {"$ref": "domain-strategy.schema.json"},
6
+ {"properties": {"schema_version": {"const": 3}}, "required": ["schema_version"]}
7
+ ]
8
+ }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://yss.local/schemas/domain-strategy-v2.json",
3
+ "$id": "https://yss.local/schemas/domain-strategy-current.json",
4
4
  "title": "YSS 业务边界与规则设计",
5
5
  "type": "object",
6
6
  "required": ["schema_version", "domain_strategy_id", "domain_version", "status", "contexts", "subdomains", "relationships", "scenarios", "concept_candidates", "invariants", "context_snapshot", "downstream_mapping", "evidence_refs", "approval"],
7
7
  "properties": {
8
8
  "traceability_version": {"const": 1},
9
- "rule_catalog": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["rule_id", "statement", "responsible_context", "status"], "properties": {"rule_id": {"type": "string", "pattern": "^rule\\.[a-z0-9][a-z0-9-]*$"}, "statement": {"type": "string", "minLength": 1}, "responsible_context": {"type": "string", "minLength": 1}, "status": {"const": "confirmed"}}}, "minItems": 1},
10
- "schema_version": {"const": 2},
9
+ "rule_catalog": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["rule_id", "statement", "responsible_context", "status"], "properties": {"rule_id": {"type": "string", "pattern": "^rule\\.[a-z0-9][a-z0-9-]*$"}, "statement": {"type": "string", "minLength": 1}, "responsible_context": {"type": "string", "minLength": 1}, "status": {"const": "confirmed"}, "evidence_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}, "minItems": 1},
10
+ "schema_version": {"enum": [2, 3]},
11
11
  "domain_strategy_id": {"type": "string", "pattern": "^domain-strategy\\.[a-z0-9][a-z0-9-]*$"},
12
12
  "domain_version": {"type": "string", "pattern": "^v[0-9]+$"},
13
13
  "status": {"enum": ["draft", "ready-for-human", "approved", "stale", "blocked"]},
@@ -18,7 +18,7 @@
18
18
  "concept_candidates": {"type": "array", "items": {"$ref": "#/$defs/concept"}},
19
19
  "invariants": {"type": "array", "items": {"$ref": "#/$defs/invariant"}},
20
20
  "context_snapshot": {"$ref": "#/$defs/contextSnapshot"},
21
- "downstream_mapping": {"type": "array", "items": {"$ref": "#/$defs/mapping"}},
21
+ "downstream_mapping": {"type": "array"},
22
22
  "evidence_refs": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
23
23
  "approval": {"$ref": "#/$defs/approval"}
24
24
  },
@@ -132,6 +132,20 @@
132
132
  "reapproval_condition": {"type": "string", "minLength": 1}
133
133
  }
134
134
  },
135
+ "mappingV3": {
136
+ "type": "object",
137
+ "additionalProperties": false,
138
+ "required": ["mapping_id", "source_refs", "consumer_capability", "impacts", "propagation", "reapproval_condition", "evidence_refs"],
139
+ "properties": {
140
+ "mapping_id": {"type": "string", "pattern": "^mapping\\.[a-z0-9][a-z0-9-]*$"},
141
+ "source_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^(rule|scenario|invariant)\\.[a-z0-9][a-z0-9-]*$"}},
142
+ "consumer_capability": {"enum": ["backend-technical-design", "frontend-engineering-design", "delivery-coordination"]},
143
+ "impacts": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
144
+ "propagation": {"enum": ["direct", "transitive", "not-applicable", "stale"]},
145
+ "reapproval_condition": {"type": "string", "minLength": 1},
146
+ "evidence_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
147
+ }
148
+ },
135
149
  "approval": {
136
150
  "type": "object",
137
151
  "required": ["approval_ref", "approver", "persisted_ref", "current_version"],
@@ -142,5 +156,61 @@
142
156
  "current_version": {"type": "string", "pattern": "^v[0-9]+$"}
143
157
  }
144
158
  }
145
- }
159
+ },
160
+ "allOf": [
161
+ {
162
+ "if": {"properties": {"schema_version": {"const": 3}}, "required": ["schema_version"]},
163
+ "then": {
164
+ "required": ["traceability_version", "rule_catalog"],
165
+ "properties": {
166
+ "traceability_version": {"const": 1},
167
+ "rule_catalog": {
168
+ "items": {
169
+ "required": ["evidence_refs"],
170
+ "properties": {
171
+ "evidence_refs": {
172
+ "type": "array",
173
+ "minItems": 1,
174
+ "uniqueItems": true,
175
+ "items": {"type": "string", "minLength": 1}
176
+ }
177
+ }
178
+ }
179
+ },
180
+ "scenarios": {
181
+ "items": {
182
+ "required": ["rule_refs", "critical", "success_results", "evidence_refs"],
183
+ "properties": {
184
+ "evidence_refs": {
185
+ "type": "array",
186
+ "minItems": 1,
187
+ "uniqueItems": true,
188
+ "items": {"type": "string", "minLength": 1}
189
+ }
190
+ }
191
+ }
192
+ },
193
+ "invariants": {
194
+ "items": {
195
+ "required": ["rule_ref", "evidence_refs"],
196
+ "properties": {
197
+ "evidence_refs": {
198
+ "type": "array",
199
+ "minItems": 1,
200
+ "uniqueItems": true,
201
+ "items": {"type": "string", "minLength": 1}
202
+ }
203
+ }
204
+ }
205
+ },
206
+ "downstream_mapping": {"items": {"$ref": "#/$defs/mappingV3"}}
207
+ }
208
+ },
209
+ "else": {
210
+ "properties": {
211
+ "downstream_mapping": {"items": {"$ref": "#/$defs/mapping"}}
212
+ }
213
+ }
214
+ }
215
+ ]
146
216
  }
@@ -4,12 +4,12 @@
4
4
 
5
5
  ## 必须包含
6
6
 
7
- - 问题陈述、目标用户、MVP、非目标、成功标准和可执行的测试 seam;
8
- - 已确认决策、假设、约束和未决项;
7
+ - 问题陈述、目标用户、MVP、非目标,以及带稳定 ID、来源 ID 和证据的成功标准与可执行测试 seam;
8
+ - 带稳定 ID、来源 ID 和证据的已确认决策、假设、约束,以及有责任人的未决项;
9
9
  - `context_snapshot`:只引用根 `CONTEXT.md`,并绑定结构化术语身份、全文摘要和引用集摘要;
10
10
  - `domain_strategy_ref`:领域战略合同的稳定 ID、版本、digest 和批准状态;
11
11
  - UI/API/Data/Backend/Frontend/跨仓/高风险影响面布尔值;
12
- - 每个下游消费者的传播方式、重新批准条件、证据引用和批准记录。`approval.approval_ref` 必须指向可读取且通过 `scripts/verify-approval-record` 的 `check.stage-decision-package-approved` 会签记录;`approval.approver` 必须与记录中的 `role_id` 一致。
12
+ - 每个消费者能力的稳定 `mapping_id`、领域来源 ID、传播方式、重新批准条件、证据引用和批准记录。`approval.approval_ref` 必须指向可读取且通过 `scripts/verify-approval-record` 的 `gate.stage-decision-package-approved` 会签记录;`approval.approver` 必须与记录中的 `role_id` 一致。
13
13
 
14
14
  ## 未决项规则
15
15
 
@@ -19,4 +19,4 @@
19
19
 
20
20
  只有 `approved` 且引用的领域战略为 `approved`、版本当前的阶段包,才可以进入 Spec synthesis。任何领域战略 digest、版本或影响面变化都使阶段包 `stale`,并要求重新评估。
21
21
 
22
- 阶段包使用 `schema_version: 2`。旧版字符串路径或 Markdown 锚点只能通过迁移器读取;无法唯一映射到 `<ContextId>/<EnglishIdentifier>` 时返回 `migration-required`,不得猜测。
22
+ 新写入阶段包使用 `schema_version: 3`,且只能引用 Domain Strategy v3。v2 仅只读;修改或重新交付须用 `scripts/migrate-contract-v3.mjs` 生成未批准的 `draft` 后补齐来源并重新批准。旧版字符串路径或 Markdown 锚点先通过上下文迁移器读取;无法唯一映射到 `<ContextId>/<EnglishIdentifier>` 时返回 `migration-required`,不得猜测。
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yss.local/schemas/stage-decision-package-v2-compat.json",
4
+ "allOf": [
5
+ {"$ref": "stage-decision-package.schema.json"},
6
+ {"properties": {"schema_version": {"const": 2}}, "required": ["schema_version"]}
7
+ ]
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yss.local/schemas/stage-decision-package-v3.json",
4
+ "allOf": [
5
+ {"$ref": "stage-decision-package.schema.json"},
6
+ {"properties": {"schema_version": {"const": 3}}, "required": ["schema_version"]}
7
+ ]
8
+ }
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://yss.local/schemas/stage-decision-package-v2.json",
3
+ "$id": "https://yss.local/schemas/stage-decision-package-current.json",
4
4
  "title": "YSS Stage Decision Package",
5
5
  "type": "object",
6
6
  "required": ["schema_version", "stage_decision_id", "package_version", "status", "problem_statement", "target_users", "mvp", "non_goals", "success_criteria", "test_seams", "confirmed_decisions", "assumptions", "constraints", "unresolved_items", "context_snapshot", "domain_strategy_ref", "impact_assessment", "downstream_mapping", "evidence_refs", "approval"],
7
7
  "properties": {
8
- "schema_version": {"const": 2},
8
+ "schema_version": {"enum": [2, 3]},
9
9
  "stage_decision_id": {"type": "string", "pattern": "^stage-decision\\.[a-z0-9][a-z0-9-]*$"},
10
10
  "package_version": {"type": "string", "pattern": "^v[0-9]+$"},
11
11
  "status": {"enum": ["draft", "ready-for-human", "approved", "stale", "blocked"]},
@@ -13,16 +13,16 @@
13
13
  "target_users": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
14
14
  "mvp": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
15
15
  "non_goals": {"type": "array", "items": {"type": "string", "minLength": 1}},
16
- "success_criteria": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
17
- "test_seams": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
18
- "confirmed_decisions": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
19
- "assumptions": {"type": "array", "items": {"type": "string", "minLength": 1}},
20
- "constraints": {"type": "array", "items": {"type": "string", "minLength": 1}},
16
+ "success_criteria": {"type": "array", "minItems": 1},
17
+ "test_seams": {"type": "array", "minItems": 1},
18
+ "confirmed_decisions": {"type": "array", "minItems": 1},
19
+ "assumptions": {"type": "array"},
20
+ "constraints": {"type": "array"},
21
21
  "unresolved_items": {"type": "array", "items": {"$ref": "#/$defs/unresolved"}},
22
22
  "context_snapshot": {"$ref": "#/$defs/contextSnapshot"},
23
23
  "domain_strategy_ref": {"$ref": "#/$defs/domainRef"},
24
24
  "impact_assessment": {"$ref": "#/$defs/impact"},
25
- "downstream_mapping": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/mapping"}},
25
+ "downstream_mapping": {"type": "array", "minItems": 1},
26
26
  "evidence_refs": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
27
27
  "approval": {"$ref": "#/$defs/approval"}
28
28
  },
@@ -84,6 +84,31 @@
84
84
  "reapproval_condition": {"type": "string", "minLength": 1}
85
85
  }
86
86
  },
87
+ "recordV3": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": ["id", "statement", "evidence_refs"],
91
+ "properties": {
92
+ "id": {"type": "string", "pattern": "^(success-criterion|test-seam|decision|assumption|constraint)\\.[a-z0-9][a-z0-9-]*$"},
93
+ "statement": {"type": "string", "minLength": 1},
94
+ "source_refs": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^(rule|scenario|invariant)\\.[a-z0-9][a-z0-9-]*$"}},
95
+ "evidence_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
96
+ "status": {"enum": ["confirmed", "candidate", "stale"]}
97
+ }
98
+ },
99
+ "mappingV3": {
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": ["mapping_id", "source_refs", "consumer_capability", "propagation", "reapproval_condition", "evidence_refs"],
103
+ "properties": {
104
+ "mapping_id": {"type": "string", "pattern": "^mapping\\.[a-z0-9][a-z0-9-]*$"},
105
+ "source_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^(rule|scenario|invariant)\\.[a-z0-9][a-z0-9-]*$"}},
106
+ "consumer_capability": {"enum": ["backend-technical-design", "frontend-engineering-design", "delivery-coordination"]},
107
+ "propagation": {"enum": ["direct", "transitive", "not-applicable", "stale"]},
108
+ "reapproval_condition": {"type": "string", "minLength": 1},
109
+ "evidence_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
110
+ }
111
+ },
87
112
  "approval": {
88
113
  "type": "object",
89
114
  "required": ["approval_ref", "approver", "persisted_ref", "current_version"],
@@ -94,5 +119,30 @@
94
119
  "current_version": {"type": "string", "pattern": "^v[0-9]+$"}
95
120
  }
96
121
  }
97
- }
122
+ },
123
+ "allOf": [
124
+ {
125
+ "if": {"properties": {"schema_version": {"const": 3}}, "required": ["schema_version"]},
126
+ "then": {
127
+ "properties": {
128
+ "success_criteria": {"items": {"$ref": "#/$defs/recordV3"}},
129
+ "test_seams": {"items": {"$ref": "#/$defs/recordV3"}},
130
+ "confirmed_decisions": {"items": {"$ref": "#/$defs/recordV3"}},
131
+ "assumptions": {"items": {"$ref": "#/$defs/recordV3"}},
132
+ "constraints": {"items": {"$ref": "#/$defs/recordV3"}},
133
+ "downstream_mapping": {"items": {"$ref": "#/$defs/mappingV3"}}
134
+ }
135
+ },
136
+ "else": {
137
+ "properties": {
138
+ "success_criteria": {"items": {"type": "string", "minLength": 1}},
139
+ "test_seams": {"items": {"type": "string", "minLength": 1}},
140
+ "confirmed_decisions": {"items": {"type": "string", "minLength": 1}},
141
+ "assumptions": {"items": {"type": "string", "minLength": 1}},
142
+ "constraints": {"items": {"type": "string", "minLength": 1}},
143
+ "downstream_mapping": {"items": {"$ref": "#/$defs/mapping"}}
144
+ }
145
+ }
146
+ }
147
+ ]
98
148
  }