create-yss-spec 3.4.8 → 3.4.10

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 (459) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/template/attach-planner.js +5 -0
  4. package/src/template/sync-planner.js +5 -0
  5. package/template/.agents/skills/.strategic-design-skills-manifest.json +5 -5
  6. package/template/.agents/skills/alibaba-java-code-style/SKILL.md +2 -2
  7. package/template/.agents/skills/archify/SKILL.md +2 -19
  8. package/template/.agents/skills/archify/references/geometry-and-routing.md +20 -0
  9. package/template/.agents/skills/code-review/SKILL.md +3 -33
  10. package/template/.agents/skills/code-review/references/candidate-capture.md +33 -0
  11. package/template/.agents/skills/code-review/references/yss-review-standards.md +3 -5
  12. package/template/.agents/skills/codebase-design/SKILL.md +2 -2
  13. package/template/.agents/skills/competitive-intelligence/SKILL.md +1 -1
  14. package/template/.agents/skills/diagnosing-bugs/SKILL.md +6 -2
  15. package/template/.agents/skills/formily-foundation/SKILL.md +1 -1
  16. package/template/.agents/skills/formily-step-flow/SKILL.md +3 -2
  17. package/template/.agents/skills/frontend-commit/SKILL.md +6 -6
  18. package/template/.agents/skills/grilling/SKILL.md +2 -2
  19. package/template/.agents/skills/implement/SKILL.md +1 -1
  20. package/template/.agents/skills/implementation-repo-onboarding/SKILL.md +3 -3
  21. package/template/.agents/skills/implementation-repo-onboarding/references/write-scope.md +5 -0
  22. package/template/.agents/skills/improve-codebase-architecture/SKILL.md +10 -6
  23. package/template/.agents/skills/java-backend-commit/SKILL.md +5 -5
  24. package/template/.agents/skills/llm-wiki/SKILL.md +1 -1
  25. package/template/.agents/skills/prototype/SKILL.md +1 -1
  26. package/template/.agents/skills/prototype-review/SKILL.md +1 -1
  27. package/template/.agents/skills/resolving-merge-conflicts/SKILL.md +2 -2
  28. package/template/.agents/skills/tdd/SKILL.md +1 -1
  29. package/template/.agents/skills/to-questionnaire/SKILL.md +4 -2
  30. package/template/.agents/skills/to-spec/SKILL.md +3 -3
  31. package/template/.agents/skills/to-tickets/SKILL.md +7 -7
  32. package/template/.agents/skills/using-git-worktrees/SKILL.md +13 -11
  33. package/template/.agents/skills/wait-what/SKILL.md +1 -1
  34. package/template/.agents/skills/wayfinder/SKILL.md +4 -2
  35. package/template/.agents/skills/writing-for-agents/SKILL.md +9 -73
  36. package/template/.agents/skills/writing-for-agents/references/writing-principles.md +76 -0
  37. package/template/.agents/skills/yss-api-integration/SKILL.md +2 -2
  38. package/template/.agents/skills/yss-application/SKILL.md +12 -0
  39. package/template/.agents/skills/yss-audit-log/SKILL.md +3 -1
  40. package/template/.agents/skills/yss-audit-log/assets/AuditLogAspect.java +1 -0
  41. package/template/.agents/skills/yss-audit-log/assets/YssAuditLogPrintSubscriberImpl.java +1 -0
  42. package/template/.agents/skills/yss-audit-log/assets/YssAuditLogSysManagerSubscriberImpl.java +1 -0
  43. package/template/.agents/skills/yss-audit-log/assets/YssAuditPublishService.java +1 -0
  44. package/template/.agents/skills/yss-backend-spec-review/SKILL.md +6 -0
  45. package/template/.agents/skills/yss-backend-spec-review/references/check-inputs.md +2 -2
  46. package/template/.agents/skills/yss-backend-spec-review/references/standards-coverage.md +39 -0
  47. package/template/.agents/skills/yss-ddd-scaffold-generator/SKILL.md +5 -34
  48. package/template/.agents/skills/yss-ddd-scaffold-generator/references/command-examples.md +32 -0
  49. package/template/.agents/skills/yss-ddd-scaffold-generator/references/generator-maintenance.md +7 -0
  50. package/template/.agents/skills/yss-design-system/SKILL.md +2 -2
  51. package/template/.agents/skills/yss-domain/SKILL.md +17 -5
  52. package/template/.agents/skills/yss-domain/references/domain-layer-guide.md +2 -2
  53. package/template/.agents/skills/yss-domain/references/existing-project.md +5 -0
  54. package/template/.agents/skills/yss-dto/SKILL.md +13 -10
  55. package/template/.agents/skills/yss-dto/references/wire-validation-checklist.md +14 -0
  56. package/template/.agents/skills/yss-exception/SKILL.md +2 -2
  57. package/template/.agents/skills/yss-formily-schema-generator/SKILL.md +12 -12
  58. package/template/.agents/skills/yss-hook/SKILL.md +8 -44
  59. package/template/.agents/skills/yss-hook/references/use-request.md +42 -0
  60. package/template/.agents/skills/yss-implementation-contract-compiler/SKILL.md +3 -5
  61. package/template/.agents/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +7 -0
  62. package/template/.agents/skills/yss-implementation-contract-compiler/references/yss-skill-execution-result.md +5 -1
  63. package/template/.agents/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  64. package/template/.agents/skills/yss-mybatis/SKILL.md +10 -0
  65. package/template/.agents/skills/yss-openapi-draft-review/SKILL.md +3 -1
  66. package/template/.agents/skills/yss-openapi-governance/SKILL.md +5 -32
  67. package/template/.agents/skills/yss-openapi-governance/references/governance-output.md +34 -0
  68. package/template/.agents/skills/yss-product-lifecycle/SKILL.md +12 -6
  69. package/template/.agents/skills/yss-product-lifecycle/references/orchestration-contract.yaml +63 -1
  70. package/template/.agents/skills/yss-product-lifecycle/references/orchestration.md +2 -2
  71. package/template/.agents/skills/yss-prototype-stage/SKILL.md +3 -5
  72. package/template/.agents/skills/yss-prototype-stage/references/existing-ui-entry.md +7 -0
  73. package/template/.agents/skills/yss-prototype-stage/scripts/visual-baseline-contract.mjs +2 -2
  74. package/template/.agents/skills/yss-repository/SKILL.md +13 -1
  75. package/template/.agents/skills/yss-repository/references/profiles/existing-domain-driven-maven.md +7 -0
  76. package/template/.agents/skills/yss-repository/references/profiles/existing-layered-mvc-maven.md +7 -0
  77. package/template/.agents/skills/yss-repository/tests/profile-routing.test.mjs +3 -1
  78. package/template/.agents/skills/yss-stage-decision/SKILL.md +3 -1
  79. package/template/.agents/skills/yss-stage-decision/references/strategic-handoff-routing.md +3 -0
  80. package/template/.agents/skills/yss-tactical-design/SKILL.md +3 -3
  81. package/template/.agents/skills/yss-tactical-design/references/strategic-handoff-routing.md +5 -0
  82. package/template/.agents/skills/yss-technical-design/SKILL.md +2 -0
  83. package/template/.agents/skills/yss-technical-design/scripts/engineering-design.mjs +1 -1
  84. package/template/.agents/skills/yss-technical-design/scripts/validate-technical-design.mjs +11 -8
  85. package/template/.agents/skills/yss-ui-business-page-generation/SKILL.md +5 -3
  86. package/template/.agents/skills/yss-validation/SKILL.md +1 -1
  87. package/template/.agents/skills/yss-web-controller/SKILL.md +16 -7
  88. package/template/.agents/skills/ytable-usage/SKILL.md +2 -2
  89. package/template/.codex/skills/alibaba-java-code-style/SKILL.md +2 -2
  90. package/template/.codex/skills/archify/SKILL.md +2 -19
  91. package/template/.codex/skills/archify/references/geometry-and-routing.md +20 -0
  92. package/template/.codex/skills/code-review/SKILL.md +3 -33
  93. package/template/.codex/skills/code-review/references/candidate-capture.md +33 -0
  94. package/template/.codex/skills/code-review/references/yss-review-standards.md +3 -5
  95. package/template/.codex/skills/codebase-design/SKILL.md +2 -2
  96. package/template/.codex/skills/competitive-intelligence/SKILL.md +1 -1
  97. package/template/.codex/skills/data-analytics/mcp/server.cjs +2 -1
  98. package/template/.codex/skills/data-analytics/skills/analyze-data-quality/SKILL.md +9 -32
  99. package/template/.codex/skills/data-analytics/skills/analyze-data-quality/references/quality-checks.md +29 -0
  100. package/template/.codex/skills/data-analytics/skills/build-dashboard/SKILL.md +1 -1
  101. package/template/.codex/skills/data-analytics/skills/build-report/SKILL.md +4 -4
  102. package/template/.codex/skills/data-analytics/skills/build-report/report-to-google-doc/SKILL.md +12 -22
  103. package/template/.codex/skills/data-analytics/skills/build-report/report-to-google-doc/scripts/report_to_google_doc/cli.py +5 -10
  104. package/template/.codex/skills/data-analytics/skills/build-report/report-to-google-doc/scripts/report_to_google_doc/plan.py +47 -49
  105. package/template/.codex/skills/data-analytics/skills/build-report/report-to-google-doc/tests/test_delivery_plan.py +45 -0
  106. package/template/.codex/skills/data-analytics/skills/build-report/report-to-google-slides/SKILL.md +4 -5
  107. package/template/.codex/skills/data-analytics/skills/build-report/report-to-pdf/SKILL.md +1 -1
  108. package/template/.codex/skills/data-analytics/skills/build-report/specifications/mcp-app-report.md +1 -1
  109. package/template/.codex/skills/data-analytics/skills/design-kpis/SKILL.md +1 -1
  110. package/template/.codex/skills/data-analytics/skills/gather-business-context/SKILL.md +1 -1
  111. package/template/.codex/skills/data-analytics/skills/index/SKILL.md +4 -4
  112. package/template/.codex/skills/data-analytics/skills/jupyter-notebooks/SKILL.md +1 -1
  113. package/template/.codex/skills/data-analytics/skills/kpi-reporting/SKILL.md +2 -2
  114. package/template/.codex/skills/data-analytics/skills/market-sizing/SKILL.md +1 -1
  115. package/template/.codex/skills/data-analytics/skills/metric-diagnostics/SKILL.md +1 -1
  116. package/template/.codex/skills/data-analytics/skills/product-business-analysis/SKILL.md +1 -1
  117. package/template/.codex/skills/data-analytics/skills/spreadsheets/SKILL.md +4 -4
  118. package/template/.codex/skills/data-analytics/skills/user-context/SKILL.md +16 -14
  119. package/template/.codex/skills/data-analytics/skills/user-context/plugin-author-config/automation-config.md +1 -1
  120. package/template/.codex/skills/data-analytics/skills/user-context/references/onboarding-examples.md +1 -1
  121. package/template/.codex/skills/data-analytics/skills/user-context/references/onboarding.md +7 -7
  122. package/template/.codex/skills/data-analytics/skills/user-context/references/source-category-runtime.md +7 -7
  123. package/template/.codex/skills/data-analytics/skills/user-context/scripts/data_analytics_preflight.py +4 -2
  124. package/template/.codex/skills/data-analytics/skills/user-context/scripts/validate_user_context_preflight.py +5 -5
  125. package/template/.codex/skills/data-analytics/skills/user-context/tests/test_state_helpers.py +3 -3
  126. package/template/.codex/skills/data-analytics/skills/validate-data/SKILL.md +7 -71
  127. package/template/.codex/skills/data-analytics/skills/validate-data/references/validation-methods.md +70 -0
  128. package/template/.codex/skills/data-analytics/skills/visualize-data/SKILL.md +4 -4
  129. package/template/.codex/skills/data-analytics/src/analytics-app/App.tsx +1 -1
  130. package/template/.codex/skills/data-analytics/src/analytics-app-core.md +1 -1
  131. package/template/.codex/skills/diagnosing-bugs/SKILL.md +6 -2
  132. package/template/.codex/skills/formily-foundation/SKILL.md +1 -1
  133. package/template/.codex/skills/formily-step-flow/SKILL.md +3 -2
  134. package/template/.codex/skills/frontend-commit/SKILL.md +6 -6
  135. package/template/.codex/skills/grilling/SKILL.md +2 -2
  136. package/template/.codex/skills/implement/SKILL.md +1 -1
  137. package/template/.codex/skills/implementation-repo-onboarding/SKILL.md +3 -3
  138. package/template/.codex/skills/implementation-repo-onboarding/references/write-scope.md +5 -0
  139. package/template/.codex/skills/improve-codebase-architecture/SKILL.md +10 -6
  140. package/template/.codex/skills/java-backend-commit/SKILL.md +5 -5
  141. package/template/.codex/skills/llm-wiki/SKILL.md +1 -1
  142. package/template/.codex/skills/product-design/references/critical-overrides.md +3 -4
  143. package/template/.codex/skills/product-design/skills/audit/SKILL.md +1 -1
  144. package/template/.codex/skills/product-design/skills/design-qa/SKILL.md +1 -1
  145. package/template/.codex/skills/product-design/skills/get-context/SKILL.md +2 -1
  146. package/template/.codex/skills/product-design/skills/ideate/SKILL.md +2 -50
  147. package/template/.codex/skills/product-design/skills/ideate/references/image-prompt-patterns.md +51 -0
  148. package/template/.codex/skills/product-design/skills/image-to-code/SKILL.md +6 -6
  149. package/template/.codex/skills/product-design/skills/index/SKILL.md +2 -2
  150. package/template/.codex/skills/product-design/skills/prototype/SKILL.md +6 -6
  151. package/template/.codex/skills/product-design/skills/url-to-code/SKILL.md +1 -1
  152. package/template/.codex/skills/product-design/skills/user-context/SKILL.md +1 -1
  153. package/template/.codex/skills/prototype/SKILL.md +1 -1
  154. package/template/.codex/skills/prototype-review/SKILL.md +1 -1
  155. package/template/.codex/skills/resolving-merge-conflicts/SKILL.md +2 -2
  156. package/template/.codex/skills/tdd/SKILL.md +1 -1
  157. package/template/.codex/skills/to-questionnaire/SKILL.md +4 -2
  158. package/template/.codex/skills/to-spec/SKILL.md +3 -3
  159. package/template/.codex/skills/to-tickets/SKILL.md +7 -7
  160. package/template/.codex/skills/using-git-worktrees/SKILL.md +13 -11
  161. package/template/.codex/skills/wait-what/SKILL.md +1 -1
  162. package/template/.codex/skills/wayfinder/SKILL.md +4 -2
  163. package/template/.codex/skills/writing-for-agents/SKILL.md +9 -73
  164. package/template/.codex/skills/writing-for-agents/references/writing-principles.md +76 -0
  165. package/template/.codex/skills/yss-api-integration/SKILL.md +2 -2
  166. package/template/.codex/skills/yss-application/SKILL.md +12 -0
  167. package/template/.codex/skills/yss-audit-log/SKILL.md +3 -1
  168. package/template/.codex/skills/yss-audit-log/assets/AuditLogAspect.java +1 -0
  169. package/template/.codex/skills/yss-audit-log/assets/YssAuditLogPrintSubscriberImpl.java +1 -0
  170. package/template/.codex/skills/yss-audit-log/assets/YssAuditLogSysManagerSubscriberImpl.java +1 -0
  171. package/template/.codex/skills/yss-audit-log/assets/YssAuditPublishService.java +1 -0
  172. package/template/.codex/skills/yss-backend-spec-review/SKILL.md +6 -0
  173. package/template/.codex/skills/yss-backend-spec-review/references/check-inputs.md +2 -2
  174. package/template/.codex/skills/yss-backend-spec-review/references/standards-coverage.md +39 -0
  175. package/template/.codex/skills/yss-ddd-scaffold-generator/SKILL.md +5 -34
  176. package/template/.codex/skills/yss-ddd-scaffold-generator/references/command-examples.md +32 -0
  177. package/template/.codex/skills/yss-ddd-scaffold-generator/references/generator-maintenance.md +7 -0
  178. package/template/.codex/skills/yss-design-system/SKILL.md +2 -2
  179. package/template/.codex/skills/yss-domain/SKILL.md +17 -5
  180. package/template/.codex/skills/yss-domain/references/domain-layer-guide.md +2 -2
  181. package/template/.codex/skills/yss-domain/references/existing-project.md +5 -0
  182. package/template/.codex/skills/yss-dto/SKILL.md +13 -10
  183. package/template/.codex/skills/yss-dto/references/wire-validation-checklist.md +14 -0
  184. package/template/.codex/skills/yss-exception/SKILL.md +2 -2
  185. package/template/.codex/skills/yss-formily-schema-generator/SKILL.md +12 -12
  186. package/template/.codex/skills/yss-hook/SKILL.md +8 -44
  187. package/template/.codex/skills/yss-hook/references/use-request.md +42 -0
  188. package/template/.codex/skills/yss-implementation-contract-compiler/SKILL.md +3 -5
  189. package/template/.codex/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +7 -0
  190. package/template/.codex/skills/yss-implementation-contract-compiler/references/yss-skill-execution-result.md +5 -1
  191. package/template/.codex/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  192. package/template/.codex/skills/yss-mybatis/SKILL.md +10 -0
  193. package/template/.codex/skills/yss-openapi-draft-review/SKILL.md +3 -1
  194. package/template/.codex/skills/yss-openapi-governance/SKILL.md +5 -32
  195. package/template/.codex/skills/yss-openapi-governance/references/governance-output.md +34 -0
  196. package/template/.codex/skills/yss-product-lifecycle/SKILL.md +12 -6
  197. package/template/.codex/skills/yss-product-lifecycle/references/orchestration-contract.yaml +63 -1
  198. package/template/.codex/skills/yss-product-lifecycle/references/orchestration.md +2 -2
  199. package/template/.codex/skills/yss-prototype-stage/SKILL.md +3 -5
  200. package/template/.codex/skills/yss-prototype-stage/references/existing-ui-entry.md +7 -0
  201. package/template/.codex/skills/yss-prototype-stage/scripts/visual-baseline-contract.mjs +2 -2
  202. package/template/.codex/skills/yss-repository/SKILL.md +13 -1
  203. package/template/.codex/skills/yss-repository/references/profiles/existing-domain-driven-maven.md +7 -0
  204. package/template/.codex/skills/yss-repository/references/profiles/existing-layered-mvc-maven.md +7 -0
  205. package/template/.codex/skills/yss-repository/tests/profile-routing.test.mjs +3 -1
  206. package/template/.codex/skills/yss-stage-decision/SKILL.md +3 -1
  207. package/template/.codex/skills/yss-stage-decision/references/strategic-handoff-routing.md +3 -0
  208. package/template/.codex/skills/yss-tactical-design/SKILL.md +3 -3
  209. package/template/.codex/skills/yss-tactical-design/references/strategic-handoff-routing.md +5 -0
  210. package/template/.codex/skills/yss-technical-design/SKILL.md +2 -0
  211. package/template/.codex/skills/yss-technical-design/scripts/engineering-design.mjs +1 -1
  212. package/template/.codex/skills/yss-technical-design/scripts/validate-technical-design.mjs +11 -8
  213. package/template/.codex/skills/yss-ui-business-page-generation/SKILL.md +5 -3
  214. package/template/.codex/skills/yss-validation/SKILL.md +1 -1
  215. package/template/.codex/skills/yss-web-controller/SKILL.md +16 -7
  216. package/template/.codex/skills/ytable-usage/SKILL.md +2 -2
  217. package/template/.cursor/skills/alibaba-java-code-style/SKILL.md +2 -2
  218. package/template/.cursor/skills/archify/SKILL.md +2 -19
  219. package/template/.cursor/skills/archify/references/geometry-and-routing.md +20 -0
  220. package/template/.cursor/skills/code-review/SKILL.md +3 -33
  221. package/template/.cursor/skills/code-review/references/candidate-capture.md +33 -0
  222. package/template/.cursor/skills/code-review/references/yss-review-standards.md +3 -5
  223. package/template/.cursor/skills/codebase-design/SKILL.md +2 -2
  224. package/template/.cursor/skills/competitive-intelligence/SKILL.md +1 -1
  225. package/template/.cursor/skills/diagnosing-bugs/SKILL.md +6 -2
  226. package/template/.cursor/skills/formily-foundation/SKILL.md +1 -1
  227. package/template/.cursor/skills/formily-step-flow/SKILL.md +3 -2
  228. package/template/.cursor/skills/frontend-commit/SKILL.md +6 -6
  229. package/template/.cursor/skills/grilling/SKILL.md +2 -2
  230. package/template/.cursor/skills/implement/SKILL.md +1 -1
  231. package/template/.cursor/skills/implementation-repo-onboarding/SKILL.md +3 -3
  232. package/template/.cursor/skills/implementation-repo-onboarding/references/write-scope.md +5 -0
  233. package/template/.cursor/skills/improve-codebase-architecture/SKILL.md +10 -6
  234. package/template/.cursor/skills/java-backend-commit/SKILL.md +5 -5
  235. package/template/.cursor/skills/llm-wiki/SKILL.md +1 -1
  236. package/template/.cursor/skills/prototype/SKILL.md +1 -1
  237. package/template/.cursor/skills/prototype-review/SKILL.md +1 -1
  238. package/template/.cursor/skills/resolving-merge-conflicts/SKILL.md +2 -2
  239. package/template/.cursor/skills/tdd/SKILL.md +1 -1
  240. package/template/.cursor/skills/to-questionnaire/SKILL.md +4 -2
  241. package/template/.cursor/skills/to-spec/SKILL.md +3 -3
  242. package/template/.cursor/skills/to-tickets/SKILL.md +7 -7
  243. package/template/.cursor/skills/using-git-worktrees/SKILL.md +13 -11
  244. package/template/.cursor/skills/wait-what/SKILL.md +1 -1
  245. package/template/.cursor/skills/wayfinder/SKILL.md +4 -2
  246. package/template/.cursor/skills/writing-for-agents/SKILL.md +9 -73
  247. package/template/.cursor/skills/writing-for-agents/references/writing-principles.md +76 -0
  248. package/template/.cursor/skills/yss-api-integration/SKILL.md +2 -2
  249. package/template/.cursor/skills/yss-application/SKILL.md +12 -0
  250. package/template/.cursor/skills/yss-audit-log/SKILL.md +3 -1
  251. package/template/.cursor/skills/yss-audit-log/assets/AuditLogAspect.java +1 -0
  252. package/template/.cursor/skills/yss-audit-log/assets/YssAuditLogPrintSubscriberImpl.java +1 -0
  253. package/template/.cursor/skills/yss-audit-log/assets/YssAuditLogSysManagerSubscriberImpl.java +1 -0
  254. package/template/.cursor/skills/yss-audit-log/assets/YssAuditPublishService.java +1 -0
  255. package/template/.cursor/skills/yss-backend-spec-review/SKILL.md +6 -0
  256. package/template/.cursor/skills/yss-backend-spec-review/references/check-inputs.md +2 -2
  257. package/template/.cursor/skills/yss-backend-spec-review/references/standards-coverage.md +39 -0
  258. package/template/.cursor/skills/yss-ddd-scaffold-generator/SKILL.md +5 -34
  259. package/template/.cursor/skills/yss-ddd-scaffold-generator/references/command-examples.md +32 -0
  260. package/template/.cursor/skills/yss-ddd-scaffold-generator/references/generator-maintenance.md +7 -0
  261. package/template/.cursor/skills/yss-design-system/SKILL.md +2 -2
  262. package/template/.cursor/skills/yss-domain/SKILL.md +17 -5
  263. package/template/.cursor/skills/yss-domain/references/domain-layer-guide.md +2 -2
  264. package/template/.cursor/skills/yss-domain/references/existing-project.md +5 -0
  265. package/template/.cursor/skills/yss-dto/SKILL.md +13 -10
  266. package/template/.cursor/skills/yss-dto/references/wire-validation-checklist.md +14 -0
  267. package/template/.cursor/skills/yss-exception/SKILL.md +2 -2
  268. package/template/.cursor/skills/yss-formily-schema-generator/SKILL.md +12 -12
  269. package/template/.cursor/skills/yss-hook/SKILL.md +8 -44
  270. package/template/.cursor/skills/yss-hook/references/use-request.md +42 -0
  271. package/template/.cursor/skills/yss-implementation-contract-compiler/SKILL.md +3 -5
  272. package/template/.cursor/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +7 -0
  273. package/template/.cursor/skills/yss-implementation-contract-compiler/references/yss-skill-execution-result.md +5 -1
  274. package/template/.cursor/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  275. package/template/.cursor/skills/yss-mybatis/SKILL.md +10 -0
  276. package/template/.cursor/skills/yss-openapi-draft-review/SKILL.md +3 -1
  277. package/template/.cursor/skills/yss-openapi-governance/SKILL.md +5 -32
  278. package/template/.cursor/skills/yss-openapi-governance/references/governance-output.md +34 -0
  279. package/template/.cursor/skills/yss-product-lifecycle/SKILL.md +12 -6
  280. package/template/.cursor/skills/yss-product-lifecycle/references/orchestration-contract.yaml +63 -1
  281. package/template/.cursor/skills/yss-product-lifecycle/references/orchestration.md +2 -2
  282. package/template/.cursor/skills/yss-prototype-stage/SKILL.md +3 -5
  283. package/template/.cursor/skills/yss-prototype-stage/references/existing-ui-entry.md +7 -0
  284. package/template/.cursor/skills/yss-prototype-stage/scripts/visual-baseline-contract.mjs +2 -2
  285. package/template/.cursor/skills/yss-repository/SKILL.md +13 -1
  286. package/template/.cursor/skills/yss-repository/references/profiles/existing-domain-driven-maven.md +7 -0
  287. package/template/.cursor/skills/yss-repository/references/profiles/existing-layered-mvc-maven.md +7 -0
  288. package/template/.cursor/skills/yss-repository/tests/profile-routing.test.mjs +3 -1
  289. package/template/.cursor/skills/yss-stage-decision/SKILL.md +3 -1
  290. package/template/.cursor/skills/yss-stage-decision/references/strategic-handoff-routing.md +3 -0
  291. package/template/.cursor/skills/yss-tactical-design/SKILL.md +3 -3
  292. package/template/.cursor/skills/yss-tactical-design/references/strategic-handoff-routing.md +5 -0
  293. package/template/.cursor/skills/yss-technical-design/SKILL.md +2 -0
  294. package/template/.cursor/skills/yss-technical-design/scripts/engineering-design.mjs +1 -1
  295. package/template/.cursor/skills/yss-technical-design/scripts/validate-technical-design.mjs +11 -8
  296. package/template/.cursor/skills/yss-ui-business-page-generation/SKILL.md +5 -3
  297. package/template/.cursor/skills/yss-validation/SKILL.md +1 -1
  298. package/template/.cursor/skills/yss-web-controller/SKILL.md +16 -7
  299. package/template/.cursor/skills/ytable-usage/SKILL.md +2 -2
  300. package/template/.pi/skills/alibaba-java-code-style/SKILL.md +2 -2
  301. package/template/.pi/skills/archify/SKILL.md +2 -19
  302. package/template/.pi/skills/archify/references/geometry-and-routing.md +20 -0
  303. package/template/.pi/skills/code-review/SKILL.md +3 -33
  304. package/template/.pi/skills/code-review/references/candidate-capture.md +33 -0
  305. package/template/.pi/skills/code-review/references/yss-review-standards.md +3 -5
  306. package/template/.pi/skills/codebase-design/SKILL.md +2 -2
  307. package/template/.pi/skills/competitive-intelligence/SKILL.md +1 -1
  308. package/template/.pi/skills/diagnosing-bugs/SKILL.md +6 -2
  309. package/template/.pi/skills/formily-foundation/SKILL.md +1 -1
  310. package/template/.pi/skills/formily-step-flow/SKILL.md +3 -2
  311. package/template/.pi/skills/frontend-commit/SKILL.md +6 -6
  312. package/template/.pi/skills/grilling/SKILL.md +2 -2
  313. package/template/.pi/skills/implement/SKILL.md +1 -1
  314. package/template/.pi/skills/implementation-repo-onboarding/SKILL.md +3 -3
  315. package/template/.pi/skills/implementation-repo-onboarding/references/write-scope.md +5 -0
  316. package/template/.pi/skills/improve-codebase-architecture/SKILL.md +10 -6
  317. package/template/.pi/skills/java-backend-commit/SKILL.md +5 -5
  318. package/template/.pi/skills/llm-wiki/SKILL.md +1 -1
  319. package/template/.pi/skills/prototype/SKILL.md +1 -1
  320. package/template/.pi/skills/prototype-review/SKILL.md +1 -1
  321. package/template/.pi/skills/resolving-merge-conflicts/SKILL.md +2 -2
  322. package/template/.pi/skills/tdd/SKILL.md +1 -1
  323. package/template/.pi/skills/to-questionnaire/SKILL.md +4 -2
  324. package/template/.pi/skills/to-spec/SKILL.md +3 -3
  325. package/template/.pi/skills/to-tickets/SKILL.md +7 -7
  326. package/template/.pi/skills/using-git-worktrees/SKILL.md +13 -11
  327. package/template/.pi/skills/wait-what/SKILL.md +1 -1
  328. package/template/.pi/skills/wayfinder/SKILL.md +4 -2
  329. package/template/.pi/skills/writing-for-agents/SKILL.md +9 -73
  330. package/template/.pi/skills/writing-for-agents/references/writing-principles.md +76 -0
  331. package/template/.pi/skills/yss-api-integration/SKILL.md +2 -2
  332. package/template/.pi/skills/yss-application/SKILL.md +12 -0
  333. package/template/.pi/skills/yss-audit-log/SKILL.md +3 -1
  334. package/template/.pi/skills/yss-audit-log/assets/AuditLogAspect.java +1 -0
  335. package/template/.pi/skills/yss-audit-log/assets/YssAuditLogPrintSubscriberImpl.java +1 -0
  336. package/template/.pi/skills/yss-audit-log/assets/YssAuditLogSysManagerSubscriberImpl.java +1 -0
  337. package/template/.pi/skills/yss-audit-log/assets/YssAuditPublishService.java +1 -0
  338. package/template/.pi/skills/yss-backend-spec-review/SKILL.md +6 -0
  339. package/template/.pi/skills/yss-backend-spec-review/references/check-inputs.md +2 -2
  340. package/template/.pi/skills/yss-backend-spec-review/references/standards-coverage.md +39 -0
  341. package/template/.pi/skills/yss-ddd-scaffold-generator/SKILL.md +5 -34
  342. package/template/.pi/skills/yss-ddd-scaffold-generator/references/command-examples.md +32 -0
  343. package/template/.pi/skills/yss-ddd-scaffold-generator/references/generator-maintenance.md +7 -0
  344. package/template/.pi/skills/yss-design-system/SKILL.md +2 -2
  345. package/template/.pi/skills/yss-domain/SKILL.md +17 -5
  346. package/template/.pi/skills/yss-domain/references/domain-layer-guide.md +2 -2
  347. package/template/.pi/skills/yss-domain/references/existing-project.md +5 -0
  348. package/template/.pi/skills/yss-dto/SKILL.md +13 -10
  349. package/template/.pi/skills/yss-dto/references/wire-validation-checklist.md +14 -0
  350. package/template/.pi/skills/yss-exception/SKILL.md +2 -2
  351. package/template/.pi/skills/yss-formily-schema-generator/SKILL.md +12 -12
  352. package/template/.pi/skills/yss-hook/SKILL.md +8 -44
  353. package/template/.pi/skills/yss-hook/references/use-request.md +42 -0
  354. package/template/.pi/skills/yss-implementation-contract-compiler/SKILL.md +3 -5
  355. package/template/.pi/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +7 -0
  356. package/template/.pi/skills/yss-implementation-contract-compiler/references/yss-skill-execution-result.md +5 -1
  357. package/template/.pi/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  358. package/template/.pi/skills/yss-mybatis/SKILL.md +10 -0
  359. package/template/.pi/skills/yss-openapi-draft-review/SKILL.md +3 -1
  360. package/template/.pi/skills/yss-openapi-governance/SKILL.md +5 -32
  361. package/template/.pi/skills/yss-openapi-governance/references/governance-output.md +34 -0
  362. package/template/.pi/skills/yss-product-lifecycle/SKILL.md +12 -6
  363. package/template/.pi/skills/yss-product-lifecycle/references/orchestration-contract.yaml +63 -1
  364. package/template/.pi/skills/yss-product-lifecycle/references/orchestration.md +2 -2
  365. package/template/.pi/skills/yss-prototype-stage/SKILL.md +3 -5
  366. package/template/.pi/skills/yss-prototype-stage/references/existing-ui-entry.md +7 -0
  367. package/template/.pi/skills/yss-prototype-stage/scripts/visual-baseline-contract.mjs +2 -2
  368. package/template/.pi/skills/yss-repository/SKILL.md +13 -1
  369. package/template/.pi/skills/yss-repository/references/profiles/existing-domain-driven-maven.md +7 -0
  370. package/template/.pi/skills/yss-repository/references/profiles/existing-layered-mvc-maven.md +7 -0
  371. package/template/.pi/skills/yss-repository/tests/profile-routing.test.mjs +3 -1
  372. package/template/.pi/skills/yss-stage-decision/SKILL.md +3 -1
  373. package/template/.pi/skills/yss-stage-decision/references/strategic-handoff-routing.md +3 -0
  374. package/template/.pi/skills/yss-tactical-design/SKILL.md +3 -3
  375. package/template/.pi/skills/yss-tactical-design/references/strategic-handoff-routing.md +5 -0
  376. package/template/.pi/skills/yss-technical-design/SKILL.md +2 -0
  377. package/template/.pi/skills/yss-technical-design/scripts/engineering-design.mjs +1 -1
  378. package/template/.pi/skills/yss-technical-design/scripts/validate-technical-design.mjs +11 -8
  379. package/template/.pi/skills/yss-ui-business-page-generation/SKILL.md +5 -3
  380. package/template/.pi/skills/yss-validation/SKILL.md +1 -1
  381. package/template/.pi/skills/yss-web-controller/SKILL.md +16 -7
  382. package/template/.pi/skills/ytable-usage/SKILL.md +2 -2
  383. package/template/AGENTS.md +2 -0
  384. package/template/CONTEXT.md +2 -1
  385. package/template/README.md +1 -0
  386. package/template/docs/agents/issue-tracker.md +7 -0
  387. package/template/docs/process/contract-reading.md +46 -0
  388. package/template/docs/process/lifecycle-artifact-map.md +2 -2
  389. package/template/docs/process/lifecycle-registry-baseline.json +2 -1
  390. package/template/docs/process/lifecycle-registry.yaml +10 -4
  391. package/template/docs/process/schemas/api-contract-decision-v2.schema.json +198 -0
  392. package/template/docs/process/schemas/digital-human-task-package.schema.json +68 -4
  393. package/template/docs/process/schemas/lifecycle-checkpoint.schema.json +259 -0
  394. package/template/docs/process/schemas/stage-tracking.schema.json +259 -0
  395. package/template/docs/process/stage-tracking.md +62 -0
  396. package/template/docs/process/strategic-handoff-package.md +8 -0
  397. package/template/docs/user-guide//347/224/250/346/210/267/346/211/213/345/206/214.md +2 -0
  398. package/template/docs/user-guide//347/224/250/346/210/267/346/211/213/345/206/214/347/264/242/345/274/225.md +1 -0
  399. package/template/docs/user-guide//351/230/266/346/256/265/346/216/245/345/205/245/344/270/216/344/272/247/347/211/251/345/244/215/347/224/250/344/275/277/347/224/250/346/211/213/345/206/214.md +243 -0
  400. package/template/scripts/api-contract-decision +16 -0
  401. package/template/scripts/backend-standards-coverage +26 -0
  402. package/template/scripts/complete-backend-delivery +17 -0
  403. package/template/scripts/contract +13 -0
  404. package/template/scripts/dispatch-slice-task +13 -0
  405. package/template/scripts/lib/api-contract-decision.mjs +45 -4
  406. package/template/scripts/lib/approval-record.mjs +1 -1
  407. package/template/scripts/lib/approved-execution-context.mjs +35 -7
  408. package/template/scripts/lib/backend-architecture.mjs +2 -2
  409. package/template/scripts/lib/backend-delivery-terminal.mjs +51 -0
  410. package/template/scripts/lib/backend-platform-provenance.mjs +1 -1
  411. package/template/scripts/lib/backend-platform.mjs +1 -1
  412. package/template/scripts/lib/backend-review.mjs +58 -20
  413. package/template/scripts/lib/backend-scaffold-prerequisites.mjs +1 -1
  414. package/template/scripts/lib/backend-standards-coverage.mjs +237 -0
  415. package/template/scripts/lib/context-contract.mjs +1 -1
  416. package/template/scripts/lib/context-reconciliation.mjs +1 -1
  417. package/template/scripts/lib/contract-source.mjs +22 -0
  418. package/template/scripts/lib/contract-views.mjs +109 -0
  419. package/template/scripts/lib/delivery-preflight.mjs +3 -2
  420. package/template/scripts/lib/digital-human-roles.mjs +1 -1
  421. package/template/scripts/lib/existing-backend-architecture.mjs +4 -3
  422. package/template/scripts/lib/existing-ui-baseline.mjs +4 -2
  423. package/template/scripts/lib/first-slice-artifacts.mjs +1 -1
  424. package/template/scripts/lib/frontend-delivery-boundary.mjs +1 -1
  425. package/template/scripts/lib/frontend-delivery.mjs +1 -1
  426. package/template/scripts/lib/harness-execution-scope.mjs +15 -1
  427. package/template/scripts/lib/implementation-contract-compiler.mjs +4 -4
  428. package/template/scripts/lib/json-schema.mjs +19 -4
  429. package/template/scripts/lib/lifecycle-context-query.mjs +5 -1
  430. package/template/scripts/lib/lifecycle-controls.mjs +1 -1
  431. package/template/scripts/lib/lifecycle-execution-scope.mjs +92 -0
  432. package/template/scripts/lib/lifecycle-registry.mjs +2 -1
  433. package/template/scripts/lib/lifecycle-transition.mjs +25 -4
  434. package/template/scripts/lib/openapi-draft-validation.mjs +2 -1
  435. package/template/scripts/lib/profile-skill-sync.mjs +46 -5
  436. package/template/scripts/lib/skill-registry.mjs +1 -1
  437. package/template/scripts/lib/slice-contract-preparation.mjs +16 -14
  438. package/template/scripts/lib/slice-contract-views.mjs +1 -1
  439. package/template/scripts/lib/slice-contract.mjs +18 -3
  440. package/template/scripts/lib/slice-execution-preflight.mjs +7 -3
  441. package/template/scripts/lib/slice-repositories.mjs +1 -1
  442. package/template/scripts/lib/slice-task-package.mjs +3 -2
  443. package/template/scripts/lib/stage-tracking-migration.mjs +176 -0
  444. package/template/scripts/lib/stage-tracking.mjs +184 -0
  445. package/template/scripts/lib/strategic-handoff-consumption.mjs +5 -4
  446. package/template/scripts/lib/strategic-handoff-io.mjs +5 -2
  447. package/template/scripts/lib/strategic-handoff-routing.mjs +31 -0
  448. package/template/scripts/lib/strategic-handoff.mjs +4 -2
  449. package/template/scripts/lib/task-package.mjs +2 -0
  450. package/template/scripts/lib/technical-design-boundary.mjs +4 -2
  451. package/template/scripts/lib/ui-baseline.mjs +1 -1
  452. package/template/scripts/lib/user-decision.mjs +1 -1
  453. package/template/scripts/lib/validation-phase.mjs +72 -0
  454. package/template/scripts/stage-tracking +25 -0
  455. package/template/scripts/strategic-consumer-entry +47 -0
  456. package/template/scripts/verify-context-reconciliation +4 -3
  457. package/template/scripts/verify-lifecycle-checkpoint +10 -0
  458. package/template/skills-lock.json +65 -63
  459. package/template.snapshot.json +4 -4
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import path from 'node:path';
3
+ import { parseArgs } from 'node:util';
4
+ import { readFileSync } from 'node:fs';
5
+ import { parse } from './lib/strategic-handoff-io.mjs';
6
+ import { completeBackendDelivery, verifyBackendDeliveryTerminal } from './lib/backend-delivery-terminal.mjs';
7
+
8
+ try {
9
+ const { values, positionals } = parseArgs({ allowPositionals: true, options: { root: { type: 'string' }, input: { type: 'string' } } });
10
+ if (positionals.length !== 1 || !values.root) throw new TypeError('用法: complete-backend-delivery complete --root <governance> --input <plan.json> | verify --root <governance>');
11
+ const root = path.resolve(values.root);
12
+ let result;
13
+ if (positionals[0] === 'verify' && !values.input) result = await verifyBackendDeliveryTerminal(root);
14
+ else if (positionals[0] === 'complete' && values.input) result = await completeBackendDelivery(root, parse(readFileSync(values.input)));
15
+ else throw new TypeError('需要 complete 或 verify 及匹配参数');
16
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
17
+ } catch (error) { process.stderr.write(`${JSON.stringify({ result: 'blocked', error: error.message })}\n`); process.exitCode = 1; }
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import path from 'node:path';
3
+ import {viewContract,diffContract} from './lib/contract-views.mjs';
4
+ try{
5
+ const args=process.argv.slice(2),mode=args.shift(),options={},positional=[];
6
+ for(let i=0;i<args.length;i++){const arg=args[i];if(arg==='--json')options.json=true;else if(arg.startsWith('--')){const key=arg.slice(2);if(!['kind','profile','unit','root','before-root'].includes(key)||!args[i+1]||args[i+1].startsWith('--'))throw Error(`未知或缺值参数 ${arg}`);options[key]=args[++i];}else positional.push(arg);}
7
+ const config={kind:options.kind,root:path.resolve(options.root||process.cwd()),profile:options.profile||'review',unit_id:options.unit,beforeRoot:options['before-root']?path.resolve(options['before-root']):undefined};
8
+ if(!options.kind)throw Error('必须用 --kind 明确资产类型');
9
+ if(!['view','diff'].includes(mode)||positional.length!==(mode==='view'?1:2))throw Error('用法: contract view <资产> --kind <类型> [--profile review|task|full] [--unit <ID>] [--json] | diff <旧资产> <新资产> --kind <类型>');
10
+ const result=mode==='view'?viewContract(positional[0],config):diffContract(positional[0],positional[1],config);
11
+ process.stdout.write(options.json||!result.markdown?JSON.stringify(result,null,2)+'\n':result.markdown);
12
+ if(result.blockers?.length)process.exitCode=1;
13
+ }catch(error){process.stderr.write(error.message+'\n');process.exitCode=1;}
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import { parseArgs } from 'node:util';
3
+ import { readFileSync } from 'node:fs';
4
+ import path from 'node:path';
5
+ import { parseSliceYaml } from './lib/slice-contract.mjs';
6
+ import { compileSliceTaskPackage } from './lib/slice-task-package.mjs';
7
+ try {
8
+ const { values } = parseArgs({ options: { root: { type: 'string' }, input: { type: 'string' } } });
9
+ if (!values.root || !values.input) throw new TypeError('用法: dispatch-slice-task --root <project> --input <task-input.yaml>');
10
+ const input = parseSliceYaml(readFileSync(values.input));
11
+ const result = compileSliceTaskPackage(input.binding, { ...input, root: path.resolve(values.root) });
12
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
13
+ } catch (error) { process.stderr.write(`${error.message}\n`); process.exitCode = 1; }
@@ -1,4 +1,6 @@
1
- import { readFileSync } from "node:fs";
1
+ import {readContractSource} from './contract-source.mjs';
2
+ import { readFileSync, withValidationPhase } from "./validation-phase.mjs";
3
+ import { parseSliceYaml } from "./slice-contract.mjs";
2
4
  import path from "node:path";
3
5
  import { fileURLToPath } from "node:url";
4
6
  import { parseDocument } from "../vendor/yaml.mjs";
@@ -15,15 +17,18 @@ const readBound = (root, ref, label) => {
15
17
  };
16
18
  const requireDigest = (asset, expected) => { if (asset.digest !== expected) fail(`${asset.label}摘要漂移`); };
17
19
 
18
- export function validateApiContractDecision(binding, { root = TEMPLATE_ROOT } = {}) {
20
+ export function validateApiContractDecision(binding, options = {}) {return withValidationPhase({root:options.root||TEMPLATE_ROOT,purpose:'api-decision',slice_id:binding?.ref,readOnly:true},()=>validate(binding,options));}
21
+ function validate(binding, { root = TEMPLATE_ROOT } = {}) {
19
22
  if (!binding || !binding.ref || !binding.version || !binding.digest || !["required", "not-applicable"].includes(binding.impact)) fail("缺少 API Contract Decision 当前版本绑定");
20
23
  const projectRoot = path.resolve(root);
21
24
  const decisionAsset = readBound(projectRoot, binding.ref, "API Contract Decision");
22
25
  requireDigest(decisionAsset, binding.digest);
23
26
  const document = parseDocument(decisionAsset.bytes.toString("utf8"), { uniqueKeys: true, maxAliasCount: 0 });
24
27
  if (document.errors.length) fail(`API Contract Decision 无法解析: ${document.errors[0].message}`);
25
- const decision = document.toJS({ maxAliasCount: 0 });
26
- validateJsonSchema(decision, SCHEMA, { cwd: TEMPLATE_ROOT, label: "API Contract Decision v1" });
28
+ const original = parseSliceYaml(decisionAsset.bytes);
29
+ validateJsonSchema(original, original.schema_version===2?SCHEMA.replace(".schema", "-v2.schema"):SCHEMA, { cwd: TEMPLATE_ROOT, label: "API Contract Decision" });
30
+ if(original.status!=="approved")fail("API Contract Decision 必须经生命周期批准为 approved");
31
+ const decision={...structuredClone(original),current_version:true}; // Derived only after schema and current raw binding checks; never persisted.
27
32
  if (decision.decision_version !== binding.version || decision.impact !== binding.impact) fail("API Contract Decision 版本或影响结论与合同不一致");
28
33
  requireDigest(readBound(projectRoot, decision.assessment_ref, "API 影响评估"), decision.assessment_digest);
29
34
  for (const ref of decision.evidence_refs) readBound(projectRoot, ref, "API Decision 证据");
@@ -40,6 +45,12 @@ export function validateApiContractDecision(binding, { root = TEMPLATE_ROOT } =
40
45
  const reviewRecord = reviewDocument.toJS({ maxAliasCount: 0 });
41
46
  if (reviewRecord?.result !== "approved" || !Array.isArray(reviewRecord.blocking_findings) || reviewRecord.blocking_findings.length > 0) fail("OpenAPI Draft Review 实际记录未批准或仍有阻断项");
42
47
  if (reviewRecord.draft_ref !== decision.openapi.ref || reviewRecord.draft_digest !== decision.openapi.digest) fail("OpenAPI Draft Review 实际记录未绑定当前权威 YAML");
48
+ if (!Array.isArray(reviewRecord.evidence_refs) || !reviewRecord.evidence_refs.length) fail("OpenAPI Draft Review 缺少实际证据");
49
+ for (const ref of reviewRecord.evidence_refs) readBound(projectRoot, ref, "OpenAPI Draft Review 实际证据");
50
+ if(original.schema_version===2){
51
+ decision.draft_review={...decision.draft_review,result:reviewRecord.result,blocking_findings:reviewRecord.blocking_findings,draft_ref:reviewRecord.draft_ref,draft_digest:reviewRecord.draft_digest,evidence_refs:reviewRecord.evidence_refs};
52
+ decision.freeze={...decision.freeze,draft_ref:decision.openapi.ref,draft_digest:decision.openapi.digest};
53
+ }
43
54
  for (const ref of decision.draft_review.evidence_refs) readBound(projectRoot, ref, "OpenAPI Draft Review 证据");
44
55
  const validated = validateOpenApiDraftValidationRecord(validation.file, { root: projectRoot });
45
56
  if (validated.record.draft.ref !== decision.openapi.ref || validated.draftDigest !== decision.openapi.digest) fail("OpenAPI Validation 未绑定当前权威 YAML");
@@ -47,3 +58,33 @@ export function validateApiContractDecision(binding, { root = TEMPLATE_ROOT } =
47
58
  if (decision.freeze.version !== decision.openapi.version || decision.freeze.draft_ref !== decision.openapi.ref || decision.freeze.draft_digest !== decision.openapi.digest) fail("OpenAPI Freeze 未绑定当前权威 YAML 版本和摘要");
48
59
  return { decision, openapi: decision.openapi, binding: { ref: binding.ref, version: binding.version, digest: binding.digest, impact: decision.impact } };
49
60
  }
61
+
62
+ /** Source selectors contain business choices; digests are always derived from original bytes. */
63
+ export function prepareApiContractDecision(input,{root=TEMPLATE_ROOT}={}) {
64
+ return withValidationPhase({root,purpose:'api-prepare',slice_id:input.decision_id,readOnly:true},()=>{
65
+ if(input.schema_version!==undefined&&input.schema_version!==2)fail('旧 schema 必须通过显式 migrate 迁移');
66
+ if(input.kind!==undefined&&input.kind!=='api-contract-decision')fail('来源 kind 与 API 决定冲突');
67
+ const allowed=new Set(['schema_version','kind','decision_id','decision_version','status','impact','assessment_ref','assessment_digest','evidence_refs','reason','openapi','validation_record','draft_review','freeze']);
68
+ for(const key of Object.keys(input))if(!allowed.has(key))fail(`未分类约束需人工处理: ${key}`);
69
+ if(input.status&&input.status!=='draft')fail('准备器不能创建批准身份或更新已批准合同');
70
+ const result=structuredClone(input);Object.assign(result,{schema_version:2,kind:'api-contract-decision',status:'draft'});
71
+ const conflicts=[];
72
+ const bind=(value,label)=>{try{return {...value,...readContractSource(value,{root}).binding};}catch(error){conflicts.push({field:label,source_ref:value.ref,reason:error.message,conflicts:error.conflicts||[],recovery:'核对双方来源并补齐当前文件后重新准备'});return value;}};
73
+ result.assessment_digest=bind({ref:input.assessment_ref,...(input.assessment_digest?{digest:input.assessment_digest}:{})},'API 影响评估').digest;
74
+ for(const key of ['openapi','validation_record','draft_review'])if(result[key])result[key]=bind(result[key],key);
75
+ for(const ref of result.evidence_refs||[])try{readBound(root,ref,'API 决定证据');}catch(error){conflicts.push({field:'evidence_refs',source_ref:ref,reason:error.message,recovery:'补齐当前证据后重新准备'});}
76
+ if(conflicts.length)throw Object.assign(new TypeError(conflicts.map(item=>`${item.field}: ${item.reason}; 恢复: ${item.recovery}`).join('\n')),{code:'API_SOURCE_CONFLICT',conflicts});
77
+ validateJsonSchema(result,SCHEMA.replace('.schema','-v2.schema'),{label:'API Contract Decision v2 草案'});
78
+ return result;
79
+ });
80
+ }
81
+ export function migrateApiContractDecision(binding,{root=TEMPLATE_ROOT,version}={}) {
82
+ return withValidationPhase({root,purpose:'api-migrate',slice_id:binding?.ref,readOnly:true},()=>{
83
+ const validated=validateApiContractDecision(binding,{root}),old=validated.decision;
84
+ if(old.schema_version!==1)fail('显式迁移只接受 v1');
85
+ if(!/^v[1-9][0-9]*$/.test(version)||BigInt(version.slice(1))<=BigInt(old.decision_version.slice(1)))fail('迁移必须选择新的递增决定版本');
86
+ const result=structuredClone(old);result.schema_version=2;result.decision_version=version;result.status='draft';delete result.current_version;
87
+ if(result.draft_review){result.evidence_refs=[...new Set([...result.evidence_refs,...result.draft_review.evidence_refs])];result.draft_review={ref:result.draft_review.ref,digest:result.draft_review.digest};result.freeze={version:result.freeze.version,frozen_at:result.freeze.frozen_at};}
88
+ return prepareApiContractDecision(result,{root});
89
+ });
90
+ }
@@ -1,5 +1,5 @@
1
1
  import { assertApprovalUserDecision } from './user-decision-reuse.mjs';
2
- import { existsSync, readFileSync } from "node:fs";
2
+ import { existsSync, readFileSync } from './validation-phase.mjs';
3
3
  import path from "node:path";
4
4
  import { parseDocument } from "../vendor/yaml.mjs";
5
5
  import {
@@ -1,12 +1,15 @@
1
+ import {validateJsonSchemas} from './json-schema.mjs';
2
+ import { assertScopeSlice, assertScopeWorkUnit } from './lifecycle-execution-scope.mjs';
1
3
  import { selectSliceWorkUnit, normalizeSliceContract, sourceSliceContract, parseSliceYaml } from './slice-contract.mjs';
2
4
  import path from 'node:path';
3
- import { readFileSync } from 'node:fs';
5
+ import { readFileSync, inValidationPhase, validationMemo, validationPhaseToken } from './validation-phase.mjs';
4
6
  import { ROOT, read, parse, safe, hash, digest, schema } from './strategic-handoff-io.mjs';
5
7
  import { countersignRuleForGate } from './digital-human-roles.mjs';
6
8
  import { validateApprovalRecord } from './approval-record.mjs';
7
9
  import { assertImplementationDecision } from './user-decision.mjs';
8
10
  import { loadSkillRegistry } from './skill-registry.mjs';
9
11
 
12
+ const primeCache=Symbol('approval-schema-prime');
10
13
  const contexts=new WeakMap();
11
14
  const gateId='gate.slice-contract-approved';
12
15
  const check=(ok,code,message)=>{if(!ok){const error=new TypeError(`${code}: ${message}`);error.code=code;throw error;}};
@@ -68,27 +71,52 @@ function executionBasis(verified,{allowCompilerDrift=false}={}) {
68
71
  return verified;
69
72
  }
70
73
 
74
+ function primeApprovalSchemas(binding,root){
75
+ if(!inValidationPhase())return;
76
+ validationMemo(primeCache,JSON.stringify([root,binding]),()=>{
77
+ const jobs=[];
78
+ const add=(value,ref,formatChecker,errorStyle)=>jobs.push({value,schemaPath:path.join(ROOT,ref),formatChecker,errorStyle});
79
+ // Speculative shape checks never decide approval or change the original error order.
80
+ // Original consumers still validate every semantic and authorization rule below.
81
+ try{
82
+ const source=parseSliceYaml(readFileSync(safe(root,binding.ref))),raw=source.slice_contract||source;
83
+ if(raw.schema_version===3)add(raw,'docs/process/schemas/slice-implementation-contract-v3.schema.json',false,'verbose');
84
+ const approval=read(safe(root,binding.approval_ref));
85
+ if(approval.gates&&approval.human_review&&!approval.gate_id){
86
+ add(approval,'docs/process/schemas/lifecycle-checkpoint.schema.json',false,'verbose');
87
+ for(const requirement of approval.human_review.user_decisions||[])if(requirement.user_decision_ref&&!requirement.continuation_ref){const ref=path.isAbsolute(requirement.user_decision_ref)?path.relative(root,requirement.user_decision_ref):requirement.user_decision_ref;add(read(safe(root,ref)),'docs/process/schemas/user-decision.schema.json',true,'compact');}
88
+ }
89
+ }catch{/* The original consumer reports missing or invalid input with its existing code. */}
90
+ if(jobs.length)validateJsonSchemas(jobs);return true;
91
+ });
92
+ }
71
93
  export function createApprovedExecutionContext(binding,options={}) {
94
+ primeApprovalSchemas(binding,path.resolve(options.root||process.cwd()));
72
95
  const verified=executionBasis(verifySliceContractApproval(binding,options));
73
- selectSliceWorkUnit(verified.contract,options.work_unit_id);
96
+ assertScopeSlice(selectSliceWorkUnit(verified.contract,options.work_unit_id),{root:verified.root});
97
+ if(!options.readOnly)assertScopeWorkUnit('work-unit.slice-implementation',{root:verified.root});
74
98
  const context=Object.freeze({kind:'approved-slice-execution-context'});
75
- contexts.set(context,{binding:verified.binding,root:verified.root,work_unit_id:options.work_unit_id,allowCompilerDrift:false});
99
+ contexts.set(context,{phase:validationPhaseToken(),binding:verified.binding,root:verified.root,work_unit_id:options.work_unit_id,allowCompilerDrift:false,readOnly:options.readOnly===true});
76
100
  return context;
77
101
  }
78
102
 
79
103
  /** A prior approved scope may authenticate bounded output while current compiler facts are recomputed. */
80
104
  export function createApprovedRecompilationContext(binding,options={}) {
81
- const verified=executionBasis(verifySliceContractApproval(binding,options),{allowCompilerDrift:true});
82
- selectSliceWorkUnit(verified.contract,options.work_unit_id);
105
+ const verified=executionBasis(verifySliceContractApproval(binding,options),{allowCompilerDrift:true,readOnly:options.readOnly===true});
106
+ assertScopeSlice(selectSliceWorkUnit(verified.contract,options.work_unit_id),{root:verified.root});
107
+ if(!options.readOnly)assertScopeWorkUnit('work-unit.slice-implementation',{root:verified.root});
83
108
  const context=Object.freeze({kind:'approved-slice-recompilation-context'});
84
- contexts.set(context,{binding:verified.binding,root:verified.root,work_unit_id:options.work_unit_id,allowCompilerDrift:true});
109
+ contexts.set(context,{phase:validationPhaseToken(),binding:verified.binding,root:verified.root,work_unit_id:options.work_unit_id,allowCompilerDrift:true,readOnly:options.readOnly===true});
85
110
  return context;
86
111
  }
87
112
 
88
113
  /** Revalidate original bytes on every boundary; a serialized/caller-invented context is rejected. */
89
- export function assertApprovedExecutionContext(context,{root=process.cwd(),contract,architectureIdentity,architectureEvidence,technicalDesign,sliceId}={}) {
114
+ export function assertApprovedExecutionContext(context,{root=process.cwd(),contract,architectureIdentity,architectureEvidence,technicalDesign,sliceId,readOnly=false}={}) {
90
115
  const saved=contexts.get(context);
91
116
  check(saved&&saved.root===path.resolve(root),'EXECUTION_CONTEXT_UNTRUSTED','只允许从当前原始 Slice 与本地批准生成的执行上下文');
117
+ check(!saved.phase||saved.phase===validationPhaseToken(),'EXECUTION_CONTEXT_EXPIRED','不能跨验证阶段复用批准上下文');
118
+ check(!saved.readOnly||readOnly,'EXECUTION_CONTEXT_READ_ONLY','只读检查上下文不能执行实现');
119
+ if(!readOnly)assertScopeWorkUnit('work-unit.slice-implementation',{root});
92
120
  const verified=executionBasis(verifySliceContractApproval(saved.binding,{root,contract}),{allowCompilerDrift:saved.allowCompilerDrift});
93
121
  const current=selectSliceWorkUnit(verified.contract,saved.work_unit_id),resolution=current.resolution;
94
122
  if(sliceId)check(current.slice_id===sliceId,'EXECUTION_SCOPE_CONFLICT','执行上下文属于另一切片');
@@ -37,9 +37,9 @@ export function validateArchitectureIdentity(identity, registry = loadSkillRegis
37
37
  }
38
38
 
39
39
  // Existing projects must present original on-disk evidence, not three copies supplied by a caller.
40
- export function verifyArchitectureEvidence(identity, evidence, { root, registry = loadSkillRegistry(), execution } = {}) {
40
+ export function verifyArchitectureEvidence(identity, evidence, { root, registry = loadSkillRegistry(), execution, readOnly=false } = {}) {
41
41
  validateArchitectureIdentity(identity, registry);
42
- if (identity.schema_version === 2) return verifyExistingArchitecture(identity, evidence, { root, registry, execution });
42
+ if (identity.schema_version === 2) return verifyExistingArchitecture(identity, evidence, { root, registry, execution, readOnly });
43
43
  if (!evidence?.engineering_baseline || !evidence?.repository_registration || !evidence?.manifest) throw new TypeError("缺少工程基线、仓库登记或 Manifest 架构证据");
44
44
  assertArchitectureAgreement(identity, evidence, registry);
45
45
  return { source_kind: "scaffold", bindings: evidence };
@@ -0,0 +1,51 @@
1
+ import { existsSync, readFileSync, rmSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { execFileSync } from 'node:child_process';
4
+ import { inspectBackendDelivery, openBackendDelivery } from './backend-delivery.mjs';
5
+ import { validateBackendReview } from './backend-review.mjs';
6
+ import { read, safe, hash, json, write, ensure, project } from './strategic-handoff-io.mjs';
7
+ import { loadExecutionScope, TERMINAL_REF } from './lifecycle-execution-scope.mjs';
8
+
9
+ async function inspect(root, record) {
10
+ project(root);
11
+ ensure(loadExecutionScope(root)?.scope_id === 'plan-to-backend', '需要 plan-to-backend 职责范围');
12
+ ensure(record.schema_version === 1 && record.kind === 'backend-delivery-terminal'
13
+ && record.business_completed === false && record.release_authorized === false, '后端终点不是业务完成或发布批准');
14
+ for (const name of ['delivery', 'review_state']) {
15
+ ensure(hash(readFileSync(safe(root, record[name]?.ref))) === record[name].digest, `${name} 原始字节变化`);
16
+ }
17
+ const state = read(safe(root, record.review_state.ref));
18
+ const { delivery } = await inspectBackendDelivery(root, record.delivery.ref);
19
+ ensure(state.review_input?.scope_kind === 'change' && state.review_input.slice_contract_ref === delivery.slice_contract.ref, '独立审查未绑定交付的 Slice');
20
+ ensure(validateBackendReview(state, { root }).status === 'passed', '后端交付需要当前独立审查');
21
+ const commit = execFileSync('git', ['-C', path.resolve(root, state.review_input.project_root), 'rev-parse', 'HEAD'], { encoding: 'utf8' }).trim();
22
+ ensure(state.review_input.review_mode === 'committed' && delivery.build.source_commit === commit, '终点需要与当前已提交审查候选一致的真实构建源码提交');
23
+ ensure(record.downstream && ['owner', 'ticket_ref', 'verification_plan', 'target_version'].every(key => typeof record.downstream[key] === 'string' && record.downstream[key].trim()), '终点缺少下游接收责任和待办');
24
+ return openBackendDelivery(safe(root, record.bundle_ref), bundle => {
25
+ ensure(record.bundle_digest === bundle.manifest.bundle_digest && bundle.manifest.delivery_ref === record.delivery.ref, '终点绑定的交付包不一致');
26
+ // A different valid package must not be used to close the current source.
27
+ for (const file of bundle.manifest.files) if (file.original_ref) {
28
+ ensure(hash(readFileSync(safe(root, file.original_ref))) === file.sha256, `包与当前源不同: ${file.original_ref}`);
29
+ }
30
+ return { result: 'backend-delivered', delivery_id: delivery.delivery_id, version: delivery.version,
31
+ bundle_digest: bundle.manifest.bundle_digest, next_work_unit: null, business_completed: false,
32
+ release_authorized: false, live_service_checked: false, downstream: record.downstream };
33
+ });
34
+ }
35
+
36
+ export async function verifyBackendDeliveryTerminal(root) {
37
+ return inspect(root, read(safe(root, TERMINAL_REF)));
38
+ }
39
+
40
+ /** This closes only the backend responsibility after real package and review validation. */
41
+ export async function completeBackendDelivery(root, input) {
42
+ root = path.resolve(root);
43
+ const record = { ...input, schema_version: 1, kind: 'backend-delivery-terminal', business_completed: false, release_authorized: false };
44
+ ensure(!existsSync(path.join(root, TERMINAL_REF)), '终点已存在;只能复验,不覆盖旧终点');
45
+ const result = await inspect(root, record);
46
+ const bytes = json(record);
47
+ write(root, TERMINAL_REF, bytes);
48
+ try { await verifyBackendDeliveryTerminal(root); }
49
+ catch (error) { if (readFileSync(safe(root, TERMINAL_REF), 'utf8') === bytes) rmSync(safe(root, TERMINAL_REF)); throw error; }
50
+ return result;
51
+ }
@@ -1,6 +1,6 @@
1
1
  /** Version qualification binds executable sources and generated bytes, not Skill prose. */
2
2
  import { createHash } from 'node:crypto';
3
- import { readFileSync, readdirSync, lstatSync } from 'node:fs';
3
+ import { readFileSync, readdirSync, lstatSync } from './validation-phase.mjs';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
@@ -1,7 +1,7 @@
1
1
  import { assertSourceFingerprint } from "./backend-platform-provenance.mjs";
2
2
  /** Shared, exact backend platform selection. Catalog entries are maintenance-owned. */
3
3
  import { createHash } from "node:crypto";
4
- import { readFileSync } from "node:fs";
4
+ import { readFileSync } from './validation-phase.mjs';
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
 
@@ -3,8 +3,10 @@ import path from 'node:path';
3
3
  import { spawnSync } from 'node:child_process';
4
4
  import { createHash } from 'node:crypto';
5
5
  import { parseSliceYaml, selectSliceWorkUnit } from './slice-contract.mjs';
6
+ import { validateApprovalRecord } from './approval-record.mjs';
6
7
  import { inspectSliceContract } from './slice-execution-preflight.mjs';
7
8
  import { inspectMaintenanceCandidate } from './maintenance-candidate.mjs';
9
+ import { compileStandardsCoverage, coverageDigest, coverageFile, verifyCoverageRows } from './backend-standards-coverage.mjs';
8
10
 
9
11
  const ensure = (condition, message) => { if (!condition) throw new Error(`backend-review: ${message}`); };
10
12
  const text = value => typeof value === 'string' && value.trim();
@@ -22,12 +24,14 @@ function file(root, ref) {
22
24
 
23
25
  export function backendReviewSkills(contract, actualSkills = []) {
24
26
  return [...new Set([...(contract.resolution?.required_skills || []), ...(contract.common?.required_skills || []),
25
- ...(contract.backend?.required_skills || []), ...actualSkills, 'alibaba-java-code-style', 'yss-repository', 'yss-mybatis'])].sort();
27
+ ...(contract.backend?.required_skills || []), ...actualSkills, 'alibaba-java-code-style'])].sort();
26
28
  }
27
29
 
28
30
  /** Validate existing code-review result and constraint_results; this is not an approval authority. */
29
31
  export function validateBackendReview(state, { root = process.cwd() } = {}) {
30
32
  const input = state?.review_input;
33
+ ensure(['baseline','change'].includes(input?.scope_kind), 'scope_kind required; historical records are read-only');
34
+ if (input.scope_kind === 'baseline') return validateBaselineReview(state, {root});
31
35
  ensure(input?.slice_contract_ref, 'review input must bind Slice contract');
32
36
  const loaded = inspectSliceContract(input.slice_contract_ref, { root, approval_ref: input.approval_ref, work_unit_id: input.work_unit_id });
33
37
  ensure(loaded.report.execution_allowed, `approved current contract required: ${loaded.report.blockers.join('; ')}`);
@@ -68,25 +72,9 @@ export function validateBackendReview(state, { root = process.cwd() } = {}) {
68
72
  ensure(tree === input.candidate_digest, 'committed candidate mismatch');
69
73
  ensure(git(projectRoot, ['rev-parse','HEAD^{tree}']).toString().trim() === tree && !git(projectRoot, ['status','--porcelain']).length, 'committed candidate is not current clean checkout');
70
74
  }
71
- const layerSkills = { domain: 'yss-domain', application: 'yss-application', infrastructure: 'yss-repository', web: 'yss-web-controller' };
72
- const actualSkills = [...input.actual_skill_impacts, ...(contract.backend.affected_layers || []).map(layer => layerSkills[layer]).filter(Boolean)];
73
- const required = backendReviewSkills(contract, actualSkills);
74
- const applicable = new Set([...(contract.resolution?.required_skills || []), ...(contract.common?.required_skills || []), ...(contract.backend?.required_skills || []), ...actualSkills, "alibaba-java-code-style"]);
75
- ensure(Array.isArray(result.constraint_results), 'constraint_results required');
76
- for (const skill of required) {
77
- const rows = result.constraint_results.filter(row => row.skill === skill && row.axis === 'Standards');
78
- ensure(rows.length, `skill not reviewed: ${skill}`);
79
- for (const row of rows) {
80
- ensure(text(row.constraint) && text(row.rule_ref) && text(row.code_ref) && text(row.evidence_ref), `${skill}: rule/code/evidence required`);
81
- ensure(['passed','not-applicable'].includes(row.status), `${skill}: unresolved violation`);
82
- ensure(row.status !== 'not-applicable' || (text(row.reason) && !applicable.has(skill)), `${skill}: applicable skill cannot be waived`);
83
- ensure(row.rule_ref.startsWith(`.agents/skills/${skill}/`), `${skill}: rule must cite its canonical skill`);
84
- const rule = fs.readFileSync(file(root, row.rule_ref.split('#')[0]));
85
- ensure(digest(rule) === row.rule_digest, `${skill}: rule evidence stale`);
86
- ensure(fs.existsSync(file(projectRoot, row.code_ref.split(':')[0])), `${skill}: missing code location`);
87
- ensure(digest(fs.readFileSync(file(root, row.evidence_ref))) === row.evidence_digest, `${skill}: verification evidence stale`);
88
- }
89
- }
75
+ const coverage = currentStandardsCoverage(input, {root, projectRoot, contract});
76
+ verifyCoverageRows(coverage, result.constraint_results, {root, projectRoot});
77
+ const required = coverage.skills.map(row => row.skill);
90
78
  ensure(Array.isArray(result.verification_results) && result.verification_results.length > 0, 'machine verification required');
91
79
  for (const check of result.verification_results) {
92
80
  ensure(text(check.command) && Number.isFinite(Date.parse(check.executed_at)) && check.exit_code === 0 && check.candidate_digest === result.candidate_digest, 'machine check failed, absent or stale');
@@ -100,3 +88,53 @@ export function validateBackendReview(state, { root = process.cwd() } = {}) {
100
88
  }
101
89
  return { status: 'passed', candidate_digest: input.candidate_digest, reviewed_skills: required };
102
90
  }
91
+
92
+ /** Recompute derived coverage, do not trust a submitted expected-rule list. */
93
+ export function currentStandardsCoverage(input, {root, projectRoot, contract=null}={}) {
94
+ ensure(input.standards_coverage_ref && input.standards_coverage_digest, 'standards coverage binding required');
95
+ const bytes=fs.readFileSync(file(root,input.standards_coverage_ref));
96
+ ensure(digest(bytes)===input.standards_coverage_digest, 'standards coverage digest stale');
97
+ const recorded=parseSliceYaml(bytes.toString());
98
+ let comparison_ref=null;
99
+ if(input.scope_kind==='change') {
100
+ comparison_ref=input.review_mode==='worktree'
101
+ ? inspectMaintenanceCandidate({manifestPath:file(projectRoot,input.candidate_snapshot_ref)}).manifest.merge_base
102
+ : input.review_base_ref;
103
+ }
104
+ const current=compileStandardsCoverage({root,projectRoot,contract,scope_kind:input.scope_kind,
105
+ baseline_binding:input.baseline_binding,comparison_ref,actual_skills:input.actual_skill_impacts||[],responsibility_evidence:input.responsibility_evidence||[]});
106
+ ensure(coverageDigest(current)===coverageDigest(recorded),'standards coverage stale or incomplete');
107
+ return current;
108
+ }
109
+
110
+ function validateBaselineReview(state,{root}) {
111
+ const input=state.review_input,projectRoot=fs.realpathSync(path.resolve(root,input.project_root||'.'));
112
+ const coverage=currentStandardsCoverage(input,{root,projectRoot});
113
+ const result=parseSliceYaml(fs.readFileSync(file(root,state.review_result_ref),'utf8'));
114
+ ensure(result.skill==='code-review' && result.result==='completed','independent code-review baseline report required');
115
+ ensure(result.candidate_digest===coverageDigest(coverage.inventory) && input.candidate_digest===result.candidate_digest,'baseline candidate stale');
116
+ for(const key of ['actor_id','runtime_id','instance_id'])ensure(text(result.reviewer?.[key])&&text(result.implementer?.[key]),'baseline actor identity required');
117
+ ensure(result.reviewer.actor_id!==result.implementer.actor_id && result.reviewer.instance_id!==result.implementer.instance_id,'independent Reviewer required');
118
+ ensure(result.implementer.actor_id===input.implementation_actor_id && result.implementer.instance_id===input.implementation_instance_id,'baseline actor mismatch');
119
+ verifyCoverageRows(coverage,result.constraint_results,{root,projectRoot});
120
+ ensure(result.axes?.Standards==='passed','Standards must pass');
121
+ ensure(['passed','missing_evidence'].includes(result.axes?.Spec),'baseline Spec must be explicit');
122
+ if(result.axes.Spec==='passed') {
123
+ ensure(input.spec_binding?.ref && input.spec_binding?.digest,'approved Spec evidence binding required');
124
+ ensure(digest(fs.readFileSync(file(root,input.spec_binding.ref)))===input.spec_binding.digest.replace(/^sha256:/,''),'Spec evidence stale');
125
+ ensure(text(input.spec_binding.approval_ref),'Spec approval record required');
126
+ const approval=parseSliceYaml(fs.readFileSync(file(root,input.spec_binding.approval_ref),'utf8'));
127
+ validateApprovalRecord(approval,{root,requireApproved:true,rolesDoc:parseSliceYaml(fs.readFileSync(file(root,'docs/agents/digital-human-roles.yaml'),'utf8'))});
128
+ ensure(approval.gate_id==='gate.spec-baseline-approved' && approval.artifact_bindings?.some(b=>b.digest.replace(/^sha256:/,'')===input.spec_binding.digest.replace(/^sha256:/,'')),'Spec approval does not bind current baseline');
129
+ ensure(Array.isArray(result.constraint_results)&&result.constraint_results.some(r=>r.axis==='Spec'&&r.status==='passed'&&text(r.evidence_ref)),'Spec acceptance evidence required');
130
+ for(const row of result.constraint_results.filter(r=>r.axis==='Spec')) {
131
+ ensure(row.status==='passed'&&text(row.constraint)&&text(row.code_ref)&&text(row.evidence_ref),'Spec acceptance unresolved');
132
+ coverageFile(projectRoot,row.code_ref.split(':')[0]);
133
+ ensure(digest(fs.readFileSync(file(root,row.evidence_ref)))===row.evidence_digest,'Spec acceptance evidence stale');
134
+ }
135
+ }
136
+ ensure(Array.isArray(result.findings)&&result.findings.every(f=>f.disposition==='suggestion'||f.status==='resolved'||(f.disposition==='missing_evidence'&&f.axis==='Spec'&&result.axes.Spec==='missing_evidence')),'baseline blocking findings remain');
137
+ ensure(Array.isArray(result.verification_results)&&result.verification_results.length,'baseline verification required');
138
+ for(const check of result.verification_results)ensure(text(check.command)&&check.exit_code===0&&Number.isFinite(Date.parse(check.executed_at))&&check.candidate_digest===result.candidate_digest&&digest(fs.readFileSync(file(root,check.evidence_ref)))===check.evidence_digest,'baseline machine evidence missing or stale');
139
+ return {status:'audited',axes:result.axes,execution_allowed:false,scope_kind:'baseline',candidate_digest:result.candidate_digest,reviewed_skills:coverage.skills.map(s=>s.skill)};
140
+ }
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { existsSync, readFileSync } from "node:fs";
2
+ import { existsSync, readFileSync } from './validation-phase.mjs';
3
3
  import path from "node:path";
4
4
  import { parseDocument } from "../vendor/yaml.mjs";
5
5
  import { loadApprovalRecord, validateApprovalRecord } from "./approval-record.mjs";