create-yss-spec 3.3.7 → 3.3.8

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 (131) hide show
  1. package/README.md +12 -13
  2. package/package.json +1 -1
  3. package/template/.agents/skills/.strategic-design-skills-manifest.json +2 -2
  4. package/template/.agents/skills/implementation-repo-onboarding/SKILL.md +2 -2
  5. package/template/.agents/skills/yss-application/SKILL.md +1 -1
  6. package/template/.agents/skills/yss-application/references/profiles/existing-domain-driven-maven.md +5 -0
  7. package/template/.agents/skills/yss-application/references/profiles/existing-layered-mvc-maven.md +5 -0
  8. package/template/.agents/skills/yss-implementation-contract-compiler/SKILL.md +2 -2
  9. package/template/.agents/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +4 -0
  10. package/template/.agents/skills/yss-product-lifecycle/references/orchestration-contract.yaml +6 -1
  11. package/template/.agents/skills/yss-prototype-stage/SKILL.md +10 -1
  12. package/template/.agents/skills/yss-technical-design/SKILL.md +2 -0
  13. package/template/.agents/skills/yss-technical-design/references/engineering-design.schema.json +224 -0
  14. package/template/.agents/skills/yss-technical-design/references/technical-design-common.schema.json +6 -0
  15. package/template/.agents/skills/yss-technical-design/references/technical-design.schema.json +288 -10
  16. package/template/.agents/skills/yss-technical-design/scripts/engineering-design.mjs +30 -0
  17. package/template/.agents/skills/yss-technical-design/scripts/generate-schema.mjs +2 -1
  18. package/template/.agents/skills/yss-technical-design/scripts/validate-technical-design.mjs +20 -8
  19. package/template/.agents/skills/yss-technical-design/tests/engineering-scenarios.mjs +12 -0
  20. package/template/.agents/skills/yss-web-controller/SKILL.md +1 -1
  21. package/template/.agents/skills/yss-web-controller/references/profiles/existing-domain-driven-maven.md +5 -0
  22. package/template/.agents/skills/yss-web-controller/references/profiles/existing-layered-mvc-maven.md +5 -0
  23. package/template/.codex/skills/implementation-repo-onboarding/SKILL.md +2 -2
  24. package/template/.codex/skills/yss-application/SKILL.md +1 -1
  25. package/template/.codex/skills/yss-application/references/profiles/existing-domain-driven-maven.md +5 -0
  26. package/template/.codex/skills/yss-application/references/profiles/existing-layered-mvc-maven.md +5 -0
  27. package/template/.codex/skills/yss-implementation-contract-compiler/SKILL.md +2 -2
  28. package/template/.codex/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +4 -0
  29. package/template/.codex/skills/yss-product-lifecycle/references/orchestration-contract.yaml +6 -1
  30. package/template/.codex/skills/yss-prototype-stage/SKILL.md +10 -1
  31. package/template/.codex/skills/yss-technical-design/SKILL.md +2 -0
  32. package/template/.codex/skills/yss-technical-design/references/engineering-design.schema.json +224 -0
  33. package/template/.codex/skills/yss-technical-design/references/technical-design-common.schema.json +6 -0
  34. package/template/.codex/skills/yss-technical-design/references/technical-design.schema.json +288 -10
  35. package/template/.codex/skills/yss-technical-design/scripts/engineering-design.mjs +30 -0
  36. package/template/.codex/skills/yss-technical-design/scripts/generate-schema.mjs +2 -1
  37. package/template/.codex/skills/yss-technical-design/scripts/validate-technical-design.mjs +20 -8
  38. package/template/.codex/skills/yss-technical-design/tests/engineering-scenarios.mjs +12 -0
  39. package/template/.codex/skills/yss-web-controller/SKILL.md +1 -1
  40. package/template/.codex/skills/yss-web-controller/references/profiles/existing-domain-driven-maven.md +5 -0
  41. package/template/.codex/skills/yss-web-controller/references/profiles/existing-layered-mvc-maven.md +5 -0
  42. package/template/.cursor/skills/implementation-repo-onboarding/SKILL.md +2 -2
  43. package/template/.cursor/skills/yss-application/SKILL.md +1 -1
  44. package/template/.cursor/skills/yss-application/references/profiles/existing-domain-driven-maven.md +5 -0
  45. package/template/.cursor/skills/yss-application/references/profiles/existing-layered-mvc-maven.md +5 -0
  46. package/template/.cursor/skills/yss-implementation-contract-compiler/SKILL.md +2 -2
  47. package/template/.cursor/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +4 -0
  48. package/template/.cursor/skills/yss-product-lifecycle/references/orchestration-contract.yaml +6 -1
  49. package/template/.cursor/skills/yss-prototype-stage/SKILL.md +10 -1
  50. package/template/.cursor/skills/yss-technical-design/SKILL.md +2 -0
  51. package/template/.cursor/skills/yss-technical-design/references/engineering-design.schema.json +224 -0
  52. package/template/.cursor/skills/yss-technical-design/references/technical-design-common.schema.json +6 -0
  53. package/template/.cursor/skills/yss-technical-design/references/technical-design.schema.json +288 -10
  54. package/template/.cursor/skills/yss-technical-design/scripts/engineering-design.mjs +30 -0
  55. package/template/.cursor/skills/yss-technical-design/scripts/generate-schema.mjs +2 -1
  56. package/template/.cursor/skills/yss-technical-design/scripts/validate-technical-design.mjs +20 -8
  57. package/template/.cursor/skills/yss-technical-design/tests/engineering-scenarios.mjs +12 -0
  58. package/template/.cursor/skills/yss-web-controller/SKILL.md +1 -1
  59. package/template/.cursor/skills/yss-web-controller/references/profiles/existing-domain-driven-maven.md +5 -0
  60. package/template/.cursor/skills/yss-web-controller/references/profiles/existing-layered-mvc-maven.md +5 -0
  61. package/template/.pi/skills/implementation-repo-onboarding/SKILL.md +2 -2
  62. package/template/.pi/skills/yss-application/SKILL.md +1 -1
  63. package/template/.pi/skills/yss-application/references/profiles/existing-domain-driven-maven.md +5 -0
  64. package/template/.pi/skills/yss-application/references/profiles/existing-layered-mvc-maven.md +5 -0
  65. package/template/.pi/skills/yss-implementation-contract-compiler/SKILL.md +2 -2
  66. package/template/.pi/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +4 -0
  67. package/template/.pi/skills/yss-product-lifecycle/references/orchestration-contract.yaml +6 -1
  68. package/template/.pi/skills/yss-prototype-stage/SKILL.md +10 -1
  69. package/template/.pi/skills/yss-technical-design/SKILL.md +2 -0
  70. package/template/.pi/skills/yss-technical-design/references/engineering-design.schema.json +224 -0
  71. package/template/.pi/skills/yss-technical-design/references/technical-design-common.schema.json +6 -0
  72. package/template/.pi/skills/yss-technical-design/references/technical-design.schema.json +288 -10
  73. package/template/.pi/skills/yss-technical-design/scripts/engineering-design.mjs +30 -0
  74. package/template/.pi/skills/yss-technical-design/scripts/generate-schema.mjs +2 -1
  75. package/template/.pi/skills/yss-technical-design/scripts/validate-technical-design.mjs +20 -8
  76. package/template/.pi/skills/yss-technical-design/tests/engineering-scenarios.mjs +12 -0
  77. package/template/.pi/skills/yss-web-controller/SKILL.md +1 -1
  78. package/template/.pi/skills/yss-web-controller/references/profiles/existing-domain-driven-maven.md +5 -0
  79. package/template/.pi/skills/yss-web-controller/references/profiles/existing-layered-mvc-maven.md +5 -0
  80. package/template/README.md +4 -6
  81. package/template/docs/agents/backend-architecture-profiles.md +4 -0
  82. package/template/docs/agents/yss-skill-registry.yaml +13 -0
  83. package/template/docs/design/templates/prototype-confirmation-template.md +2 -2
  84. package/template/docs/design/templates/prototype-review-checklist.md +2 -2
  85. package/template/docs/plan/templates/market-analysis-template.md +3 -3
  86. package/template/docs/plan/templates/user-pain-points-template.md +3 -3
  87. package/template/docs/process/delivery-preflight.md +72 -0
  88. package/template/docs/process/document-writing.md +5 -1
  89. package/template/docs/process/existing-backend-architecture.md +31 -0
  90. package/template/docs/process/existing-ui-baseline.md +40 -0
  91. package/template/docs/process/frontend-backend-delivery.md +19 -6
  92. package/template/docs/process/implementation-repo-integration.md +6 -0
  93. package/template/docs/process/schemas/backend-architecture-identity.schema.json +111 -14
  94. package/template/docs/process/schemas/delivery-preflight-input.schema.json +158 -0
  95. package/template/docs/process/schemas/delivery-preflight-result.schema.json +159 -0
  96. package/template/docs/process/schemas/digital-human-task-package.schema.json +1 -1
  97. package/template/docs/process/schemas/existing-ui-baseline.schema.json +365 -0
  98. package/template/docs/process/schemas/frontend-delivery-acceptance-v3.schema.json +308 -0
  99. package/template/docs/process/schemas/frontend-strategic-preflight-v2.schema.json +114 -0
  100. package/template/docs/process/schemas/strategic-design-handoff-v5.schema.json +932 -0
  101. package/template/docs/process/schemas/strategic-handoff-export-v2.schema.json +378 -0
  102. package/template/docs/process/strategic-handoff-package.md +21 -13
  103. package/template/docs/user-guide//346/212/200/346/234/257/350/256/276/350/256/241/347/224/250/346/210/267/346/214/207/345/215/227.md +43 -0
  104. package/template/docs/user-guide//347/224/250/346/210/267/346/211/213/345/206/214.md +83 -67
  105. package/template/docs/user-guide//347/224/250/346/210/267/346/211/213/345/206/214/347/264/242/345/274/225.md +9 -10
  106. package/template/docs/user-guide//350/256/276/345/244/207/345/200/237/347/224/250/350/264/257/347/251/277/346/241/210/344/276/213.md +12 -9
  107. package/template/scripts/backend-delivery +20 -4
  108. package/template/scripts/lib/approved-execution-context.mjs +106 -0
  109. package/template/scripts/lib/backend-architecture.mjs +12 -0
  110. package/template/scripts/lib/backend-delivery.mjs +10 -6
  111. package/template/scripts/lib/delivery-preflight.mjs +238 -0
  112. package/template/scripts/lib/existing-backend-architecture.mjs +139 -0
  113. package/template/scripts/lib/existing-ui-baseline.mjs +84 -0
  114. package/template/scripts/lib/frontend-delivery.mjs +23 -15
  115. package/template/scripts/lib/implementation-contract-compiler.mjs +19 -5
  116. package/template/scripts/lib/json-schema.mjs +19 -4
  117. package/template/scripts/lib/profile-skill-sync.mjs +26 -0
  118. package/template/scripts/lib/strategic-handoff-consumption.mjs +6 -5
  119. package/template/scripts/lib/strategic-handoff-design-targets.mjs +2 -3
  120. package/template/scripts/lib/strategic-handoff-io.mjs +10 -0
  121. package/template/scripts/lib/strategic-handoff.mjs +47 -29
  122. package/template/scripts/lib/task-package.mjs +11 -3
  123. package/template/scripts/lib/technical-design-boundary.mjs +9 -1
  124. package/template/scripts/lib/ui-baseline.mjs +26 -0
  125. package/template/scripts/lib/user-decision.mjs +4 -1
  126. package/template/scripts/preflight-delivery +14 -0
  127. package/template/scripts/strategic-handoff +19 -4
  128. package/template/scripts/sync-profile-skills +4 -5
  129. package/template/skills-lock.json +15 -15
  130. package/template.snapshot.json +3 -3
  131. package/template/docs/user-guide//346/210/230/346/234/257/350/256/276/350/256/241/345/255/220/351/241/271/347/233/256/347/224/250/346/210/267/346/211/213/345/206/214.md +0 -35
@@ -24,6 +24,8 @@ description: 在 YSS 技术分析中统一承接需求与战略输入,按已
24
24
 
25
25
  已有 Strategic Design Handoff 时,两种分支都必须先完成导入和目标词汇对账,再逐条承接规则与关键场景。没有战略交接包的项目直接消费批准需求,不能为 MVC 补造战略 DDD。
26
26
 
27
+ 既有身份 v2 的纯工程变更可显式使用 `design_scope: engineering-only`;按 `references/engineering-design.schema.json` 绑定真实构建单元、写路径、只读依赖、失败处理与测试 seam。不得更改登记业务边界、领域模型、业务规则/状态、持久化、数据库 schema 或 UI;命中这些影响回原架构设计。缺省仍保留原 DDD/MVC 规则,不自动降级。工程分支仍需当前 Spec/API/工程依据、逐条承接、独立技术审查及正式 Slice 批准。
28
+
27
29
  ## 合同与验证
28
30
 
29
31
  新产物使用 schema v2 Technical Design Contract:共同头记录架构来源、输入版本与摘要、规则/场景承接、评审证据和状态,`design` 保存架构专属内容。合同格式与兼容规则见 `references/technical-design-contract.md`,Schema 见 `references/technical-design.schema.json`。
@@ -0,0 +1,224 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "scope_reason": {
5
+ "type": "string",
6
+ "minLength": 1
7
+ },
8
+ "impact_assessment": {
9
+ "type": "object",
10
+ "properties": {
11
+ "domain_model": {
12
+ "const": "none"
13
+ },
14
+ "business_state": {
15
+ "const": "none"
16
+ },
17
+ "business_rules": {
18
+ "const": "none"
19
+ },
20
+ "business_persistence": {
21
+ "const": "none"
22
+ },
23
+ "schema_migration": {
24
+ "const": "none"
25
+ },
26
+ "ui_change": {
27
+ "const": "none"
28
+ },
29
+ "architecture_boundary_change": {
30
+ "const": "none"
31
+ }
32
+ },
33
+ "required": [
34
+ "domain_model",
35
+ "business_state",
36
+ "business_rules",
37
+ "business_persistence",
38
+ "schema_migration",
39
+ "ui_change",
40
+ "architecture_boundary_change"
41
+ ],
42
+ "additionalProperties": false
43
+ },
44
+ "component_catalog": {
45
+ "type": "array",
46
+ "minItems": 1,
47
+ "items": {
48
+ "type": "object",
49
+ "properties": {
50
+ "component_id": {
51
+ "type": "string",
52
+ "minLength": 1
53
+ },
54
+ "responsibility": {
55
+ "type": "string",
56
+ "minLength": 1
57
+ },
58
+ "build_unit_ref": {
59
+ "type": "string",
60
+ "minLength": 1
61
+ },
62
+ "write_paths": {
63
+ "type": "array",
64
+ "minItems": 1,
65
+ "items": {
66
+ "type": "string",
67
+ "minLength": 1
68
+ }
69
+ },
70
+ "depends_on": {
71
+ "type": "array",
72
+ "minItems": 0,
73
+ "items": {
74
+ "type": "string",
75
+ "minLength": 1
76
+ }
77
+ }
78
+ },
79
+ "required": [
80
+ "component_id",
81
+ "responsibility",
82
+ "build_unit_ref",
83
+ "write_paths",
84
+ "depends_on"
85
+ ],
86
+ "additionalProperties": false
87
+ }
88
+ },
89
+ "allowed_write_paths": {
90
+ "type": "array",
91
+ "minItems": 1,
92
+ "items": {
93
+ "type": "string",
94
+ "minLength": 1
95
+ }
96
+ },
97
+ "read_dependencies": {
98
+ "type": "array",
99
+ "minItems": 1,
100
+ "items": {
101
+ "type": "object",
102
+ "properties": {
103
+ "ref": {
104
+ "type": "string",
105
+ "minLength": 1
106
+ },
107
+ "digest": {
108
+ "type": "string",
109
+ "pattern": "^sha256:[a-f0-9]{64}$"
110
+ },
111
+ "purpose": {
112
+ "type": "string",
113
+ "minLength": 1
114
+ }
115
+ },
116
+ "required": [
117
+ "ref",
118
+ "digest",
119
+ "purpose"
120
+ ],
121
+ "additionalProperties": false
122
+ }
123
+ },
124
+ "flow": {
125
+ "type": "array",
126
+ "minItems": 1,
127
+ "items": {
128
+ "type": "string",
129
+ "minLength": 1
130
+ }
131
+ },
132
+ "failure_handling": {
133
+ "type": "string",
134
+ "minLength": 1
135
+ },
136
+ "consistency_policy": {
137
+ "type": "object",
138
+ "properties": {
139
+ "read_only": {
140
+ "const": "read-only"
141
+ },
142
+ "transaction_boundary": {
143
+ "type": "string",
144
+ "minLength": 1
145
+ },
146
+ "concurrency": {
147
+ "type": "string",
148
+ "minLength": 1
149
+ },
150
+ "idempotency": {
151
+ "type": "string",
152
+ "minLength": 1
153
+ },
154
+ "cross_database_limit": {
155
+ "type": "string",
156
+ "minLength": 1
157
+ },
158
+ "timeouts": {
159
+ "type": "string",
160
+ "minLength": 1
161
+ },
162
+ "recovery": {
163
+ "type": "string",
164
+ "minLength": 1
165
+ }
166
+ },
167
+ "required": [
168
+ "read_only",
169
+ "transaction_boundary",
170
+ "concurrency",
171
+ "idempotency",
172
+ "cross_database_limit",
173
+ "timeouts",
174
+ "recovery"
175
+ ],
176
+ "additionalProperties": false
177
+ },
178
+ "test_seams": {
179
+ "type": "array",
180
+ "minItems": 1,
181
+ "items": {
182
+ "type": "object",
183
+ "properties": {
184
+ "seam_id": {
185
+ "type": "string",
186
+ "minLength": 1
187
+ },
188
+ "kind": {
189
+ "type": "string",
190
+ "minLength": 1
191
+ },
192
+ "subject_ref": {
193
+ "type": "string",
194
+ "minLength": 1
195
+ },
196
+ "assertion": {
197
+ "type": "string",
198
+ "minLength": 1
199
+ }
200
+ },
201
+ "required": [
202
+ "seam_id",
203
+ "kind",
204
+ "subject_ref",
205
+ "assertion"
206
+ ],
207
+ "additionalProperties": false
208
+ }
209
+ }
210
+ },
211
+ "required": [
212
+ "scope_reason",
213
+ "impact_assessment",
214
+ "component_catalog",
215
+ "allowed_write_paths",
216
+ "read_dependencies",
217
+ "flow",
218
+ "failure_handling",
219
+ "consistency_policy",
220
+ "test_seams"
221
+ ],
222
+ "additionalProperties": false,
223
+ "title": "既有工程的受控工程技术设计"
224
+ }
@@ -266,6 +266,12 @@
266
266
  "digest": {
267
267
  "type": "string",
268
268
  "pattern": "^sha256:[a-f0-9]{64}$"
269
+ },
270
+ "design_scope": {
271
+ "enum": [
272
+ "architecture-specific",
273
+ "engineering-only"
274
+ ]
269
275
  }
270
276
  },
271
277
  "required": [
@@ -266,6 +266,12 @@
266
266
  "digest": {
267
267
  "type": "string",
268
268
  "pattern": "^sha256:[a-f0-9]{64}$"
269
+ },
270
+ "design_scope": {
271
+ "enum": [
272
+ "architecture-specific",
273
+ "engineering-only"
274
+ ]
269
275
  }
270
276
  },
271
277
  "required": [
@@ -290,15 +296,31 @@
290
296
  "allOf": [
291
297
  {
292
298
  "if": {
293
- "properties": {
294
- "architecture": {
299
+ "allOf": [
300
+ {
301
+ "not": {
302
+ "required": [
303
+ "design_scope"
304
+ ],
305
+ "properties": {
306
+ "design_scope": {
307
+ "const": "engineering-only"
308
+ }
309
+ }
310
+ }
311
+ },
312
+ {
295
313
  "properties": {
296
- "family": {
297
- "const": "domain-driven"
314
+ "architecture": {
315
+ "properties": {
316
+ "family": {
317
+ "const": "domain-driven"
318
+ }
319
+ }
298
320
  }
299
321
  }
300
322
  }
301
- }
323
+ ]
302
324
  },
303
325
  "then": {
304
326
  "properties": {
@@ -427,15 +449,31 @@
427
449
  },
428
450
  {
429
451
  "if": {
430
- "properties": {
431
- "architecture": {
452
+ "allOf": [
453
+ {
454
+ "not": {
455
+ "required": [
456
+ "design_scope"
457
+ ],
458
+ "properties": {
459
+ "design_scope": {
460
+ "const": "engineering-only"
461
+ }
462
+ }
463
+ }
464
+ },
465
+ {
432
466
  "properties": {
433
- "family": {
434
- "const": "layered-mvc"
467
+ "architecture": {
468
+ "properties": {
469
+ "family": {
470
+ "const": "layered-mvc"
471
+ }
472
+ }
435
473
  }
436
474
  }
437
475
  }
438
- }
476
+ ]
439
477
  },
440
478
  "then": {
441
479
  "properties": {
@@ -754,6 +792,246 @@
754
792
  }
755
793
  }
756
794
  }
795
+ },
796
+ {
797
+ "if": {
798
+ "required": [
799
+ "design_scope"
800
+ ],
801
+ "properties": {
802
+ "design_scope": {
803
+ "const": "engineering-only"
804
+ }
805
+ }
806
+ },
807
+ "then": {
808
+ "properties": {
809
+ "design": {
810
+ "type": "object",
811
+ "properties": {
812
+ "scope_reason": {
813
+ "type": "string",
814
+ "minLength": 1
815
+ },
816
+ "impact_assessment": {
817
+ "type": "object",
818
+ "properties": {
819
+ "domain_model": {
820
+ "const": "none"
821
+ },
822
+ "business_state": {
823
+ "const": "none"
824
+ },
825
+ "business_rules": {
826
+ "const": "none"
827
+ },
828
+ "business_persistence": {
829
+ "const": "none"
830
+ },
831
+ "schema_migration": {
832
+ "const": "none"
833
+ },
834
+ "ui_change": {
835
+ "const": "none"
836
+ },
837
+ "architecture_boundary_change": {
838
+ "const": "none"
839
+ }
840
+ },
841
+ "required": [
842
+ "domain_model",
843
+ "business_state",
844
+ "business_rules",
845
+ "business_persistence",
846
+ "schema_migration",
847
+ "ui_change",
848
+ "architecture_boundary_change"
849
+ ],
850
+ "additionalProperties": false
851
+ },
852
+ "component_catalog": {
853
+ "type": "array",
854
+ "minItems": 1,
855
+ "items": {
856
+ "type": "object",
857
+ "properties": {
858
+ "component_id": {
859
+ "type": "string",
860
+ "minLength": 1
861
+ },
862
+ "responsibility": {
863
+ "type": "string",
864
+ "minLength": 1
865
+ },
866
+ "build_unit_ref": {
867
+ "type": "string",
868
+ "minLength": 1
869
+ },
870
+ "write_paths": {
871
+ "type": "array",
872
+ "minItems": 1,
873
+ "items": {
874
+ "type": "string",
875
+ "minLength": 1
876
+ }
877
+ },
878
+ "depends_on": {
879
+ "type": "array",
880
+ "minItems": 0,
881
+ "items": {
882
+ "type": "string",
883
+ "minLength": 1
884
+ }
885
+ }
886
+ },
887
+ "required": [
888
+ "component_id",
889
+ "responsibility",
890
+ "build_unit_ref",
891
+ "write_paths",
892
+ "depends_on"
893
+ ],
894
+ "additionalProperties": false
895
+ }
896
+ },
897
+ "allowed_write_paths": {
898
+ "type": "array",
899
+ "minItems": 1,
900
+ "items": {
901
+ "type": "string",
902
+ "minLength": 1
903
+ }
904
+ },
905
+ "read_dependencies": {
906
+ "type": "array",
907
+ "minItems": 1,
908
+ "items": {
909
+ "type": "object",
910
+ "properties": {
911
+ "ref": {
912
+ "type": "string",
913
+ "minLength": 1
914
+ },
915
+ "digest": {
916
+ "type": "string",
917
+ "pattern": "^sha256:[a-f0-9]{64}$"
918
+ },
919
+ "purpose": {
920
+ "type": "string",
921
+ "minLength": 1
922
+ }
923
+ },
924
+ "required": [
925
+ "ref",
926
+ "digest",
927
+ "purpose"
928
+ ],
929
+ "additionalProperties": false
930
+ }
931
+ },
932
+ "flow": {
933
+ "type": "array",
934
+ "minItems": 1,
935
+ "items": {
936
+ "type": "string",
937
+ "minLength": 1
938
+ }
939
+ },
940
+ "failure_handling": {
941
+ "type": "string",
942
+ "minLength": 1
943
+ },
944
+ "consistency_policy": {
945
+ "type": "object",
946
+ "properties": {
947
+ "read_only": {
948
+ "const": "read-only"
949
+ },
950
+ "transaction_boundary": {
951
+ "type": "string",
952
+ "minLength": 1
953
+ },
954
+ "concurrency": {
955
+ "type": "string",
956
+ "minLength": 1
957
+ },
958
+ "idempotency": {
959
+ "type": "string",
960
+ "minLength": 1
961
+ },
962
+ "cross_database_limit": {
963
+ "type": "string",
964
+ "minLength": 1
965
+ },
966
+ "timeouts": {
967
+ "type": "string",
968
+ "minLength": 1
969
+ },
970
+ "recovery": {
971
+ "type": "string",
972
+ "minLength": 1
973
+ }
974
+ },
975
+ "required": [
976
+ "read_only",
977
+ "transaction_boundary",
978
+ "concurrency",
979
+ "idempotency",
980
+ "cross_database_limit",
981
+ "timeouts",
982
+ "recovery"
983
+ ],
984
+ "additionalProperties": false
985
+ },
986
+ "test_seams": {
987
+ "type": "array",
988
+ "minItems": 1,
989
+ "items": {
990
+ "type": "object",
991
+ "properties": {
992
+ "seam_id": {
993
+ "type": "string",
994
+ "minLength": 1
995
+ },
996
+ "kind": {
997
+ "type": "string",
998
+ "minLength": 1
999
+ },
1000
+ "subject_ref": {
1001
+ "type": "string",
1002
+ "minLength": 1
1003
+ },
1004
+ "assertion": {
1005
+ "type": "string",
1006
+ "minLength": 1
1007
+ }
1008
+ },
1009
+ "required": [
1010
+ "seam_id",
1011
+ "kind",
1012
+ "subject_ref",
1013
+ "assertion"
1014
+ ],
1015
+ "additionalProperties": false
1016
+ }
1017
+ }
1018
+ },
1019
+ "required": [
1020
+ "scope_reason",
1021
+ "impact_assessment",
1022
+ "component_catalog",
1023
+ "allowed_write_paths",
1024
+ "read_dependencies",
1025
+ "flow",
1026
+ "failure_handling",
1027
+ "consistency_policy",
1028
+ "test_seams"
1029
+ ],
1030
+ "additionalProperties": false,
1031
+ "title": "既有工程的受控工程技术设计"
1032
+ }
1033
+ }
1034
+ }
757
1035
  }
758
1036
  ]
759
1037
  }
@@ -0,0 +1,30 @@
1
+ import path from 'node:path';
2
+ import {readFileSync} from 'node:fs';
3
+ import {ensure,read,safe,hash} from '../../../../scripts/lib/strategic-handoff-io.mjs';
4
+ const beneath=(ref,scope)=>ref===scope||ref.startsWith(`${scope}/`);
5
+ export function validateEngineeringDesign(data,{root}) {
6
+ const registration=read(safe(root,data.architecture.decision_ref));
7
+ ensure(registration.architecture_identity?.schema_version===2&&registration.architecture_identity.source_kind==='existing-registration','工程设计分支只承接既有工程身份 v2');
8
+ const binding=registration.architecture_evidence.engineering_baseline;
9
+ ensure(hash(readFileSync(safe(root,binding.ref)))===binding.digest,'工程设计基线摘要漂移');
10
+ const baseline=read(safe(root,binding.ref)),design=data.design;
11
+ ensure(data.inputs.some(x=>x.kind==='engineering'&&x.ref===binding.ref&&x.digest===binding.digest),'工程设计未绑定当前基线输入');
12
+ ensure(data.inputs.some(x=>x.kind==='api'),'工程设计需当前API或经审查的无API依据');
13
+ const ids=new Set(design.component_catalog.map(x=>x.component_id));
14
+ ensure(ids.size===design.component_catalog.length,'工程组件ID重复');
15
+ const paths=new Set();
16
+ for(const component of design.component_catalog){
17
+ const unit=baseline.build_units.find(x=>x.id===component.build_unit_ref);ensure(unit,'工程组件引用未登记的实际构建单元');
18
+ ensure(component.depends_on.every(id=>ids.has(id)),'工程组件依赖悬空');
19
+ for(const ref of component.write_paths){
20
+ ensure(!path.isAbsolute(ref)&&ref.split('/').every(p=>p&&p!=='.'&&p!=='..')&&!ref.includes('\\'),'工程写路径不安全');
21
+ ensure(registration.allowed_write_paths.some(scope=>beneath(ref,scope)),'工程组件写路径超出登记范围');
22
+ ensure(!baseline.boundary_scope.some(scope=>beneath(ref,scope)||beneath(scope,ref)),'工程分支不能改已登记业务架构边界');
23
+ const unitRoot=path.posix.dirname(unit.pom_ref);
24
+ ensure(unitRoot==='.'||beneath(ref,unitRoot),'工程组件写路径与实际构建单元不符');paths.add(ref);
25
+ }
26
+ }
27
+ ensure(design.allowed_write_paths.length===paths.size&&design.allowed_write_paths.every(ref=>paths.has(ref)),'工程设计写范围与组件闭包不一致');
28
+ ensure(data.source_items.length&&data.traceability.every(row=>row.disposition==='implemented'),'工程设计必须逐条承接当前范围,不得全标不适用或延期');
29
+ for(const input of design.read_dependencies)ensure(data.inputs.some(x=>x.ref===input.ref&&x.digest===input.digest),'工程只读依赖未绑定当前输入');
30
+ }
@@ -10,8 +10,9 @@ const branches = [
10
10
  schema.$comment = 'Generated by scripts/generate-schema.mjs from common and specialist schemas. Do not hand-edit.';
11
11
  schema.allOf = branches.map(([family, ref]) => {
12
12
  const branch = load(ref); delete branch.$id; delete branch.$schema;
13
- return { if: { properties: { architecture: { properties: { family: { const: family } } } } }, then: { properties: { design: branch } } };
13
+ return { if: { allOf: [{ not: { required: ['design_scope'], properties: { design_scope: { const: 'engineering-only' } } } }, { properties: { architecture: { properties: { family: { const: family } } } } }] }, then: { properties: { design: branch } } };
14
14
  });
15
+ schema.allOf.push({if:{required:['design_scope'],properties:{design_scope:{const:'engineering-only'}}},then:{properties:{design:load('../references/engineering-design.schema.json')}}});
15
16
  const output = fileURLToPath(new URL('../references/technical-design.schema.json', import.meta.url));
16
17
  const bytes = `${JSON.stringify(schema, null, 2)}\n`;
17
18
  if (process.argv.includes('--check')) {