create-yss-spec 3.4.10 → 3.5.2

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 (642) hide show
  1. package/README.md +8 -4
  2. package/package.json +1 -1
  3. package/src/api/_sync-service.js +141 -23
  4. package/src/cli/args.js +3 -0
  5. package/src/cli/help.js +14 -2
  6. package/src/cli/index.js +3 -0
  7. package/src/cli/prompts.js +5 -1
  8. package/src/cli/router.js +2 -0
  9. package/src/commands/attach.js +21 -5
  10. package/src/commands/diff.js +1 -0
  11. package/src/commands/doctor.js +1 -0
  12. package/src/commands/init.js +4 -1
  13. package/src/commands/skills.js +253 -0
  14. package/src/commands/sync.js +4 -0
  15. package/src/family-identity.js +2 -2
  16. package/src/template/asset-runtime.js +228 -0
  17. package/src/template/attach-planner.js +1 -1
  18. package/src/template/distribution-runtime.js +165 -0
  19. package/src/template/instance-runtime.js +76 -29
  20. package/src/template/layout-migration.js +160 -0
  21. package/src/template/migration-runtime.js +2 -2
  22. package/src/template/ownership-policy.js +17 -1
  23. package/src/template/prune-planner.js +6 -1
  24. package/src/template/sync-planner.js +4 -1
  25. package/src/template/verification-runtime.js +56 -1
  26. package/src/validation/metadata.js +24 -1
  27. package/template/.agents/rules/yss-ai-skills.md +1 -1
  28. package/template/.agents/skills/.strategic-design-skills-manifest.json +7 -8
  29. package/template/.agents/skills/.yss-skills-manifest.json +2 -2
  30. package/template/.agents/skills/alibaba-java-code-style/SKILL.md +1 -1
  31. package/template/.agents/skills/code-review/SKILL.md +6 -6
  32. package/template/.agents/skills/code-review/references/yss-review-standards.md +1 -1
  33. package/template/.agents/skills/cross-repo-implementation-routing/SKILL.md +2 -2
  34. package/template/.agents/skills/i-have-adhd/SKILL.md +1 -1
  35. package/template/.agents/skills/i-have-adhd/references/yss-adaptation.md +1 -1
  36. package/template/.agents/skills/i-have-adhd/tests/verify-integration.mjs +2 -2
  37. package/template/.agents/skills/implementation-repo-onboarding/SKILL.md +2 -2
  38. package/template/.agents/skills/llm-wiki/references/discover.md +3 -3
  39. package/template/.agents/skills/prototype-review/SKILL.md +4 -4
  40. package/template/.agents/skills/setup-matt-pocock-skills/SKILL.md +10 -10
  41. package/template/.agents/skills/triage/SKILL.md +1 -1
  42. package/template/.agents/skills/yss-application/references/profiles/layered-mvc-service.md +1 -1
  43. package/template/.agents/skills/yss-application/references/profiles/mvc-data-analysis-v1.md +1 -1
  44. package/template/.agents/skills/yss-backend-spec-review/SKILL.md +1 -1
  45. package/template/.agents/skills/yss-backend-spec-review/references/check-inputs.md +1 -1
  46. package/template/.agents/skills/yss-cache/SKILL.md +6 -5
  47. package/template/.agents/skills/yss-cache/references/annotations.md +3 -1
  48. package/template/.agents/skills/yss-cache/references/architecture.md +4 -2
  49. package/template/.agents/skills/yss-cache/references/configuration.md +6 -3
  50. package/template/.agents/skills/yss-cache/references/jetcache.md +21 -0
  51. package/template/.agents/skills/yss-cache/references/redis-fallback.md +5 -3
  52. package/template/.agents/skills/yss-cache/references/verification.md +10 -4
  53. package/template/.agents/skills/yss-cache/scripts/verify-cache-component.sh +26 -20
  54. package/template/.agents/skills/yss-ddd-scaffold-generator/SKILL.md +2 -2
  55. package/template/.agents/skills/yss-ddd-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  56. package/template/.agents/skills/yss-design-system/SKILL.md +10 -10
  57. package/template/.agents/skills/yss-design-system/references/design-qa-theme.md +3 -3
  58. package/template/.agents/skills/yss-design-system/references/design-system.md +3 -3
  59. package/template/.agents/skills/yss-distributed-id/SKILL.md +14 -58
  60. package/template/.agents/skills/yss-distributed-id/agents/openai.yaml +2 -2
  61. package/template/.agents/skills/yss-distributed-id/references/README.md +11 -47
  62. package/template/.agents/skills/yss-exception/SKILL.md +1 -1
  63. package/template/.agents/skills/yss-frontend-scaffold-generator/SKILL.md +2 -2
  64. package/template/.agents/skills/yss-frontend-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  65. package/template/.agents/skills/yss-frontend-scaffold-generator/scripts/refresh_baseline.mjs +2 -2
  66. package/template/.agents/skills/yss-implementation-contract-compiler/SKILL.md +9 -9
  67. package/template/.agents/skills/yss-implementation-contract-compiler/references/boundaries.md +1 -1
  68. package/template/.agents/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +9 -9
  69. package/template/.agents/skills/yss-implementation-contract-compiler/references/slice-implementation-contract-v2.md +3 -3
  70. package/template/.agents/skills/yss-implementation-contract-compiler/references/slice-implementation-contract.md +1 -1
  71. package/template/.agents/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +1 -1
  72. package/template/.agents/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  73. package/template/.agents/skills/yss-layered-mvc-scaffold-generator/scripts/data-analysis-profile.mjs +5 -5
  74. package/template/.agents/skills/yss-layered-mvc-scaffold-generator/scripts/generate_scaffold.mjs +2 -2
  75. package/template/.agents/skills/yss-layered-mvc-scaffold-generator/scripts/scaffold-generator.test.mjs +42 -0
  76. package/template/.agents/skills/yss-mybatis/SKILL.md +14 -2
  77. package/template/.agents/skills/yss-openapi-draft-review/SKILL.md +2 -2
  78. package/template/.agents/skills/yss-openapi-governance/SKILL.md +7 -7
  79. package/template/.agents/skills/yss-product-lifecycle/SKILL.md +11 -11
  80. package/template/.agents/skills/yss-product-lifecycle/references/matt-yss-adapter.md +5 -5
  81. package/template/.agents/skills/yss-product-lifecycle/references/orchestration-contract.yaml +70 -47
  82. package/template/.agents/skills/yss-product-lifecycle/references/orchestration.md +22 -14
  83. package/template/.agents/skills/yss-product-lifecycle/references/request-triage.md +2 -0
  84. package/template/.agents/skills/yss-product-lifecycle/references/state-model.md +11 -11
  85. package/template/.agents/skills/yss-product-lifecycle/references/user-decisions.md +2 -2
  86. package/template/.agents/skills/yss-prototype-stage/SKILL.md +9 -9
  87. package/template/.agents/skills/yss-prototype-stage/references/existing-ui-entry.md +1 -1
  88. package/template/.agents/skills/yss-prototype-stage/scripts/build-antd-prototype.mjs +1 -1
  89. package/template/.agents/skills/yss-prototype-stage/scripts/offline-html.mjs +3 -3
  90. package/template/.agents/skills/yss-prototype-stage/tests/browser-smoke.mjs +2 -2
  91. package/template/.agents/skills/yss-prototype-stage/tests/run-scenarios.mjs +4 -4
  92. package/template/.agents/skills/yss-prototype-stage/tests/workbench-smoke.mjs +1 -1
  93. package/template/.agents/skills/yss-repository/SKILL.md +3 -2
  94. package/template/.agents/skills/yss-repository/references/profiles/layered-mvc-service.md +1 -1
  95. package/template/.agents/skills/yss-repository/references/profiles/mvc-data-analysis-v1.md +1 -1
  96. package/template/.agents/skills/yss-repository/tests/profile-routing.test.mjs +2 -2
  97. package/template/.agents/skills/yss-research/SKILL.md +2 -2
  98. package/template/.agents/skills/yss-skill-source-index-refresh/references/backend-component-platform-compatibility.md +1 -1
  99. package/template/.agents/skills/yss-stage-decision/SKILL.md +5 -5
  100. package/template/.agents/skills/yss-stage-decision/references/domain-strategy-contract.md +1 -1
  101. package/template/.agents/skills/yss-stage-decision/references/strategic-handoff-routing.md +1 -1
  102. package/template/.agents/skills/yss-tactical-design/SKILL.md +2 -2
  103. package/template/.agents/skills/yss-tactical-design/references/strategic-handoff-routing.md +1 -1
  104. package/template/.agents/skills/yss-tactical-design/references/tactical-design-contract.md +1 -1
  105. package/template/.agents/skills/yss-technical-design/SKILL.md +6 -6
  106. package/template/.agents/skills/yss-technical-design/references/technical-design-contract.md +1 -1
  107. package/template/.agents/skills/yss-ui/SKILL.md +1 -1
  108. package/template/.agents/skills/yss-up-springboot3/SKILL.md +1 -1
  109. package/template/.agents/skills/yss-web-controller/SKILL.md +1 -1
  110. package/template/.agents/skills/yss-web-controller/references/profiles/layered-mvc-service.md +1 -1
  111. package/template/.codex/skills/alibaba-java-code-style/SKILL.md +1 -1
  112. package/template/.codex/skills/code-review/SKILL.md +6 -6
  113. package/template/.codex/skills/code-review/references/yss-review-standards.md +1 -1
  114. package/template/.codex/skills/cross-repo-implementation-routing/SKILL.md +2 -2
  115. package/template/.codex/skills/i-have-adhd/SKILL.md +1 -1
  116. package/template/.codex/skills/i-have-adhd/references/yss-adaptation.md +1 -1
  117. package/template/.codex/skills/i-have-adhd/tests/verify-integration.mjs +2 -2
  118. package/template/.codex/skills/implementation-repo-onboarding/SKILL.md +2 -2
  119. package/template/.codex/skills/llm-wiki/references/discover.md +3 -3
  120. package/template/.codex/skills/prototype-review/SKILL.md +4 -4
  121. package/template/.codex/skills/setup-matt-pocock-skills/SKILL.md +10 -10
  122. package/template/.codex/skills/triage/SKILL.md +1 -1
  123. package/template/.codex/skills/yss-application/references/profiles/layered-mvc-service.md +1 -1
  124. package/template/.codex/skills/yss-application/references/profiles/mvc-data-analysis-v1.md +1 -1
  125. package/template/.codex/skills/yss-backend-spec-review/SKILL.md +1 -1
  126. package/template/.codex/skills/yss-backend-spec-review/references/check-inputs.md +1 -1
  127. package/template/.codex/skills/yss-cache/SKILL.md +6 -5
  128. package/template/.codex/skills/yss-cache/references/annotations.md +3 -1
  129. package/template/.codex/skills/yss-cache/references/architecture.md +4 -2
  130. package/template/.codex/skills/yss-cache/references/configuration.md +6 -3
  131. package/template/.codex/skills/yss-cache/references/jetcache.md +21 -0
  132. package/template/.codex/skills/yss-cache/references/redis-fallback.md +5 -3
  133. package/template/.codex/skills/yss-cache/references/verification.md +10 -4
  134. package/template/.codex/skills/yss-cache/scripts/verify-cache-component.sh +26 -20
  135. package/template/.codex/skills/yss-ddd-scaffold-generator/SKILL.md +2 -2
  136. package/template/.codex/skills/yss-ddd-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  137. package/template/.codex/skills/yss-design-system/SKILL.md +10 -10
  138. package/template/.codex/skills/yss-design-system/references/design-qa-theme.md +3 -3
  139. package/template/.codex/skills/yss-design-system/references/design-system.md +3 -3
  140. package/template/.codex/skills/yss-distributed-id/SKILL.md +14 -58
  141. package/template/.codex/skills/yss-distributed-id/agents/openai.yaml +2 -2
  142. package/template/.codex/skills/yss-distributed-id/references/README.md +11 -47
  143. package/template/.codex/skills/yss-exception/SKILL.md +1 -1
  144. package/template/.codex/skills/yss-frontend-scaffold-generator/SKILL.md +2 -2
  145. package/template/.codex/skills/yss-frontend-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  146. package/template/.codex/skills/yss-frontend-scaffold-generator/scripts/refresh_baseline.mjs +2 -2
  147. package/template/.codex/skills/yss-implementation-contract-compiler/SKILL.md +9 -9
  148. package/template/.codex/skills/yss-implementation-contract-compiler/references/boundaries.md +1 -1
  149. package/template/.codex/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +9 -9
  150. package/template/.codex/skills/yss-implementation-contract-compiler/references/slice-implementation-contract-v2.md +3 -3
  151. package/template/.codex/skills/yss-implementation-contract-compiler/references/slice-implementation-contract.md +1 -1
  152. package/template/.codex/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +1 -1
  153. package/template/.codex/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  154. package/template/.codex/skills/yss-layered-mvc-scaffold-generator/scripts/data-analysis-profile.mjs +5 -5
  155. package/template/.codex/skills/yss-layered-mvc-scaffold-generator/scripts/generate_scaffold.mjs +2 -2
  156. package/template/.codex/skills/yss-layered-mvc-scaffold-generator/scripts/scaffold-generator.test.mjs +42 -0
  157. package/template/.codex/skills/yss-mybatis/SKILL.md +14 -2
  158. package/template/.codex/skills/yss-openapi-draft-review/SKILL.md +2 -2
  159. package/template/.codex/skills/yss-openapi-governance/SKILL.md +7 -7
  160. package/template/.codex/skills/yss-product-lifecycle/SKILL.md +11 -11
  161. package/template/.codex/skills/yss-product-lifecycle/references/matt-yss-adapter.md +5 -5
  162. package/template/.codex/skills/yss-product-lifecycle/references/orchestration-contract.yaml +70 -47
  163. package/template/.codex/skills/yss-product-lifecycle/references/orchestration.md +22 -14
  164. package/template/.codex/skills/yss-product-lifecycle/references/request-triage.md +2 -0
  165. package/template/.codex/skills/yss-product-lifecycle/references/state-model.md +11 -11
  166. package/template/.codex/skills/yss-product-lifecycle/references/user-decisions.md +2 -2
  167. package/template/.codex/skills/yss-prototype-stage/SKILL.md +9 -9
  168. package/template/.codex/skills/yss-prototype-stage/references/existing-ui-entry.md +1 -1
  169. package/template/.codex/skills/yss-prototype-stage/scripts/build-antd-prototype.mjs +1 -1
  170. package/template/.codex/skills/yss-prototype-stage/scripts/offline-html.mjs +3 -3
  171. package/template/.codex/skills/yss-prototype-stage/tests/browser-smoke.mjs +2 -2
  172. package/template/.codex/skills/yss-prototype-stage/tests/run-scenarios.mjs +4 -4
  173. package/template/.codex/skills/yss-prototype-stage/tests/workbench-smoke.mjs +1 -1
  174. package/template/.codex/skills/yss-repository/SKILL.md +3 -2
  175. package/template/.codex/skills/yss-repository/references/profiles/layered-mvc-service.md +1 -1
  176. package/template/.codex/skills/yss-repository/references/profiles/mvc-data-analysis-v1.md +1 -1
  177. package/template/.codex/skills/yss-repository/tests/profile-routing.test.mjs +2 -2
  178. package/template/.codex/skills/yss-research/SKILL.md +2 -2
  179. package/template/.codex/skills/yss-skill-source-index-refresh/references/backend-component-platform-compatibility.md +1 -1
  180. package/template/.codex/skills/yss-stage-decision/SKILL.md +5 -5
  181. package/template/.codex/skills/yss-stage-decision/references/domain-strategy-contract.md +1 -1
  182. package/template/.codex/skills/yss-stage-decision/references/strategic-handoff-routing.md +1 -1
  183. package/template/.codex/skills/yss-tactical-design/SKILL.md +2 -2
  184. package/template/.codex/skills/yss-tactical-design/references/strategic-handoff-routing.md +1 -1
  185. package/template/.codex/skills/yss-tactical-design/references/tactical-design-contract.md +1 -1
  186. package/template/.codex/skills/yss-technical-design/SKILL.md +6 -6
  187. package/template/.codex/skills/yss-technical-design/references/technical-design-contract.md +1 -1
  188. package/template/.codex/skills/yss-ui/SKILL.md +1 -1
  189. package/template/.codex/skills/yss-up-springboot3/SKILL.md +1 -1
  190. package/template/.codex/skills/yss-web-controller/SKILL.md +1 -1
  191. package/template/.codex/skills/yss-web-controller/references/profiles/layered-mvc-service.md +1 -1
  192. package/template/.cursor/skills/alibaba-java-code-style/SKILL.md +1 -1
  193. package/template/.cursor/skills/code-review/SKILL.md +6 -6
  194. package/template/.cursor/skills/code-review/references/yss-review-standards.md +1 -1
  195. package/template/.cursor/skills/cross-repo-implementation-routing/SKILL.md +2 -2
  196. package/template/.cursor/skills/i-have-adhd/SKILL.md +1 -1
  197. package/template/.cursor/skills/i-have-adhd/references/yss-adaptation.md +1 -1
  198. package/template/.cursor/skills/i-have-adhd/tests/verify-integration.mjs +2 -2
  199. package/template/.cursor/skills/implementation-repo-onboarding/SKILL.md +2 -2
  200. package/template/.cursor/skills/llm-wiki/references/discover.md +3 -3
  201. package/template/.cursor/skills/prototype-review/SKILL.md +4 -4
  202. package/template/.cursor/skills/setup-matt-pocock-skills/SKILL.md +10 -10
  203. package/template/.cursor/skills/triage/SKILL.md +1 -1
  204. package/template/.cursor/skills/yss-application/references/profiles/layered-mvc-service.md +1 -1
  205. package/template/.cursor/skills/yss-application/references/profiles/mvc-data-analysis-v1.md +1 -1
  206. package/template/.cursor/skills/yss-backend-spec-review/SKILL.md +1 -1
  207. package/template/.cursor/skills/yss-backend-spec-review/references/check-inputs.md +1 -1
  208. package/template/.cursor/skills/yss-cache/SKILL.md +6 -5
  209. package/template/.cursor/skills/yss-cache/references/annotations.md +3 -1
  210. package/template/.cursor/skills/yss-cache/references/architecture.md +4 -2
  211. package/template/.cursor/skills/yss-cache/references/configuration.md +6 -3
  212. package/template/.cursor/skills/yss-cache/references/jetcache.md +21 -0
  213. package/template/.cursor/skills/yss-cache/references/redis-fallback.md +5 -3
  214. package/template/.cursor/skills/yss-cache/references/verification.md +10 -4
  215. package/template/.cursor/skills/yss-cache/scripts/verify-cache-component.sh +26 -20
  216. package/template/.cursor/skills/yss-ddd-scaffold-generator/SKILL.md +2 -2
  217. package/template/.cursor/skills/yss-ddd-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  218. package/template/.cursor/skills/yss-design-system/SKILL.md +10 -10
  219. package/template/.cursor/skills/yss-design-system/references/design-qa-theme.md +3 -3
  220. package/template/.cursor/skills/yss-design-system/references/design-system.md +3 -3
  221. package/template/.cursor/skills/yss-distributed-id/SKILL.md +14 -58
  222. package/template/.cursor/skills/yss-distributed-id/agents/openai.yaml +2 -2
  223. package/template/.cursor/skills/yss-distributed-id/references/README.md +11 -47
  224. package/template/.cursor/skills/yss-exception/SKILL.md +1 -1
  225. package/template/.cursor/skills/yss-frontend-scaffold-generator/SKILL.md +2 -2
  226. package/template/.cursor/skills/yss-frontend-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  227. package/template/.cursor/skills/yss-frontend-scaffold-generator/scripts/refresh_baseline.mjs +2 -2
  228. package/template/.cursor/skills/yss-implementation-contract-compiler/SKILL.md +9 -9
  229. package/template/.cursor/skills/yss-implementation-contract-compiler/references/boundaries.md +1 -1
  230. package/template/.cursor/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +9 -9
  231. package/template/.cursor/skills/yss-implementation-contract-compiler/references/slice-implementation-contract-v2.md +3 -3
  232. package/template/.cursor/skills/yss-implementation-contract-compiler/references/slice-implementation-contract.md +1 -1
  233. package/template/.cursor/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +1 -1
  234. package/template/.cursor/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  235. package/template/.cursor/skills/yss-layered-mvc-scaffold-generator/scripts/data-analysis-profile.mjs +5 -5
  236. package/template/.cursor/skills/yss-layered-mvc-scaffold-generator/scripts/generate_scaffold.mjs +2 -2
  237. package/template/.cursor/skills/yss-layered-mvc-scaffold-generator/scripts/scaffold-generator.test.mjs +42 -0
  238. package/template/.cursor/skills/yss-mybatis/SKILL.md +14 -2
  239. package/template/.cursor/skills/yss-openapi-draft-review/SKILL.md +2 -2
  240. package/template/.cursor/skills/yss-openapi-governance/SKILL.md +7 -7
  241. package/template/.cursor/skills/yss-product-lifecycle/SKILL.md +11 -11
  242. package/template/.cursor/skills/yss-product-lifecycle/references/matt-yss-adapter.md +5 -5
  243. package/template/.cursor/skills/yss-product-lifecycle/references/orchestration-contract.yaml +70 -47
  244. package/template/.cursor/skills/yss-product-lifecycle/references/orchestration.md +22 -14
  245. package/template/.cursor/skills/yss-product-lifecycle/references/request-triage.md +2 -0
  246. package/template/.cursor/skills/yss-product-lifecycle/references/state-model.md +11 -11
  247. package/template/.cursor/skills/yss-product-lifecycle/references/user-decisions.md +2 -2
  248. package/template/.cursor/skills/yss-prototype-stage/SKILL.md +9 -9
  249. package/template/.cursor/skills/yss-prototype-stage/references/existing-ui-entry.md +1 -1
  250. package/template/.cursor/skills/yss-prototype-stage/scripts/build-antd-prototype.mjs +1 -1
  251. package/template/.cursor/skills/yss-prototype-stage/scripts/offline-html.mjs +3 -3
  252. package/template/.cursor/skills/yss-prototype-stage/tests/browser-smoke.mjs +2 -2
  253. package/template/.cursor/skills/yss-prototype-stage/tests/run-scenarios.mjs +4 -4
  254. package/template/.cursor/skills/yss-prototype-stage/tests/workbench-smoke.mjs +1 -1
  255. package/template/.cursor/skills/yss-repository/SKILL.md +3 -2
  256. package/template/.cursor/skills/yss-repository/references/profiles/layered-mvc-service.md +1 -1
  257. package/template/.cursor/skills/yss-repository/references/profiles/mvc-data-analysis-v1.md +1 -1
  258. package/template/.cursor/skills/yss-repository/tests/profile-routing.test.mjs +2 -2
  259. package/template/.cursor/skills/yss-research/SKILL.md +2 -2
  260. package/template/.cursor/skills/yss-skill-source-index-refresh/references/backend-component-platform-compatibility.md +1 -1
  261. package/template/.cursor/skills/yss-stage-decision/SKILL.md +5 -5
  262. package/template/.cursor/skills/yss-stage-decision/references/domain-strategy-contract.md +1 -1
  263. package/template/.cursor/skills/yss-stage-decision/references/strategic-handoff-routing.md +1 -1
  264. package/template/.cursor/skills/yss-tactical-design/SKILL.md +2 -2
  265. package/template/.cursor/skills/yss-tactical-design/references/strategic-handoff-routing.md +1 -1
  266. package/template/.cursor/skills/yss-tactical-design/references/tactical-design-contract.md +1 -1
  267. package/template/.cursor/skills/yss-technical-design/SKILL.md +6 -6
  268. package/template/.cursor/skills/yss-technical-design/references/technical-design-contract.md +1 -1
  269. package/template/.cursor/skills/yss-ui/SKILL.md +1 -1
  270. package/template/.cursor/skills/yss-up-springboot3/SKILL.md +1 -1
  271. package/template/.cursor/skills/yss-web-controller/SKILL.md +1 -1
  272. package/template/.cursor/skills/yss-web-controller/references/profiles/layered-mvc-service.md +1 -1
  273. package/template/.cursorrules +1 -1
  274. package/template/.pi/skills/alibaba-java-code-style/SKILL.md +1 -1
  275. package/template/.pi/skills/code-review/SKILL.md +6 -6
  276. package/template/.pi/skills/code-review/references/yss-review-standards.md +1 -1
  277. package/template/.pi/skills/cross-repo-implementation-routing/SKILL.md +2 -2
  278. package/template/.pi/skills/i-have-adhd/SKILL.md +1 -1
  279. package/template/.pi/skills/i-have-adhd/references/yss-adaptation.md +1 -1
  280. package/template/.pi/skills/i-have-adhd/tests/verify-integration.mjs +2 -2
  281. package/template/.pi/skills/implementation-repo-onboarding/SKILL.md +2 -2
  282. package/template/.pi/skills/llm-wiki/references/discover.md +3 -3
  283. package/template/.pi/skills/prototype-review/SKILL.md +4 -4
  284. package/template/.pi/skills/setup-matt-pocock-skills/SKILL.md +10 -10
  285. package/template/.pi/skills/triage/SKILL.md +1 -1
  286. package/template/.pi/skills/yss-application/references/profiles/layered-mvc-service.md +1 -1
  287. package/template/.pi/skills/yss-application/references/profiles/mvc-data-analysis-v1.md +1 -1
  288. package/template/.pi/skills/yss-backend-spec-review/SKILL.md +1 -1
  289. package/template/.pi/skills/yss-backend-spec-review/references/check-inputs.md +1 -1
  290. package/template/.pi/skills/yss-cache/SKILL.md +6 -5
  291. package/template/.pi/skills/yss-cache/references/annotations.md +3 -1
  292. package/template/.pi/skills/yss-cache/references/architecture.md +4 -2
  293. package/template/.pi/skills/yss-cache/references/configuration.md +6 -3
  294. package/template/.pi/skills/yss-cache/references/jetcache.md +21 -0
  295. package/template/.pi/skills/yss-cache/references/redis-fallback.md +5 -3
  296. package/template/.pi/skills/yss-cache/references/verification.md +10 -4
  297. package/template/.pi/skills/yss-cache/scripts/verify-cache-component.sh +26 -20
  298. package/template/.pi/skills/yss-ddd-scaffold-generator/SKILL.md +2 -2
  299. package/template/.pi/skills/yss-ddd-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  300. package/template/.pi/skills/yss-design-system/SKILL.md +10 -10
  301. package/template/.pi/skills/yss-design-system/references/design-qa-theme.md +3 -3
  302. package/template/.pi/skills/yss-design-system/references/design-system.md +3 -3
  303. package/template/.pi/skills/yss-distributed-id/SKILL.md +14 -58
  304. package/template/.pi/skills/yss-distributed-id/agents/openai.yaml +2 -2
  305. package/template/.pi/skills/yss-distributed-id/references/README.md +11 -47
  306. package/template/.pi/skills/yss-exception/SKILL.md +1 -1
  307. package/template/.pi/skills/yss-frontend-scaffold-generator/SKILL.md +2 -2
  308. package/template/.pi/skills/yss-frontend-scaffold-generator/scripts/generate_scaffold.mjs +1 -1
  309. package/template/.pi/skills/yss-frontend-scaffold-generator/scripts/refresh_baseline.mjs +2 -2
  310. package/template/.pi/skills/yss-implementation-contract-compiler/SKILL.md +9 -9
  311. package/template/.pi/skills/yss-implementation-contract-compiler/references/boundaries.md +1 -1
  312. package/template/.pi/skills/yss-implementation-contract-compiler/references/compiler-contract.yaml +9 -9
  313. package/template/.pi/skills/yss-implementation-contract-compiler/references/slice-implementation-contract-v2.md +3 -3
  314. package/template/.pi/skills/yss-implementation-contract-compiler/references/slice-implementation-contract.md +1 -1
  315. package/template/.pi/skills/yss-implementation-contract-compiler/references/strategic-handoff-routing.md +1 -1
  316. package/template/.pi/skills/yss-layered-mvc-scaffold-generator/SKILL.md +2 -2
  317. package/template/.pi/skills/yss-layered-mvc-scaffold-generator/scripts/data-analysis-profile.mjs +5 -5
  318. package/template/.pi/skills/yss-layered-mvc-scaffold-generator/scripts/generate_scaffold.mjs +2 -2
  319. package/template/.pi/skills/yss-layered-mvc-scaffold-generator/scripts/scaffold-generator.test.mjs +42 -0
  320. package/template/.pi/skills/yss-mybatis/SKILL.md +14 -2
  321. package/template/.pi/skills/yss-openapi-draft-review/SKILL.md +2 -2
  322. package/template/.pi/skills/yss-openapi-governance/SKILL.md +7 -7
  323. package/template/.pi/skills/yss-product-lifecycle/SKILL.md +11 -11
  324. package/template/.pi/skills/yss-product-lifecycle/references/matt-yss-adapter.md +5 -5
  325. package/template/.pi/skills/yss-product-lifecycle/references/orchestration-contract.yaml +70 -47
  326. package/template/.pi/skills/yss-product-lifecycle/references/orchestration.md +22 -14
  327. package/template/.pi/skills/yss-product-lifecycle/references/request-triage.md +2 -0
  328. package/template/.pi/skills/yss-product-lifecycle/references/state-model.md +11 -11
  329. package/template/.pi/skills/yss-product-lifecycle/references/user-decisions.md +2 -2
  330. package/template/.pi/skills/yss-prototype-stage/SKILL.md +9 -9
  331. package/template/.pi/skills/yss-prototype-stage/references/existing-ui-entry.md +1 -1
  332. package/template/.pi/skills/yss-prototype-stage/scripts/build-antd-prototype.mjs +1 -1
  333. package/template/.pi/skills/yss-prototype-stage/scripts/offline-html.mjs +3 -3
  334. package/template/.pi/skills/yss-prototype-stage/tests/browser-smoke.mjs +2 -2
  335. package/template/.pi/skills/yss-prototype-stage/tests/run-scenarios.mjs +4 -4
  336. package/template/.pi/skills/yss-prototype-stage/tests/workbench-smoke.mjs +1 -1
  337. package/template/.pi/skills/yss-repository/SKILL.md +3 -2
  338. package/template/.pi/skills/yss-repository/references/profiles/layered-mvc-service.md +1 -1
  339. package/template/.pi/skills/yss-repository/references/profiles/mvc-data-analysis-v1.md +1 -1
  340. package/template/.pi/skills/yss-repository/tests/profile-routing.test.mjs +2 -2
  341. package/template/.pi/skills/yss-research/SKILL.md +2 -2
  342. package/template/.pi/skills/yss-skill-source-index-refresh/references/backend-component-platform-compatibility.md +1 -1
  343. package/template/.pi/skills/yss-stage-decision/SKILL.md +5 -5
  344. package/template/.pi/skills/yss-stage-decision/references/domain-strategy-contract.md +1 -1
  345. package/template/.pi/skills/yss-stage-decision/references/strategic-handoff-routing.md +1 -1
  346. package/template/.pi/skills/yss-tactical-design/SKILL.md +2 -2
  347. package/template/.pi/skills/yss-tactical-design/references/strategic-handoff-routing.md +1 -1
  348. package/template/.pi/skills/yss-tactical-design/references/tactical-design-contract.md +1 -1
  349. package/template/.pi/skills/yss-technical-design/SKILL.md +6 -6
  350. package/template/.pi/skills/yss-technical-design/references/technical-design-contract.md +1 -1
  351. package/template/.pi/skills/yss-ui/SKILL.md +1 -1
  352. package/template/.pi/skills/yss-up-springboot3/SKILL.md +1 -1
  353. package/template/.pi/skills/yss-web-controller/SKILL.md +1 -1
  354. package/template/.pi/skills/yss-web-controller/references/profiles/layered-mvc-service.md +1 -1
  355. package/template/{docs → .template-spec}/adr/README.md +1 -1
  356. package/template/{docs → .template-spec}/agents/README.md +1 -1
  357. package/template/{docs → .template-spec}/agents/backend-architecture-profiles.md +2 -2
  358. package/template/{docs → .template-spec}/agents/digital-human-roles.md +6 -6
  359. package/template/{docs → .template-spec}/agents/digital-human-roles.yaml +5 -5
  360. package/template/{docs → .template-spec}/agents/gitlab-workflow-skills.md +2 -2
  361. package/template/{docs → .template-spec}/agents/issue-tracker.md +1 -1
  362. package/template/{docs → .template-spec}/agents/skill-migrations.md +6 -2
  363. package/template/{docs → .template-spec}/agents/triage-labels.md +1 -1
  364. package/template/{docs → .template-spec}/agents/yss-skill-registry.yaml +9 -8
  365. package/template/{docs → .template-spec}/architecture/README.md +3 -3
  366. package/template/{docs → .template-spec}/architecture/templates/tech-design-template.md +3 -1
  367. package/template/{docs → .template-spec}/design/README.md +12 -12
  368. package/template/{docs → .template-spec}/design/design.md +20 -20
  369. package/template/{docs/design/templates/interaction-spec-template.md → .template-spec/design/templates/examples/model-publishing-interaction.example.md} +6 -4
  370. package/template/{docs/design/templates/state-matrix-template.md → .template-spec/design/templates/examples/model-publishing-state-matrix.example.md} +3 -1
  371. package/template/.template-spec/design/templates/interaction-spec-template.md +61 -0
  372. package/template/{docs → .template-spec}/design/templates/product-overview-design-template.md +11 -11
  373. package/template/{docs → .template-spec}/design/templates/prototype-evidence-template.yaml +4 -4
  374. package/template/{docs → .template-spec}/design/templates/prototype-review-checklist.md +1 -1
  375. package/template/.template-spec/design/templates/state-matrix-template.md +29 -0
  376. package/template/.template-spec/design/tokens/.design-md-projection.json +13 -0
  377. package/template/{docs → .template-spec}/engineering/backend-platforms.md +1 -1
  378. package/template/{docs → .template-spec}/plan/entry-review.md +8 -4
  379. package/template/{docs → .template-spec}/plan/templates/plan-template.md +1 -1
  380. package/template/{docs → .template-spec}/process/contract-reading.md +1 -1
  381. package/template/{docs → .template-spec}/process/lifecycle-artifact-map.md +5 -5
  382. package/template/.template-spec/process/lifecycle-registry-baseline.json +253 -0
  383. package/template/{docs → .template-spec}/process/lifecycle-registry.yaml +19 -12
  384. package/template/{docs → .template-spec}/process/plan-migration.md +1 -1
  385. package/template/{docs → .template-spec}/process/schemas/digital-human-task-package.schema.json +14 -1
  386. package/template/{docs → .template-spec}/process/schemas/lifecycle-checkpoint.schema.json +15 -0
  387. package/template/{docs → .template-spec}/process/schemas/lifecycle-registry.schema.json +1 -1
  388. package/template/{docs → .template-spec}/process/schemas/strategic-design-handoff-v3.schema.json +1 -1
  389. package/template/{docs → .template-spec}/process/schemas/strategic-design-handoff-v4.schema.json +1 -1
  390. package/template/{docs → .template-spec}/process/schemas/strategic-design-handoff-v5.schema.json +1 -1
  391. package/template/{docs → .template-spec}/process/schemas/strategic-design-handoff.schema.json +1 -1
  392. package/template/{docs → .template-spec}/process/stage-tracking.md +1 -1
  393. package/template/{docs → .template-spec}/process/subagent-collaboration.md +2 -2
  394. package/template/{docs → .template-spec}/templates/build-architecture-checklist-template.md +2 -2
  395. package/template/{docs → .template-spec}/templates/digital-human-runtime-profile-template.md +2 -2
  396. package/template/{docs → .template-spec}/templates/grok-bot-profile-template.md +1 -1
  397. package/template/{docs → .template-spec}/templates/local-parent-ticket-template.md +1 -1
  398. package/template/.template-spec/templates/release-note-template.md +29 -0
  399. package/template/.template-spec/templates/retro-report-template.md +24 -0
  400. package/template/{docs → .template-spec}/templates/subagent-task-package-template.md +3 -3
  401. package/template/.template-spec/templates/verification-record-template.md +64 -0
  402. package/template/{docs → .template-spec}/templates/vertical-slice-ticket-template.md +5 -10
  403. package/template/{docs → .template-spec}/user-guide//347/224/250/346/210/267/346/211/213/345/206/214.md +1 -1
  404. package/template/{docs → .template-spec}/user-guide//347/224/250/346/210/267/346/211/213/345/206/214/347/264/242/345/274/225.md +4 -4
  405. package/template/AGENTS.md +12 -12
  406. package/template/CONTEXT.md +3 -3
  407. package/template/README.md +22 -25
  408. package/template/scripts/backend-delivery +1 -1
  409. package/template/scripts/design-md +2 -0
  410. package/template/scripts/lib/api-contract-decision.mjs +1 -1
  411. package/template/scripts/lib/approved-execution-context.mjs +5 -5
  412. package/template/scripts/lib/backend-delivery.mjs +4 -4
  413. package/template/scripts/lib/backend-platform.mjs +1 -1
  414. package/template/scripts/lib/backend-review.mjs +1 -1
  415. package/template/scripts/lib/backend-scaffold-prerequisites.mjs +1 -1
  416. package/template/scripts/lib/backend-standards-coverage.mjs +2 -2
  417. package/template/scripts/lib/context-reconciliation.mjs +1 -1
  418. package/template/scripts/lib/contract-views.mjs +9 -9
  419. package/template/scripts/lib/delivery-preflight.mjs +6 -6
  420. package/template/scripts/lib/design-md.mjs +230 -0
  421. package/template/scripts/lib/digital-human-roles.mjs +2 -2
  422. package/template/scripts/lib/existing-backend-architecture.mjs +1 -1
  423. package/template/scripts/lib/existing-ui-baseline.mjs +1 -1
  424. package/template/scripts/lib/frontend-delivery.mjs +2 -2
  425. package/template/scripts/lib/governance-layout.mjs +74 -0
  426. package/template/scripts/lib/harness-execution-scope.mjs +2 -2
  427. package/template/scripts/lib/lifecycle-context-query.mjs +11 -3
  428. package/template/scripts/lib/lifecycle-registry.mjs +46 -7
  429. package/template/scripts/lib/lifecycle-status.mjs +111 -0
  430. package/template/scripts/lib/lifecycle-transition.mjs +71 -10
  431. package/template/scripts/lib/openapi-draft-validation.mjs +1 -1
  432. package/template/scripts/lib/plan-spec-entry-view.mjs +48 -0
  433. package/template/scripts/lib/plan-spec-entry.mjs +3 -3
  434. package/template/scripts/lib/skill-registry.mjs +16 -9
  435. package/template/scripts/lib/skill-supply-chain.mjs +34 -15
  436. package/template/scripts/lib/slice-contract-preparation.mjs +3 -3
  437. package/template/scripts/lib/slice-contract.mjs +1 -1
  438. package/template/scripts/lib/slice-repositories.mjs +1 -1
  439. package/template/scripts/lib/slice-task-package.mjs +3 -3
  440. package/template/scripts/lib/stage-tracking-migration.mjs +2 -2
  441. package/template/scripts/lib/stage-tracking.mjs +5 -5
  442. package/template/scripts/lib/strategic-feedback.mjs +2 -2
  443. package/template/scripts/lib/strategic-handoff-routing.mjs +2 -2
  444. package/template/scripts/lib/strategic-handoff.mjs +15 -15
  445. package/template/scripts/lib/task-package-schema.mjs +2 -2
  446. package/template/scripts/lib/task-package.mjs +1 -1
  447. package/template/scripts/lib/technical-design-boundary.mjs +1 -1
  448. package/template/scripts/lib/user-decision.mjs +2 -1
  449. package/template/scripts/lifecycle-status +14 -0
  450. package/template/scripts/plan-spec-entry +21 -0
  451. package/template/scripts/strategic-consumer-entry +1 -1
  452. package/template/scripts/strategic-handoff +1 -1
  453. package/template/scripts/verify-frontend-implementation-evidence +1 -1
  454. package/template/scripts/verify-governance-layout +15 -0
  455. package/template/scripts/verify-lifecycle-checkpoint +1 -1
  456. package/template/scripts/verify-project-instance +13 -10
  457. package/template/scripts/verify-scaffold-architecture-decisions +1 -1
  458. package/template/scripts/verify-strategic-context-import +3 -3
  459. package/template/skills-lock.json +80 -95
  460. package/template.manifest.json +30 -15
  461. package/template.snapshot.json +5 -5
  462. package/template/.agents/skills/grill-me/SKILL.md +0 -7
  463. package/template/.agents/skills/grill-me/agents/openai.yaml +0 -5
  464. package/template/.agents/skills/yss-distributed-id/assets/AutoIdInterceptor.java +0 -246
  465. package/template/.agents/skills/yss-distributed-id/assets/EnableDistributedId.java +0 -25
  466. package/template/.agents/skills/yss-distributed-id/assets/LeafConf.java +0 -36
  467. package/template/.codex/skills/grill-me/SKILL.md +0 -7
  468. package/template/.codex/skills/grill-me/agents/openai.yaml +0 -5
  469. package/template/.codex/skills/yss-distributed-id/assets/AutoIdInterceptor.java +0 -246
  470. package/template/.codex/skills/yss-distributed-id/assets/EnableDistributedId.java +0 -25
  471. package/template/.codex/skills/yss-distributed-id/assets/LeafConf.java +0 -36
  472. package/template/.cursor/skills/grill-me/SKILL.md +0 -7
  473. package/template/.cursor/skills/grill-me/agents/openai.yaml +0 -5
  474. package/template/.cursor/skills/yss-distributed-id/assets/AutoIdInterceptor.java +0 -246
  475. package/template/.cursor/skills/yss-distributed-id/assets/EnableDistributedId.java +0 -25
  476. package/template/.cursor/skills/yss-distributed-id/assets/LeafConf.java +0 -36
  477. package/template/.pi/skills/grill-me/SKILL.md +0 -7
  478. package/template/.pi/skills/grill-me/agents/openai.yaml +0 -5
  479. package/template/.pi/skills/yss-distributed-id/assets/AutoIdInterceptor.java +0 -246
  480. package/template/.pi/skills/yss-distributed-id/assets/EnableDistributedId.java +0 -25
  481. package/template/.pi/skills/yss-distributed-id/assets/LeafConf.java +0 -36
  482. package/template/docs/agents/archify-integration.md +0 -19
  483. package/template/docs/agents/yss-plugin-dependency-contract.md +0 -45
  484. package/template/docs/api/.gitkeep +0 -0
  485. package/template/docs/api/specs/.gitkeep +0 -0
  486. package/template/docs/architecture/.gitkeep +0 -0
  487. package/template/docs/design/design-system-sync.yaml +0 -13
  488. package/template/docs/design/facts/antdv-next/1.5.2/cli-help.txt +0 -38
  489. package/template/docs/design/facts/antdv-next/1.5.2/component-list.json +0 -434
  490. package/template/docs/design/facts/antdv-next/1.5.2/components/Alert/demo-basic.json +0 -7
  491. package/template/docs/design/facts/antdv-next/1.5.2/components/Alert/info.json +0 -246
  492. package/template/docs/design/facts/antdv-next/1.5.2/components/Alert/semantic.json +0 -40
  493. package/template/docs/design/facts/antdv-next/1.5.2/components/Alert/token.json +0 -32
  494. package/template/docs/design/facts/antdv-next/1.5.2/components/Button/demo-basic.json +0 -7
  495. package/template/docs/design/facts/antdv-next/1.5.2/components/Button/info.json +0 -190
  496. package/template/docs/design/facts/antdv-next/1.5.2/components/Button/semantic.json +0 -20
  497. package/template/docs/design/facts/antdv-next/1.5.2/components/Button/token.json +0 -256
  498. package/template/docs/design/facts/antdv-next/1.5.2/components/Input/demo-basic.json +0 -7
  499. package/template/docs/design/facts/antdv-next/1.5.2/components/Input/info.json +0 -460
  500. package/template/docs/design/facts/antdv-next/1.5.2/components/Input/semantic.json +0 -70
  501. package/template/docs/design/facts/antdv-next/1.5.2/components/Input/token.json +0 -123
  502. package/template/docs/design/facts/antdv-next/1.5.2/components/Modal/demo-basic.json +0 -7
  503. package/template/docs/design/facts/antdv-next/1.5.2/components/Modal/info.json +0 -646
  504. package/template/docs/design/facts/antdv-next/1.5.2/components/Modal/semantic.json +0 -50
  505. package/template/docs/design/facts/antdv-next/1.5.2/components/Modal/token.json +0 -130
  506. package/template/docs/design/facts/antdv-next/1.5.2/components/Select/demo-basic.json +0 -7
  507. package/template/docs/design/facts/antdv-next/1.5.2/components/Select/info.json +0 -640
  508. package/template/docs/design/facts/antdv-next/1.5.2/components/Select/semantic.json +0 -70
  509. package/template/docs/design/facts/antdv-next/1.5.2/components/Select/token.json +0 -172
  510. package/template/docs/design/facts/antdv-next/1.5.2/components/Table/demo-basic.json +0 -7
  511. package/template/docs/design/facts/antdv-next/1.5.2/components/Table/info.json +0 -1010
  512. package/template/docs/design/facts/antdv-next/1.5.2/components/Table/semantic.json +0 -70
  513. package/template/docs/design/facts/antdv-next/1.5.2/components/Table/token.json +0 -263
  514. package/template/docs/design/facts/antdv-next/1.5.2/components/Tag/demo-basic.json +0 -7
  515. package/template/docs/design/facts/antdv-next/1.5.2/components/Tag/info.json +0 -321
  516. package/template/docs/design/facts/antdv-next/1.5.2/components/Tag/semantic.json +0 -25
  517. package/template/docs/design/facts/antdv-next/1.5.2/components/Tag/token.json +0 -25
  518. package/template/docs/design/facts/antdv-next/1.5.2/design-md.json +0 -3
  519. package/template/docs/design/facts/antdv-next/1.5.2/manifest.json +0 -215
  520. package/template/docs/design/facts/antdv-next/1.5.2/resolution-probe.json +0 -5
  521. package/template/docs/design/preview-dark.html +0 -178
  522. package/template/docs/design/preview.css +0 -730
  523. package/template/docs/design/preview.html +0 -178
  524. package/template/docs/design/preview.js +0 -71
  525. package/template/docs/design/prototypes/.gitkeep +0 -1
  526. package/template/docs/design/tokens/.design-md-projection.json +0 -13
  527. package/template/docs/implementation/.gitkeep +0 -1
  528. package/template/docs/plan/IDEATION.md +0 -96
  529. package/template/docs/process/MATT-POCOCK-ENGINEERING-SKILLS.md +0 -13
  530. package/template/docs/process/PDCA-SCRUM.md +0 -10
  531. package/template/docs/process/github-workflows.md +0 -52
  532. package/template/docs/process/harness-executive-blueprint.md +0 -10
  533. package/template/docs/releases/.gitkeep +0 -1
  534. package/template/docs/requirements/README.md +0 -85
  535. package/template/docs/requirements/tickets/.gitkeep +0 -1
  536. package/template/docs/templates/agent-brief-template.md +0 -46
  537. package/template/docs/templates/architecture-proposal-template.md +0 -18
  538. package/template/docs/templates/implementation-plan-template.md +0 -16
  539. package/template/docs/templates/implementation-routing-template.md +0 -350
  540. package/template/docs/templates/release-note-template.md +0 -14
  541. package/template/docs/templates/requirement-freeze-template.md +0 -63
  542. package/template/docs/templates/retro-report-template.md +0 -16
  543. package/template/docs/templates/risk-register-template.md +0 -11
  544. package/template/docs/templates/user-story-template.md +0 -20
  545. package/template/docs/templates/verification-record-template.md +0 -53
  546. package/template/docs/testing/README.md +0 -110
  547. /package/template/{docs → .template-spec}/agents/domain.md +0 -0
  548. /package/template/{docs → .template-spec}/api/templates/openapi-draft-review-checklist.md +0 -0
  549. /package/template/{docs → .template-spec}/api/templates/openapi-draft-validation-record-template.yaml +0 -0
  550. /package/template/{docs → .template-spec}/api/templates/openapi-freeze-record-template.md +0 -0
  551. /package/template/{docs → .template-spec}/api/templates/openapi-json-export-record-template.md +0 -0
  552. /package/template/{docs → .template-spec}/architecture/templates/architecture-deepening-template.md +0 -0
  553. /package/template/{docs → .template-spec}/architecture/templates/architecture-review-checklist.md +0 -0
  554. /package/template/{docs → .template-spec}/architecture/templates/business-architecture-template.md +0 -0
  555. /package/template/{docs → .template-spec}/architecture/templates/data-architecture-template.md +0 -0
  556. /package/template/{docs → .template-spec}/architecture/templates/engineering-baseline-review-template.md +0 -0
  557. /package/template/{docs → .template-spec}/architecture/templates/functional-architecture-template.md +0 -0
  558. /package/template/{docs → .template-spec}/architecture/templates/system-overview-design-template.md +0 -0
  559. /package/template/{docs → .template-spec}/design/diagrams/README.md +0 -0
  560. /package/template/{docs → .template-spec}/design/schemas/visual-baseline.schema.json +0 -0
  561. /package/template/{docs → .template-spec}/design/templates/prototype-confirmation-template.md +0 -0
  562. /package/template/{docs → .template-spec}/design/templates/visual-baseline-template.yaml +0 -0
  563. /package/template/{docs → .template-spec}/design/tokens/theme.json +0 -0
  564. /package/template/{docs → .template-spec}/design/tokens/tokens.compact.json +0 -0
  565. /package/template/{docs → .template-spec}/design/tokens/tokens.dark.json +0 -0
  566. /package/template/{docs → .template-spec}/design/tokens/tokens.default.json +0 -0
  567. /package/template/{docs → .template-spec}/design/tokens/variables.css +0 -0
  568. /package/template/{docs → .template-spec}/design/tokens/variables.dark.css +0 -0
  569. /package/template/{docs → .template-spec}/engineering/backend-platforms.json +0 -0
  570. /package/template/{docs → .template-spec}/plan/README.md +0 -0
  571. /package/template/{docs → .template-spec}/plan/templates/competitive-analysis-template.md +0 -0
  572. /package/template/{docs → .template-spec}/plan/templates/competitive-matrix-template.md +0 -0
  573. /package/template/{docs → .template-spec}/plan/templates/market-analysis-template.md +0 -0
  574. /package/template/{docs → .template-spec}/plan/templates/user-pain-points-template.md +0 -0
  575. /package/template/{docs → .template-spec}/process/delivery-preflight.md +0 -0
  576. /package/template/{docs → .template-spec}/process/document-writing.md +0 -0
  577. /package/template/{docs → .template-spec}/process/existing-backend-architecture.md +0 -0
  578. /package/template/{docs → .template-spec}/process/existing-ui-baseline.md +0 -0
  579. /package/template/{docs → .template-spec}/process/frontend-backend-delivery.md +0 -0
  580. /package/template/{docs → .template-spec}/process/harness-process-tailoring.md +0 -0
  581. /package/template/{docs → .template-spec}/process/implementation-repo-integration.md +0 -0
  582. /package/template/{docs/process/lifecycle-registry-baseline.json → .template-spec/process/lifecycle-registry-baseline-v1.json} +0 -0
  583. /package/template/{docs → .template-spec}/process/schemas/api-contract-decision-v2.schema.json +0 -0
  584. /package/template/{docs → .template-spec}/process/schemas/api-contract-decision.schema.json +0 -0
  585. /package/template/{docs → .template-spec}/process/schemas/backend-architecture-identity.schema.json +0 -0
  586. /package/template/{docs → .template-spec}/process/schemas/backend-delivery-verification.schema.json +0 -0
  587. /package/template/{docs → .template-spec}/process/schemas/backend-delivery.schema.json +0 -0
  588. /package/template/{docs → .template-spec}/process/schemas/context-reconciliation.schema.json +0 -0
  589. /package/template/{docs → .template-spec}/process/schemas/data-architecture-decision.schema.json +0 -0
  590. /package/template/{docs → .template-spec}/process/schemas/delivery-preflight-input.schema.json +0 -0
  591. /package/template/{docs → .template-spec}/process/schemas/delivery-preflight-result.schema.json +0 -0
  592. /package/template/{docs → .template-spec}/process/schemas/existing-ui-baseline.schema.json +0 -0
  593. /package/template/{docs → .template-spec}/process/schemas/frontend-delivery-acceptance-v1.schema.json +0 -0
  594. /package/template/{docs → .template-spec}/process/schemas/frontend-delivery-acceptance-v3.schema.json +0 -0
  595. /package/template/{docs → .template-spec}/process/schemas/frontend-delivery-acceptance.schema.json +0 -0
  596. /package/template/{docs → .template-spec}/process/schemas/frontend-implementation-evidence.schema.json +0 -0
  597. /package/template/{docs → .template-spec}/process/schemas/frontend-strategic-preflight-v2.schema.json +0 -0
  598. /package/template/{docs → .template-spec}/process/schemas/frontend-strategic-preflight.schema.json +0 -0
  599. /package/template/{docs → .template-spec}/process/schemas/implementation-repository-preparation-result.schema.json +0 -0
  600. /package/template/{docs → .template-spec}/process/schemas/openapi-draft-validation-record.schema.json +0 -0
  601. /package/template/{docs → .template-spec}/process/schemas/project-scaffold-contract.schema.json +0 -0
  602. /package/template/{docs → .template-spec}/process/schemas/review-bundle.schema.json +0 -0
  603. /package/template/{docs → .template-spec}/process/schemas/scaffold-architecture-decisions.schema.json +0 -0
  604. /package/template/{docs → .template-spec}/process/schemas/slice-implementation-contract-v3.schema.json +0 -0
  605. /package/template/{docs → .template-spec}/process/schemas/stage-tracking.schema.json +0 -0
  606. /package/template/{docs → .template-spec}/process/schemas/strategic-consumer-feedback.schema.json +0 -0
  607. /package/template/{docs → .template-spec}/process/schemas/strategic-feedback-adjudication.schema.json +0 -0
  608. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-delivery-verification.schema.json +0 -0
  609. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-delivery.schema.json +0 -0
  610. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-domain-strategy-v3.schema.json +0 -0
  611. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-domain-strategy.schema.json +0 -0
  612. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-export-v2.schema.json +0 -0
  613. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-export.schema.json +0 -0
  614. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-import-receipt-v3.schema.json +0 -0
  615. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-import-receipt.schema.json +0 -0
  616. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-package.schema.json +0 -0
  617. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-stage-decision-package-v3.schema.json +0 -0
  618. /package/template/{docs → .template-spec}/process/schemas/strategic-handoff-stage-decision-package.schema.json +0 -0
  619. /package/template/{docs → .template-spec}/process/schemas/subagent-task-package.schema.json +0 -0
  620. /package/template/{docs → .template-spec}/process/schemas/user-decision.schema.json +0 -0
  621. /package/template/{docs → .template-spec}/process/strategic-handoff-package.md +0 -0
  622. /package/template/{docs → .template-spec}/process/templates/context-reconciliation-template.yaml +0 -0
  623. /package/template/{docs → .template-spec}/process/templates/frontend-implementation-plan-template.yaml +0 -0
  624. /package/template/{docs → .template-spec}/process/templates/frontend-implementation-verification-template.yaml +0 -0
  625. /package/template/{docs → .template-spec}/process/templates/lifecycle-checkpoint-template.yaml +0 -0
  626. /package/template/{docs → .template-spec}/process/templates/scaffold-architecture-decisions-template.yaml +0 -0
  627. /package/template/{docs → .template-spec}/process/templates/stage-checkpoint-template.md +0 -0
  628. /package/template/{docs → .template-spec}/process/templates/user-decision-template.yaml +0 -0
  629. /package/template/{docs → .template-spec}/templates/adr-template.md +0 -0
  630. /package/template/{docs → .template-spec}/templates/approval-record-template.yaml +0 -0
  631. /package/template/{docs → .template-spec}/templates/cross-repo-slice-template.md +0 -0
  632. /package/template/{docs → .template-spec}/templates/examples/lifecycle-writing-examples.md +0 -0
  633. /package/template/{docs → .template-spec}/templates/implementation-repo-registry-template.md +0 -0
  634. /package/template/{docs → .template-spec}/templates/openapi-spec-template.yaml +0 -0
  635. /package/template/{docs → .template-spec}/templates/review-bundle-template.yaml +0 -0
  636. /package/template/{docs → .template-spec}/templates/review-report-template.md +0 -0
  637. /package/template/{docs → .template-spec}/templates/spec-delta-template.md +0 -0
  638. /package/template/{docs → .template-spec}/templates/spec-template.md +0 -0
  639. /package/template/{docs → .template-spec}/user-guide/yss-ui-mcp.md +0 -0
  640. /package/template/{docs → .template-spec}/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" +0 -0
  641. /package/template/{docs → .template-spec}/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" +0 -0
  642. /package/template/{docs → .template-spec}/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" +0 -0
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ const fs = require("node:fs");
4
+ const path = require("node:path");
5
+ const { ASSET_PROFILE, INITIAL_STAGES } = require("./asset-runtime");
6
+
7
+ const RUNTIMES = Object.freeze({ codex: ".codex/skills", cursor: ".cursor/skills", pi: ".pi/skills" });
8
+ const OMIT_INSTANCE_PATHS = [
9
+ ".template-source/process/github-workflows.md",
10
+ ".template-spec/process/harness-executive-blueprint.md",
11
+ ".template-spec/process/PDCA-SCRUM.md",
12
+ ".template-spec/design/preview.html", ".template-spec/design/preview.css", ".template-spec/design/preview.js", ".template-spec/design/preview-dark.html",
13
+ ".template-spec/design/facts/antdv-next", ".template-spec/user-guide/设备借用贯穿案例.md",
14
+ ".template-spec/design/design-system-sync.yaml",
15
+ ];
16
+
17
+ function readDistributionRegistry(templateRoot) {
18
+ const registry = fs.readFileSync(path.join(templateRoot, ".template-spec/agents/yss-skill-registry.yaml"), "utf8");
19
+ const match = registry.match(/^instance_distribution:\n([\s\S]*?)(?=^[^\s#][^\n]*:\s*$)/m);
20
+ if (!match) throw new Error("Skill 注册表缺少 instance_distribution");
21
+ const initial = match[1].match(/^ initial_skills: \[([^\]]+)\]/m);
22
+ if (!initial) throw new Error("Skill 注册表缺少 initial_skills");
23
+ return {
24
+ initialSkills: initial[1].split(",").map((item) => item.trim()),
25
+ text: registry,
26
+ };
27
+ }
28
+
29
+ function assertRuntime(runtime) {
30
+ if (!Object.hasOwn(RUNTIMES, runtime)) throw new Error(`--agent-runtime 必须是 ${Object.keys(RUNTIMES).join("| ")}`);
31
+ return runtime;
32
+ }
33
+
34
+ function distributionForVariables(variables, templateRoot) {
35
+ if (variables.distribution?.mode === "legacy-all") return { mode: "legacy-all" };
36
+ if (variables.distribution?.mode === "selected") return variables.distribution;
37
+ const runtime = assertRuntime(variables.agentRuntime);
38
+ return {
39
+ mode: "selected",
40
+ runtimes: [runtime],
41
+ installedSkills: [...readDistributionRegistry(templateRoot).initialSkills],
42
+ assetProfile: ASSET_PROFILE,
43
+ installedStages: [...INITIAL_STAGES],
44
+ resourceSkills: [],
45
+ };
46
+ }
47
+
48
+ function isIncludedInstancePath(relativePath, distribution) {
49
+ if (distribution.mode === "legacy-all") return true;
50
+ if (relativePath === ".cursorrules" && !distribution.runtimes.includes("cursor")) return false;
51
+ if (OMIT_INSTANCE_PATHS.some((excluded) => relativePath === excluded || relativePath.startsWith(`${excluded}/`))) return false;
52
+ if (distribution.assetProfile === ASSET_PROFILE &&
53
+ (relativePath.startsWith(".template-spec/") || relativePath.startsWith("scripts/") || relativePath.startsWith(".vscode/"))) {
54
+ return distribution.assetPaths.has(relativePath) ||
55
+ [...distribution.assetPaths].some((ref) => ref.startsWith(`${relativePath}/`));
56
+ }
57
+ for (const [runtime, root] of Object.entries(RUNTIMES)) {
58
+ const runtimeRoot = root.split("/")[0];
59
+ if (relativePath === runtimeRoot || relativePath.startsWith(`${runtimeRoot}/`)) {
60
+ if (!distribution.runtimes.includes(runtime)) return false;
61
+ if (relativePath.startsWith(`${root}/`)) {
62
+ const name = relativePath.slice(root.length + 1).split("/")[0];
63
+ if (name && !name.startsWith(".") && !distribution.installedSkills.includes(name)) return false;
64
+ }
65
+ }
66
+ }
67
+ if (relativePath.startsWith(".agents/skills/")) {
68
+ const name = relativePath.slice(".agents/skills/".length).split("/")[0];
69
+ if (name && !name.startsWith(".") && !distribution.installedSkills.includes(name)) return false;
70
+ }
71
+ return true;
72
+ }
73
+
74
+ function selectedSkillLock(sourceText, distribution) {
75
+ if (distribution.mode === "legacy-all") return sourceText;
76
+ const source = JSON.parse(sourceText);
77
+ const roots = distribution.runtimes.map((runtime) => RUNTIMES[assertRuntime(runtime)]);
78
+ source.projectionRoots = roots;
79
+ source.skills.shared = Object.fromEntries(Object.entries(source.skills.shared).filter(([name]) => distribution.installedSkills.includes(name)).map(([name, record]) => [name, { ...record, targets: [".agents/skills", ...roots] }]));
80
+ source.skills.platform = Object.fromEntries(roots.map((root) => [root, Object.fromEntries(Object.entries(source.skills.platform?.[root] || {}).filter(([name]) => distribution.installedSkills.includes(name)))]).filter(([, entries]) => Object.keys(entries).length));
81
+ return `${JSON.stringify(source, null, 2)}\n`;
82
+ }
83
+
84
+ function renderInstanceSkillSupplyChain(sourceText) {
85
+ const additions = `\nfunction projectionRootsFor(lock) {
86
+ const identityPath = path.join(ROOT, "yss-project.yaml");
87
+ const isInstance = existsSync(identityPath) && /^repository_mode:\\s*project-instance\\s*$/m.test(readFileSync(identityPath, "utf8"));
88
+ if (!isInstance) return PROJECTION_ROOTS;
89
+ const roots = lock?.projectionRoots;
90
+ if (!Array.isArray(roots) || !roots.length || roots.some((root) => !PROJECTION_ROOTS.includes(root))) throw new TypeError("project-instance skills-lock.json 缺少有效 projectionRoots");
91
+ return [...new Set(roots)];
92
+ }\n`;
93
+ const marker = 'export const PROJECTION_ROOTS = [".codex/skills", ".cursor/skills", ".pi/skills"];';
94
+ if (!sourceText.includes(marker)) throw new Error("Skill 投影脚本分发基线已变化");
95
+ return sourceText.replace(marker, marker + additions)
96
+ .replace(" const shared = sharedFromLock(lock);", " const shared = sharedFromLock(lock);\n const projectionRoots = projectionRootsFor(lock);")
97
+ .replace(" const oldLock = parseLock(); const previous = priorMetadata(oldLock);", " const oldLock = parseLock(); const projectionRoots = projectionRootsFor(oldLock); const previous = priorMetadata(oldLock);")
98
+ .replaceAll("for (const root of PROJECTION_ROOTS) {", "for (const root of projectionRoots) {")
99
+ .replace("const targets = [\".agents/skills\", ...PROJECTION_ROOTS];", "const targets = [\".agents/skills\", ...projectionRoots];")
100
+ .replace("projectionRoots: PROJECTION_ROOTS, sources, skills", "projectionRoots, sources, skills");
101
+ }
102
+
103
+ function renderInstanceDesignSkillFile(sourceText) {
104
+ return sourceText
105
+ .replaceAll("node .template-source/tooling/node/scripts/design-md.mjs", "scripts/design-md")
106
+ .replace("运行前先更新 `.template-spec/design/design-system-sync.yaml` 的规范源摘要。", "项目实例无需模板间的 design-system-sync 摘要。")
107
+ .replace("修改根 DESIGN.md → 更新 design-system-sync.yaml 摘要 →", "修改根 DESIGN.md →");
108
+ }
109
+
110
+ function linkedSkillDependencies(templateRoot, name) {
111
+ const skillRoot = path.join(templateRoot, ".agents/skills");
112
+ const current = path.join(skillRoot, name);
113
+ const result = new Set();
114
+ function visitDir(directory) {
115
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
116
+ const file = path.join(directory, entry.name);
117
+ if (entry.isDirectory()) visitDir(file);
118
+ else if (entry.isFile() && entry.name.endsWith(".md")) {
119
+ const content = fs.readFileSync(file, "utf8");
120
+ for (const match of content.matchAll(/\[[^\]]+\]\(([^)]+)\)/g)) {
121
+ const ref = match[1].split("#")[0];
122
+ if (!ref || ref.startsWith("/") || ref.includes("://")) continue;
123
+ const resolved = path.resolve(path.dirname(file), ref);
124
+ const relative = path.relative(skillRoot, resolved).split(path.sep);
125
+ if (relative.length > 1 && relative[0] !== name && !relative[0].startsWith(".") && !relative[0].includes("..") && fs.existsSync(resolved)) result.add(relative[0]);
126
+ }
127
+ }
128
+ }
129
+ }
130
+ visitDir(current);
131
+ return [...result];
132
+ }
133
+
134
+ function requiredSkills(registryText, requested, triggers = [], templateRoot = null) {
135
+ const skillBlock = registryText.split(/^skills:\s*$/m)[1]?.split(/^platform_skills:\s*$/m)[0] || "";
136
+ const available = new Set([...skillBlock.matchAll(/^ - (?:\{ )?id: ([a-z][a-z0-9-]+)/gm)].map((match) => match[1]));
137
+ const platformBlock = registryText.split(/^platform_skills:\s*$/m)[1]?.split(/^external_skills:\s*$/m)[0] || "";
138
+ const platformSkills = new Set([...platformBlock.matchAll(/^ - id: ([a-z][a-z0-9-]+)/gm)].map((match) => match[1]));
139
+ const block = registryText.split(/^skill_dependencies:\s*$/m)[1]?.split(/^[^\s#][^\n]*:\s*$/m)[0] || "";
140
+ const dependencies = new Map();
141
+ let current = null;
142
+ for (const line of block.split("\n")) {
143
+ const header = line.match(/^ ([a-z][a-z0-9-]+):\s*$/);
144
+ if (header) { current = header[1]; continue; }
145
+ const item = line.match(/^ - \{ skill: ([a-z][a-z0-9-]+), type: ([a-z-]+)(?:, when: ([a-z0-9-]+))? \}/);
146
+ if (current && item) {
147
+ if (!dependencies.has(current)) dependencies.set(current, []);
148
+ dependencies.get(current).push({ name: item[1], type: item[2], when: item[3] });
149
+ }
150
+ }
151
+ const result = new Set();
152
+ function visit(name) {
153
+ if (!available.has(name)) throw new Error(platformSkills.has(name) ? `平台专属 Skill 不可作为共享 Skill 补装:${name}` : `Skill 未在注册表登记:${name}`);
154
+ if (result.has(name)) return;
155
+ result.add(name);
156
+ for (const dep of dependencies.get(name) || []) {
157
+ if (dep.type === "context-required" || (dep.type === "context-conditional" && triggers.includes(dep.when))) visit(dep.name);
158
+ }
159
+ if (templateRoot) for (const linked of linkedSkillDependencies(templateRoot, name)) visit(linked);
160
+ }
161
+ requested.forEach(visit);
162
+ return [...result].sort();
163
+ }
164
+
165
+ module.exports = { RUNTIMES, assertRuntime, readDistributionRegistry, distributionForVariables, isIncludedInstancePath, selectedSkillLock, renderInstanceSkillSupplyChain, renderInstanceDesignSkillFile, requiredSkills };
@@ -8,6 +8,8 @@ const { treeHash } = require("../template-hash");
8
8
  const { targetPath, pathKind, normalizeRelativePath } = require("../filesystem/path-utils");
9
9
  const { validateTemplateSnapshot } = require("../validation/snapshot");
10
10
  const { validateTemplateMetadata } = require("../validation/metadata");
11
+ const { distributionForVariables, isIncludedInstancePath, selectedSkillLock, renderInstanceSkillSupplyChain, renderInstanceDesignSkillFile } = require("./distribution-runtime");
12
+ const { ASSET_PROFILE, assetPaths } = require("./asset-runtime");
11
13
  const {
12
14
  extractManagedGitignoreBlock,
13
15
  mergeManagedGitignoreBlock,
@@ -29,7 +31,7 @@ const TEMPLATE_MANIFEST_TEXT = fs.readFileSync(BUNDLED_MANIFEST_PATH, "utf8");
29
31
  const TEMPLATE_MANIFEST = JSON.parse(TEMPLATE_MANIFEST_TEXT);
30
32
  const TEMPLATE_METADATA_FILENAME = ".yss-template.json";
31
33
  const TEMPLATE_SOURCE = "github:iloveZzz/yss-spec-project-template";
32
- const METADATA_SCHEMA_VERSION = 2;
34
+ const METADATA_SCHEMA_VERSION = 3;
33
35
 
34
36
  const ROOT_EXCLUDED_ENTRIES = new Set(TEMPLATE_MANIFEST.excludeRootEntries);
35
37
  const ROOT_EXCLUDED_FILES = new Set(TEMPLATE_MANIFEST.excludeRootFiles);
@@ -47,8 +49,6 @@ const INIT_EXCLUDED_RELATIVE_PATHS = new Set(
47
49
  const RENDERED_RELATIVE_PATHS = new Set(TEMPLATE_MANIFEST.renderPaths);
48
50
  const EXAMPLE_DOC_PATHS = new Set(TEMPLATE_MANIFEST.exampleDocPaths);
49
51
 
50
- let bundledPathToLogicalPath = null;
51
-
52
52
  function sha256(value) {
53
53
  return crypto.createHash("sha256").update(value).digest("hex");
54
54
  }
@@ -79,16 +79,16 @@ function readTemplateSnapshot() {
79
79
  });
80
80
  }
81
81
 
82
- function logicalTemplatePath(bundledPath) {
83
- if (bundledPathToLogicalPath === null) {
84
- const snapshot = readTemplateSnapshot();
85
- bundledPathToLogicalPath = new Map(
86
- Object.entries(snapshot.encodedPaths || {}).map(([logicalPath, encodedPath]) => [
87
- normalizeRelativePath(encodedPath),
88
- normalizeRelativePath(logicalPath),
89
- ]),
90
- );
91
- }
82
+ function logicalPathMap(snapshot) {
83
+ return new Map(
84
+ Object.entries(snapshot.encodedPaths || {}).map(([logicalPath, encodedPath]) => [
85
+ normalizeRelativePath(encodedPath),
86
+ normalizeRelativePath(logicalPath),
87
+ ]),
88
+ );
89
+ }
90
+
91
+ function logicalTemplatePath(bundledPath, bundledPathToLogicalPath) {
92
92
  return (
93
93
  bundledPathToLogicalPath.get(normalizeRelativePath(bundledPath)) ||
94
94
  normalizeRelativePath(bundledPath)
@@ -143,12 +143,35 @@ function readTargetIdentity(targetDir) {
143
143
  }
144
144
 
145
145
  function renderTemplateFile(relativePath, content, variables) {
146
+ const distribution = variables.distribution || distributionForVariables(variables, BUNDLED_TEMPLATE_ROOT);
147
+ if (relativePath === "skills-lock.json") return selectedSkillLock(content, distribution);
148
+ if (relativePath === "scripts/lib/skill-supply-chain.mjs" && distribution.mode === "selected") return renderInstanceSkillSupplyChain(content);
149
+ if (distribution.mode === "selected" && /^\.(agents|codex|cursor|pi)\/skills\/yss-design-system\/(SKILL\.md|references\/data-quality-theme\.md)$/.test(relativePath)) return renderInstanceDesignSkillFile(content);
150
+ if (relativePath === ".template-spec/engineering/backend-platforms.json" && distribution.mode === "selected") {
151
+ return content.replaceAll(".template-source/evidence/maintenance/2026-09-18-yss-backend-components/aliyun-artifact-resolution.json", "docs/engineering/evidence/aliyun-artifact-resolution.json");
152
+ }
153
+ if (relativePath === ".template-spec/agents/backend-architecture-profiles.md" && distribution.mode === "selected") {
154
+ return content.replace(/;依据见 `\.template-source\/evidence\/maintenance\/2026-09-12-existing-project-delivery\/maven-adapters-04\.json`/, ";适配验证证据保留在模板源,项目实例须对自身工程重新验证");
155
+ }
156
+ if (relativePath === ".template-spec/user-guide/用户手册.md" && distribution.mode === "selected") {
157
+ if (distribution.assetProfile !== ASSET_PROFILE) {
158
+ return `# ${variables.projectName} 用户手册\n\n本仓是 \`project-instance\`,用于 ${variables.businessDomain} 的研发资产。先阅读根 [AGENTS.md](../../AGENTS.md)、[CONTEXT.md](../../CONTEXT.md) 与 [生命周期资产索引](../process/lifecycle-artifact-map.md)。\n\n阶段派发前,由 Agent 运行 \`create-yss-spec skills ensure <skill-id...> --plan\` 核对依赖,再运行 \`--apply\` 安装。旧实例继续沿用既有文件分发范围;增加平台使用 \`create-yss-spec skills runtime add <codex|cursor|pi> --plan/--apply\`。CLI 快照必须与实例记录的模板提交一致;升级 CLI 后先运行 \`create-yss-spec sync\`。\n\n项目校验运行 \`scripts/verify-project-instance\`。\n`;
159
+ }
160
+ return `# ${variables.projectName} 用户手册\n\n本仓是 \`project-instance\`,用于 ${variables.businessDomain} 的研发资产。先阅读根 [AGENTS.md](../../AGENTS.md)、[CONTEXT.md](../../CONTEXT.md) 与 [生命周期资产索引](../process/lifecycle-artifact-map.md)。\n\n初始化安装分诊与 Plan 入口资产、三项入口 Skill 与所选 Agent 平台。进入后续阶段前,运行 \`create-yss-spec assets ensure <stage-id> --plan\` 核对文件,再运行 \`--apply\` 原子安装;专项 Skill 使用 \`create-yss-spec skills ensure <skill-id...> --plan/--apply\`,会补齐该 Skill 引用的实例文件。增加平台使用 \`create-yss-spec skills runtime add <codex|cursor|pi> --plan/--apply\`。CLI 快照必须与实例记录的模板提交一致;升级 CLI 后先运行 \`create-yss-spec sync\`。\n\n项目校验运行 \`scripts/verify-project-instance\`;实例 CI 应执行该命令和项目实际的构建、测试。\n`;
161
+ }
162
+ if (distribution.mode === "selected" && relativePath === ".template-spec/design/README.md") {
163
+ return content.replace(/^.*design-system-sync\.yaml.*\n/m, "");
164
+ }
165
+ if (distribution.mode === "selected" && relativePath.startsWith(".template-spec/user-guide/") && relativePath.endsWith(".md")) {
166
+ return content.replaceAll("[设备借用贯穿案例](设备借用贯穿案例.md)", "[项目用户手册](用户手册.md)")
167
+ .replaceAll("本仓是 `template-source`", "模板源是 `template-source`");
168
+ }
146
169
  if (relativePath === "yss-project.yaml") {
147
170
  return convertTemplateSourceToInstance(content);
148
171
  }
149
172
 
150
173
  if (relativePath === "AGENTS.md") {
151
- return content
174
+ const rendered = content
152
175
  .replace(
153
176
  /(\*\*项目名称:\*\*\s*)\[填写\]/,
154
177
  (_, prefix) => `${prefix}${variables.projectName}`,
@@ -161,10 +184,20 @@ function renderTemplateFile(relativePath, content, variables) {
161
184
  /(\*\*团队规模:\*\*\s*)\[填写\]/,
162
185
  (_, prefix) => `${prefix}${variables.teamSize}`,
163
186
  );
187
+ if (distribution.mode !== "selected") return rendered;
188
+ const base = rendered.replace(/## 4\. \`template-source\` 模板维护路由[\s\S]*?(?=## 5\.)/, "")
189
+ .replace(/\| 影响面、\`not-applicable\`、模板维护强度 \|[^\n]*\n/, "| 影响面与 `not-applicable` | `.template-spec/process/harness-process-tailoring.md` |\n");
190
+ const guidance = distribution.assetProfile === ASSET_PROFILE
191
+ ? "## 按需阶段资产与 Skill\n\n进入后续生命周期阶段前,运行 `create-yss-spec assets ensure <stage-id> --plan` 查看完整依赖,核对后运行 `--apply`。专项任务根据 .template-spec/agents/yss-skill-registry.yaml 选定 Skill,运行 `create-yss-spec skills ensure <skill-id...> --plan`,核对后运行 `--apply`。缺少阶段资产时先补装,不以缺文件推定门禁不适用。若 CLI 快照与实例模板提交不一致,先运行 `create-yss-spec sync`。\n"
192
+ : "## 按需 Skill\n\n此实例继续沿用原文件分发范围。阶段派发或专项任务开始前,根据 .template-spec/agents/yss-skill-registry.yaml 选定 Skill,运行 `create-yss-spec skills ensure <skill-id...> --plan`,核对后运行 `--apply`。若 CLI 快照与实例模板提交不一致,先运行 `create-yss-spec sync`。\n";
193
+ return `${base}\n${guidance}`;
164
194
  }
165
195
 
166
196
  if (relativePath === "README.md") {
167
- return `# ${variables.projectName}\n\n本仓库用于管理 ${variables.businessDomain} 的研发资产。\n\n- 默认 Issue Tracker:${variables.issueTracker}\n- 协作入口:[AGENTS.md](./AGENTS.md)\n- 业务词汇:[CONTEXT.md](./CONTEXT.md)\n- 用户指南:[docs/user-guide/用户手册.md](./docs/user-guide/用户手册.md)\n`;
197
+ const assetGuidance = distribution.assetProfile === ASSET_PROFILE
198
+ ? "后续阶段先运行 `create-yss-spec assets ensure <stage-id> --plan` 核对依赖,再运行 `--apply`;专项 Skill 使用 `create-yss-spec skills ensure <skill-id> --plan/--apply`。"
199
+ : "专项 Skill 使用 `create-yss-spec skills ensure <skill-id> --plan/--apply`。";
200
+ return `# ${variables.projectName}\n\n本仓库用于管理 ${variables.businessDomain} 的研发资产。\n\n- 默认 Issue Tracker:${variables.issueTracker}\n- Agent 平台:${distribution.mode === "selected" ? distribution.runtimes.join(", ") : "legacy-all"}\n- 协作入口:[AGENTS.md](./AGENTS.md)\n- 业务词汇:[CONTEXT.md](./CONTEXT.md)\n- 用户指南:[.template-spec/user-guide/用户手册.md](./.template-spec/user-guide/用户手册.md)\n\n项目校验:\`scripts/verify-project-instance\`。${assetGuidance}\n`;
168
201
  }
169
202
 
170
203
  if (relativePath === ".gitignore") return extractManagedGitignoreBlock(content);
@@ -178,6 +211,8 @@ function buildCopyPlan(
178
211
  variables,
179
212
  relativeDir = "",
180
213
  mode = "managed",
214
+ bundledPathToLogicalPath,
215
+ distribution = { mode: "legacy-all" },
181
216
  ) {
182
217
  const operations = [];
183
218
  const entries = fs.readdirSync(sourceDir, { withFileTypes: true });
@@ -188,9 +223,10 @@ function buildCopyPlan(
188
223
  const bundledRelativePath = relativeDir
189
224
  ? path.posix.join(relativeDir, entry.name)
190
225
  : entry.name;
191
- const relativePath = logicalTemplatePath(bundledRelativePath);
226
+ const relativePath = logicalTemplatePath(bundledRelativePath, bundledPathToLogicalPath);
192
227
 
193
228
  if (shouldExcludeRelativePath(relativePath, mode)) continue;
229
+ if (!isIncludedInstancePath(relativePath, distribution)) continue;
194
230
  if (!variables.includeExampleDocs && EXAMPLE_DOC_PATHS.has(relativePath)) continue;
195
231
 
196
232
  const sourcePath = path.join(sourceDir, entry.name);
@@ -205,6 +241,8 @@ function buildCopyPlan(
205
241
  variables,
206
242
  bundledRelativePath,
207
243
  mode,
244
+ bundledPathToLogicalPath,
245
+ distribution,
208
246
  ),
209
247
  );
210
248
  continue;
@@ -235,8 +273,9 @@ function buildSyncVariables(metadata) {
235
273
  issueTracker: variables.issueTracker || "github",
236
274
  includeExampleDocs:
237
275
  variables.includeExampleDocs === undefined
238
- ? true
276
+ ? !(metadata.metadataSchemaVersion >= 3)
239
277
  : Boolean(variables.includeExampleDocs),
278
+ distribution: metadata.metadataSchemaVersion >= 3 ? metadata.distribution : { mode: "legacy-all" },
240
279
  };
241
280
  }
242
281
 
@@ -254,15 +293,18 @@ function buildDesiredManagedFile(operation, variables) {
254
293
  };
255
294
  }
256
295
 
296
+ const desiredContent = fs.readFileSync(operation.sourcePath);
257
297
  return {
258
298
  ...operation,
259
- desiredContent: fs.readFileSync(operation.sourcePath),
260
- desiredHash: fileHash(operation.sourcePath),
299
+ desiredContent,
300
+ desiredHash: sha256(desiredContent),
261
301
  };
262
302
  }
263
303
 
264
- function buildDesiredManagedOperations(targetDir, variables, mode = "managed") {
265
- return buildCopyPlan(BUNDLED_TEMPLATE_ROOT, targetDir, variables, "", mode)
304
+ function buildDesiredManagedOperations(targetDir, variables, mode = "managed", snapshot = readTemplateSnapshot()) {
305
+ const distribution = variables.distribution || distributionForVariables(variables, BUNDLED_TEMPLATE_ROOT);
306
+ const effectiveDistribution = { ...distribution, assetPaths: assetPaths(BUNDLED_TEMPLATE_ROOT, distribution) };
307
+ return buildCopyPlan(BUNDLED_TEMPLATE_ROOT, targetDir, { ...variables, distribution }, "", mode, logicalPathMap(snapshot), effectiveDistribution)
266
308
  .filter((operation) => operation.type === "copy" || operation.type === "render")
267
309
  .map((operation) => buildDesiredManagedFile(operation, variables));
268
310
  }
@@ -297,9 +339,9 @@ function adaptGitignoreOperation(
297
339
  };
298
340
  }
299
341
 
300
- function buildSyncDesiredOperations(targetDir, metadata, identity) {
342
+ function buildSyncDesiredOperations(targetDir, metadata, identity, snapshot = readTemplateSnapshot()) {
301
343
  const variables = buildSyncVariables(metadata);
302
- return buildDesiredManagedOperations(targetDir, variables, "init")
344
+ return buildDesiredManagedOperations(targetDir, variables, "init", snapshot)
303
345
  .filter((operation) => operation.relativePath !== "README.md")
304
346
  .map((operation) =>
305
347
  adaptGitignoreOperation(operation, targetDir, {
@@ -327,7 +369,7 @@ function buildSyncDesiredOperations(targetDir, metadata, identity) {
327
369
  }
328
370
 
329
371
  function buildAttachDesiredOperations(targetDir, variables, identity) {
330
- return buildDesiredManagedOperations(targetDir, variables, "managed")
372
+ return buildDesiredManagedOperations(targetDir, variables, "init")
331
373
  .filter((operation) => operation.relativePath !== "README.md")
332
374
  .map((operation) => adaptGitignoreOperation(operation, targetDir, { attach: true }))
333
375
  .map((operation) => {
@@ -396,6 +438,7 @@ function collectManagedFiles(desiredOperations) {
396
438
 
397
439
  function buildMetadata(variables, desiredOperations, timestamp = nowIsoString()) {
398
440
  const snapshot = readTemplateSnapshot();
441
+ const distribution = variables.distribution || distributionForVariables(variables, BUNDLED_TEMPLATE_ROOT);
399
442
  return {
400
443
  metadataSchemaVersion: METADATA_SCHEMA_VERSION,
401
444
  templateName: PACKAGE_MANIFEST.name,
@@ -408,6 +451,7 @@ function buildMetadata(variables, desiredOperations, timestamp = nowIsoString())
408
451
  initializedAt: timestamp,
409
452
  lastSyncedAt: timestamp,
410
453
  managedFilesManifestVersion: TEMPLATE_MANIFEST_VERSION,
454
+ distribution,
411
455
  variables: {
412
456
  projectName: variables.projectName,
413
457
  businessDomain: variables.businessDomain,
@@ -429,19 +473,21 @@ function writeTemplateMetadata(targetDir, metadata, transaction = null) {
429
473
  fs.writeFileSync(metadataPath, content, "utf8");
430
474
  }
431
475
 
432
- function buildNextSyncMetadata(metadata, syncPlan) {
433
- const snapshot = readTemplateSnapshot();
476
+ function buildNextSyncMetadata(metadata, syncPlan, {
477
+ snapshot = readTemplateSnapshot(),
478
+ currentHashes = null,
479
+ } = {}) {
434
480
  const nextManagedFiles = { ...(metadata.managedFiles || {}) };
435
481
  delete nextManagedFiles["README.md"];
436
482
  for (const relativePath of syncPlan.alreadyMissing || []) delete nextManagedFiles[relativePath];
437
483
  for (const relativePath of syncPlan.pruned || []) delete nextManagedFiles[relativePath];
438
484
  for (const operation of syncPlan.desiredOperations) {
439
485
  if (pathKind(operation.targetPath) !== "file") continue;
440
- const currentHash = fileHash(operation.targetPath);
441
- if (currentHash === operation.desiredHash) {
486
+ const currentHash = currentHashes?.[operation.relativePath] ?? fileHash(operation.targetPath);
487
+ if (currentHash === operation.desiredHash || operation.relativePath === "skills-lock.json") {
442
488
  nextManagedFiles[operation.relativePath] = {
443
489
  type: operation.type,
444
- contentHash: operation.desiredHash,
490
+ contentHash: currentHash,
445
491
  };
446
492
  }
447
493
  }
@@ -449,6 +495,7 @@ function buildNextSyncMetadata(metadata, syncPlan) {
449
495
  return {
450
496
  ...metadata,
451
497
  metadataSchemaVersion: METADATA_SCHEMA_VERSION,
498
+ distribution: metadata.metadataSchemaVersion >= 3 ? metadata.distribution : { mode: "legacy-all" },
452
499
  templateName: PACKAGE_MANIFEST.name,
453
500
  cliVersion: PACKAGE_MANIFEST.version,
454
501
  templateVersion: PACKAGE_MANIFEST.version,
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+
3
+ const crypto = require("node:crypto");
4
+ const fs = require("node:fs");
5
+
6
+ const { targetPath, pathKind } = require("../filesystem/path-utils");
7
+ const {
8
+ createMigrationPlan,
9
+ addUnsafe,
10
+ addConflict,
11
+ addRemove,
12
+ } = require("./migration-planner");
13
+
14
+ const TRACKER_FROM = "docs/agents/issue-tracker.md";
15
+ const TRACKER_TO = ".template-spec/agents/issue-tracker.md";
16
+ const STATIC_DIRECTORIES = [
17
+ "docs/agents", "docs/process", "docs/templates", "docs/user-guide",
18
+ "docs/plan/templates", "docs/api/templates", "docs/architecture/templates",
19
+ "docs/design/templates", "docs/design/tokens", "docs/design/schemas",
20
+ "docs/design/diagrams", "docs/discovery/templates",
21
+ ];
22
+ const STATIC_FILES = [
23
+ "docs/adr/README.md", "docs/architecture/README.md",
24
+ "docs/plan/README.md", "docs/plan/entry-review.md",
25
+ "docs/discovery/README.md", "docs/discovery/IDEATION.md",
26
+ "docs/design/README.md", "docs/design/design.md",
27
+ "docs/design/design-system-sync.yaml", "docs/design/preview.html",
28
+ "docs/design/preview-dark.html", "docs/design/preview.css",
29
+ "docs/design/preview.js", "docs/engineering/backend-platforms.json",
30
+ "docs/engineering/backend-platforms.md",
31
+ ];
32
+ const RETIRED_SOURCE_ONLY = new Set([
33
+ "docs/agents/archify-integration.md", "docs/agents/skills-maintenance.md",
34
+ "docs/agents/strategic-design-skills-integration.md",
35
+ "docs/agents/yss-ui-skills-integration.md",
36
+ "docs/process/MATT-POCOCK-ENGINEERING-SKILLS.md",
37
+ "docs/process/github-workflows.md", "docs/process/maintenance-intensity.yaml",
38
+ "docs/process/template-engineering-overview.md",
39
+ "docs/process/template-verification-profiles.yaml",
40
+ "docs/process/schemas/maintenance-review-record.schema.json",
41
+ "docs/process/templates/maintenance-checkpoint-template.yaml",
42
+ "docs/design/design-system-sync.yaml", "docs/design/preview.html",
43
+ "docs/design/preview-dark.html", "docs/design/preview.css",
44
+ "docs/design/preview.js",
45
+ ]);
46
+ const SEPARATE_LEGACY_MAPPINGS = new Set([
47
+ "docs/templates/prd-template.md",
48
+ "docs/templates/vertical-slice-issue-template.md",
49
+ ]);
50
+
51
+ function digest(bytes) {
52
+ return crypto.createHash("sha256").update(bytes).digest("hex");
53
+ }
54
+
55
+ function legacyStaticPath(ref) {
56
+ return STATIC_FILES.includes(ref) ||
57
+ STATIC_DIRECTORIES.some((directory) => ref.startsWith(`${directory}/`));
58
+ }
59
+
60
+ function collectLegacyFiles(targetDir, desiredOperations, managedFiles, plan) {
61
+ const found = new Set();
62
+ function inspect(ref) {
63
+ let kind;
64
+ try { kind = pathKind(targetPath(targetDir, ref)); }
65
+ catch (error) { addUnsafe(plan, ref, error.message); return; }
66
+ if (kind === "missing") return;
67
+ if (kind === "other") { addUnsafe(plan, ref, "旧治理路径是符号链接或特殊文件"); return; }
68
+ if (kind === "file") { found.add(ref); return; }
69
+ for (const entry of fs.readdirSync(targetPath(targetDir, ref))) {
70
+ if (entry === ".DS_Store") continue;
71
+ inspect(`${ref}/${entry}`);
72
+ }
73
+ }
74
+ for (const directory of STATIC_DIRECTORIES) inspect(directory);
75
+ for (const ref of STATIC_FILES) inspect(ref);
76
+ for (const ref of Object.keys(managedFiles || {})) {
77
+ if (legacyStaticPath(ref)) inspect(ref);
78
+ }
79
+ for (const operation of desiredOperations) {
80
+ if (operation.relativePath.startsWith(".template-spec/")) {
81
+ inspect(`docs/${operation.relativePath.slice(".template-spec/".length)}`);
82
+ }
83
+ }
84
+ return [...found].filter((ref) => !SEPARATE_LEGACY_MAPPINGS.has(ref)).sort();
85
+ }
86
+
87
+ function prepareLayoutMigration({ targetDir, desiredOperations, managedFiles = {}, explicit = false }) {
88
+ const plan = createMigrationPlan(targetDir);
89
+ const legacyFiles = collectLegacyFiles(targetDir, desiredOperations, managedFiles, plan);
90
+ const desiredByPath = new Map(desiredOperations.map((operation) => [operation.relativePath, operation]));
91
+ const operations = [...desiredOperations];
92
+
93
+ for (const from of legacyFiles) {
94
+ const to = `.template-spec/${from.slice("docs/".length)}`;
95
+ if (!explicit) {
96
+ addConflict(plan, from, to, "旧治理目录布局需显式 --migrate-layout;普通 attach/sync 不写入");
97
+ continue;
98
+ }
99
+ const source = targetPath(targetDir, from);
100
+ const destination = targetPath(targetDir, to);
101
+ const sourceBytes = fs.readFileSync(source);
102
+ const destinationKind = pathKind(destination);
103
+ if (destinationKind !== "missing" && destinationKind !== "file") {
104
+ addUnsafe(plan, to, "迁移目标不是普通文件");
105
+ continue;
106
+ }
107
+ if (from === TRACKER_FROM) {
108
+ if (destinationKind === "file" && !sourceBytes.equals(fs.readFileSync(destination))) {
109
+ addConflict(plan, from, to, "项目 tracker 的新旧配置不一致,需人工处理");
110
+ continue;
111
+ }
112
+ const index = operations.findIndex((operation) => operation.relativePath === TRACKER_TO);
113
+ if (index < 0) {
114
+ addConflict(plan, from, to, "当前阶段缺少 tracker 目标资产");
115
+ continue;
116
+ }
117
+ if (destinationKind === "missing") {
118
+ operations[index] = {
119
+ ...operations[index], type: "render", desiredContent: sourceBytes,
120
+ desiredHash: digest(sourceBytes),
121
+ };
122
+ }
123
+ addRemove(plan, from, "保留项目 tracker 原内容并退出旧路径", { action: "preserve-project-config", to });
124
+ continue;
125
+ }
126
+ const recordedHash = managedFiles[from]?.contentHash;
127
+ if (!recordedHash || digest(sourceBytes) !== recordedHash) {
128
+ addConflict(plan, from, to, "缺少可信受管摘要或旧治理文件已被项目修改");
129
+ continue;
130
+ }
131
+ const desired = desiredByPath.get(to);
132
+ if (!desired && !RETIRED_SOURCE_ONLY.has(from)) {
133
+ addConflict(plan, from, to, "目标阶段未安装对应治理资产,不能静默丢弃");
134
+ continue;
135
+ }
136
+ if (destinationKind === "file" && (!desired || digest(fs.readFileSync(destination)) !== desired.desiredHash)) {
137
+ addConflict(plan, from, to, "目标路径已存在且与当前模板不一致");
138
+ continue;
139
+ }
140
+ addRemove(plan, from, desired ? "可信旧治理文件由新模板取代" : "可信模板专用文件退出实例", {
141
+ action: desired ? "replace-with-current-template" : "retire-template-only",
142
+ to: desired ? to : null,
143
+ });
144
+ }
145
+ return { desiredOperations: operations, plan, legacyFiles };
146
+ }
147
+
148
+ function combineMigrationPlans(...plans) {
149
+ const targetDir = plans[0]?.targetDir;
150
+ const combined = createMigrationPlan(targetDir);
151
+ for (const plan of plans) {
152
+ combined.operations.push(...plan.operations);
153
+ combined.legacy.push(...plan.legacy);
154
+ combined.conflicts.push(...plan.conflicts);
155
+ combined.unsafe.push(...plan.unsafe);
156
+ }
157
+ return combined;
158
+ }
159
+
160
+ module.exports = { prepareLayoutMigration, combineMigrationPlans, TRACKER_FROM, TRACKER_TO };
@@ -28,10 +28,10 @@ const LEGACY_SKILL_MAPPINGS = [
28
28
  ];
29
29
 
30
30
  const LEGACY_FILE_MAPPINGS = [
31
- ["docs/templates/prd-template.md", "docs/templates/spec-template.md"],
31
+ ["docs/templates/prd-template.md", ".template-spec/templates/spec-template.md"],
32
32
  [
33
33
  "docs/templates/vertical-slice-issue-template.md",
34
- "docs/templates/vertical-slice-ticket-template.md",
34
+ ".template-spec/templates/vertical-slice-ticket-template.md",
35
35
  ],
36
36
  ];
37
37
 
@@ -124,10 +124,25 @@ function isWriteProtectedOwnership(ownership) {
124
124
  return ownership === "user-owned" || ownership === "protected";
125
125
  }
126
126
 
127
+ function projectAssetWriteViolation(relativePath) {
128
+ const path = normalizePolicyPath(relativePath);
129
+ if (path === "docs/implementation/.gitkeep" || path === "docs/requirements/tickets/.gitkeep") return null;
130
+ if (
131
+ path === "scaffold-architecture-decisions.yaml" ||
132
+ path.startsWith("docs/implementation/") ||
133
+ path.startsWith("docs/requirements/tickets/")
134
+ ) {
135
+ return `${path} 是项目合同或决策资产,CLI 同步不得写入或清理`;
136
+ }
137
+ return null;
138
+ }
139
+
127
140
  function ownershipWriteViolation(operation) {
141
+ const path = operation?.relativePath || operation?.path || "unknown";
142
+ const projectAssetViolation = projectAssetWriteViolation(path);
143
+ if (projectAssetViolation) return projectAssetViolation;
128
144
  const ownership = operation?.ownership || "managed";
129
145
  if (!isWriteProtectedOwnership(ownership)) return null;
130
- const path = operation?.relativePath || operation?.path || "unknown";
131
146
  return ownership === "protected"
132
147
  ? `${path} 被 ownership policy 标记为 protected,CLI 不得写入或覆盖`
133
148
  : `${path} 被 ownership policy 标记为 user-owned,不属于受管模板文件`;
@@ -145,5 +160,6 @@ module.exports = {
145
160
  resolveOwnership,
146
161
  isTemplateManagedOwnership,
147
162
  isWriteProtectedOwnership,
163
+ projectAssetWriteViolation,
148
164
  ownershipWriteViolation,
149
165
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const { isTemplateManagedOwnership } = require("./ownership-policy");
3
+ const { isTemplateManagedOwnership, projectAssetWriteViolation } = require("./ownership-policy");
4
4
  const { resolveTemplateOwnership } = require("./ownership-runtime");
5
5
 
6
6
  function classifyRemovedFiles({
@@ -29,6 +29,11 @@ function classifyRemovedFiles({
29
29
  retainedRemoved.push({ path: relativePath, reason: "缺少可信受管基线" });
30
30
  continue;
31
31
  }
32
+ const projectAssetViolation = projectAssetWriteViolation(relativePath);
33
+ if (projectAssetViolation) {
34
+ retainedRemoved.push({ path: relativePath, reason: projectAssetViolation });
35
+ continue;
36
+ }
32
37
  const recordedOwnership = record.ownership || getCurrentOwnership(relativePath);
33
38
  const currentOwnership = getCurrentOwnership(relativePath);
34
39
  if (