@wildo-ai/framework-knowledge 1.1.0

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 (922) hide show
  1. package/LICENSE +34 -0
  2. package/dist/esm/.builder.pid +9 -0
  3. package/dist/esm/framework-knowledge.definitions.d.ts +51 -0
  4. package/dist/esm/framework-knowledge.definitions.d.ts.map +1 -0
  5. package/dist/esm/framework-knowledge.definitions.js +1571 -0
  6. package/dist/esm/framework-knowledge.definitions.js.map +1 -0
  7. package/dist/esm/framework-knowledge.loader.d.ts +72 -0
  8. package/dist/esm/framework-knowledge.loader.d.ts.map +1 -0
  9. package/dist/esm/framework-knowledge.loader.js +258 -0
  10. package/dist/esm/framework-knowledge.loader.js.map +1 -0
  11. package/dist/esm/framework-knowledge.schemas.d.ts +236 -0
  12. package/dist/esm/framework-knowledge.schemas.d.ts.map +1 -0
  13. package/dist/esm/framework-knowledge.schemas.js +23 -0
  14. package/dist/esm/framework-knowledge.schemas.js.map +1 -0
  15. package/dist/esm/index.d.ts +4 -0
  16. package/dist/esm/index.d.ts.map +1 -0
  17. package/dist/esm/index.js +4 -0
  18. package/dist/esm/index.js.map +1 -0
  19. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.d.ts +53 -0
  20. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.d.ts.map +1 -0
  21. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.js +56 -0
  22. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.js.map +1 -0
  23. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.d.ts +200 -0
  24. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.d.ts.map +1 -0
  25. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.js +228 -0
  26. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.js.map +1 -0
  27. package/dist/esm/playbooks/bottom_up.build-scale/playbook.definition.d.ts +39 -0
  28. package/dist/esm/playbooks/bottom_up.build-scale/playbook.definition.d.ts.map +1 -0
  29. package/dist/esm/playbooks/bottom_up.build-scale/playbook.definition.js +39 -0
  30. package/dist/esm/playbooks/bottom_up.build-scale/playbook.definition.js.map +1 -0
  31. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.d.ts +261 -0
  32. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.d.ts.map +1 -0
  33. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.js +412 -0
  34. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.js.map +1 -0
  35. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.d.ts +61 -0
  36. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.d.ts.map +1 -0
  37. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.js +65 -0
  38. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.js.map +1 -0
  39. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.d.ts +53 -0
  40. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.d.ts.map +1 -0
  41. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.js +54 -0
  42. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.js.map +1 -0
  43. package/dist/esm/playbooks/refinement.compliance-document-candidate/playbook.definition.d.ts +43 -0
  44. package/dist/esm/playbooks/refinement.compliance-document-candidate/playbook.definition.d.ts.map +1 -0
  45. package/dist/esm/playbooks/refinement.compliance-document-candidate/playbook.definition.js +73 -0
  46. package/dist/esm/playbooks/refinement.compliance-document-candidate/playbook.definition.js.map +1 -0
  47. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.d.ts +53 -0
  48. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.d.ts.map +1 -0
  49. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.js +114 -0
  50. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.js.map +1 -0
  51. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.d.ts +95 -0
  52. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.d.ts.map +1 -0
  53. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.js +102 -0
  54. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.js.map +1 -0
  55. package/dist/esm/playbooks/top_down.business-model/playbook.definition.d.ts +258 -0
  56. package/dist/esm/playbooks/top_down.business-model/playbook.definition.d.ts.map +1 -0
  57. package/dist/esm/playbooks/top_down.business-model/playbook.definition.js +241 -0
  58. package/dist/esm/playbooks/top_down.business-model/playbook.definition.js.map +1 -0
  59. package/dist/esm/playbooks/top_down.capability-map/playbook.definition.d.ts +241 -0
  60. package/dist/esm/playbooks/top_down.capability-map/playbook.definition.d.ts.map +1 -0
  61. package/dist/esm/playbooks/top_down.capability-map/playbook.definition.js +202 -0
  62. package/dist/esm/playbooks/top_down.capability-map/playbook.definition.js.map +1 -0
  63. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.d.ts +82 -0
  64. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.d.ts.map +1 -0
  65. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.js +89 -0
  66. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.js.map +1 -0
  67. package/dist/esm/playbooks/top_down.market-analysis/playbook.definition.d.ts +56 -0
  68. package/dist/esm/playbooks/top_down.market-analysis/playbook.definition.d.ts.map +1 -0
  69. package/dist/esm/playbooks/top_down.market-analysis/playbook.definition.js +76 -0
  70. package/dist/esm/playbooks/top_down.market-analysis/playbook.definition.js.map +1 -0
  71. package/dist/esm/playbooks/top_down.market-evidence-adequacy/playbook.definition.d.ts +30 -0
  72. package/dist/esm/playbooks/top_down.market-evidence-adequacy/playbook.definition.d.ts.map +1 -0
  73. package/dist/esm/playbooks/top_down.market-evidence-adequacy/playbook.definition.js +27 -0
  74. package/dist/esm/playbooks/top_down.market-evidence-adequacy/playbook.definition.js.map +1 -0
  75. package/dist/esm/playbooks/top_down.market-research/playbook.definition.d.ts +31 -0
  76. package/dist/esm/playbooks/top_down.market-research/playbook.definition.d.ts.map +1 -0
  77. package/dist/esm/playbooks/top_down.market-research/playbook.definition.js +26 -0
  78. package/dist/esm/playbooks/top_down.market-research/playbook.definition.js.map +1 -0
  79. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.d.ts +254 -0
  80. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.d.ts.map +1 -0
  81. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.js +219 -0
  82. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.js.map +1 -0
  83. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.d.ts +180 -0
  84. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.d.ts.map +1 -0
  85. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.js +302 -0
  86. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.js.map +1 -0
  87. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.d.ts +249 -0
  88. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.d.ts.map +1 -0
  89. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.js +286 -0
  90. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.js.map +1 -0
  91. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.d.ts +248 -0
  92. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.d.ts.map +1 -0
  93. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.js +227 -0
  94. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.js.map +1 -0
  95. package/dist/esm/playbooks/top_down.value-proposition/playbook.definition.d.ts +45 -0
  96. package/dist/esm/playbooks/top_down.value-proposition/playbook.definition.d.ts.map +1 -0
  97. package/dist/esm/playbooks/top_down.value-proposition/playbook.definition.js +48 -0
  98. package/dist/esm/playbooks/top_down.value-proposition/playbook.definition.js.map +1 -0
  99. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.d.ts +250 -0
  100. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.d.ts.map +1 -0
  101. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.js +218 -0
  102. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.js.map +1 -0
  103. package/dist/knowledge/assurance-authority-bases/wildo-safe-baseline-v1/authority-basis.json +1 -0
  104. package/dist/knowledge/manifest.json +45 -0
  105. package/dist/knowledge/playbooks/bottom_up.build-decompose/method.md +407 -0
  106. package/dist/knowledge/playbooks/bottom_up.build-decompose/playbook.json +69 -0
  107. package/dist/knowledge/playbooks/bottom_up.build-dispatch/evaluation-protocol.json +1 -0
  108. package/dist/knowledge/playbooks/bottom_up.build-dispatch/evaluation-treatment.json +1 -0
  109. package/dist/knowledge/playbooks/bottom_up.build-dispatch/method.md +556 -0
  110. package/dist/knowledge/playbooks/bottom_up.build-dispatch/playbook.json +47 -0
  111. package/dist/knowledge/playbooks/bottom_up.build-scale/method.md +344 -0
  112. package/dist/knowledge/playbooks/bottom_up.build-scale/playbook.json +43 -0
  113. package/dist/knowledge/playbooks/bottom_up.domain-plan/evaluation-protocol.json +1 -0
  114. package/dist/knowledge/playbooks/bottom_up.domain-plan/evaluation-treatment.json +1 -0
  115. package/dist/knowledge/playbooks/bottom_up.domain-plan/method.md +259 -0
  116. package/dist/knowledge/playbooks/bottom_up.domain-plan/playbook.json +83 -0
  117. package/dist/knowledge/playbooks/bottom_up.domain-plan/structured-artifact-action.json +1 -0
  118. package/dist/knowledge/playbooks/bottom_up.foundation/method.md +321 -0
  119. package/dist/knowledge/playbooks/bottom_up.foundation/playbook.json +79 -0
  120. package/dist/knowledge/playbooks/bottom_up.placement-plan/method.md +185 -0
  121. package/dist/knowledge/playbooks/bottom_up.placement-plan/playbook.json +66 -0
  122. package/dist/knowledge/playbooks/refinement.compliance-document-candidate/method.md +737 -0
  123. package/dist/knowledge/playbooks/refinement.compliance-document-candidate/playbook.json +44 -0
  124. package/dist/knowledge/playbooks/refinement.document-facts/method.md +261 -0
  125. package/dist/knowledge/playbooks/refinement.document-facts/playbook.json +57 -0
  126. package/dist/knowledge/playbooks/top_down.brand-identity/method.md +151 -0
  127. package/dist/knowledge/playbooks/top_down.brand-identity/playbook.json +124 -0
  128. package/dist/knowledge/playbooks/top_down.business-model/evaluation-protocol.json +1 -0
  129. package/dist/knowledge/playbooks/top_down.business-model/evaluation-treatment.json +1 -0
  130. package/dist/knowledge/playbooks/top_down.business-model/method.md +128 -0
  131. package/dist/knowledge/playbooks/top_down.business-model/playbook.json +102 -0
  132. package/dist/knowledge/playbooks/top_down.business-model/structured-artifact-action.json +1 -0
  133. package/dist/knowledge/playbooks/top_down.capability-map/evaluation-protocol.json +1 -0
  134. package/dist/knowledge/playbooks/top_down.capability-map/evaluation-treatment.json +1 -0
  135. package/dist/knowledge/playbooks/top_down.capability-map/method.md +239 -0
  136. package/dist/knowledge/playbooks/top_down.capability-map/playbook.json +73 -0
  137. package/dist/knowledge/playbooks/top_down.capability-map/structured-artifact-action.json +1 -0
  138. package/dist/knowledge/playbooks/top_down.compliance-posture/method.md +177 -0
  139. package/dist/knowledge/playbooks/top_down.compliance-posture/playbook.json +95 -0
  140. package/dist/knowledge/playbooks/top_down.market-analysis/method.md +64 -0
  141. package/dist/knowledge/playbooks/top_down.market-analysis/playbook.json +49 -0
  142. package/dist/knowledge/playbooks/top_down.market-evidence-adequacy/method.md +56 -0
  143. package/dist/knowledge/playbooks/top_down.market-evidence-adequacy/playbook.json +40 -0
  144. package/dist/knowledge/playbooks/top_down.market-research/method.md +68 -0
  145. package/dist/knowledge/playbooks/top_down.market-research/playbook.json +42 -0
  146. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/evaluation-protocol.json +1 -0
  147. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/evaluation-treatment.json +1 -0
  148. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/method.md +239 -0
  149. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/playbook.json +69 -0
  150. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/structured-artifact-action.json +1 -0
  151. package/dist/knowledge/playbooks/top_down.phase-gate/evaluation-protocol.json +1 -0
  152. package/dist/knowledge/playbooks/top_down.phase-gate/evaluation-treatment.json +1 -0
  153. package/dist/knowledge/playbooks/top_down.phase-gate/method.md +96 -0
  154. package/dist/knowledge/playbooks/top_down.phase-gate/playbook.json +77 -0
  155. package/dist/knowledge/playbooks/top_down.requirements-definition/evaluation-protocol.json +1 -0
  156. package/dist/knowledge/playbooks/top_down.requirements-definition/evaluation-treatment.json +1 -0
  157. package/dist/knowledge/playbooks/top_down.requirements-definition/method.md +53 -0
  158. package/dist/knowledge/playbooks/top_down.requirements-definition/playbook.json +61 -0
  159. package/dist/knowledge/playbooks/top_down.requirements-definition/structured-artifact-action.json +1 -0
  160. package/dist/knowledge/playbooks/top_down.scope-roadmap/evaluation-protocol.json +1 -0
  161. package/dist/knowledge/playbooks/top_down.scope-roadmap/evaluation-treatment.json +1 -0
  162. package/dist/knowledge/playbooks/top_down.scope-roadmap/method.md +280 -0
  163. package/dist/knowledge/playbooks/top_down.scope-roadmap/playbook.json +87 -0
  164. package/dist/knowledge/playbooks/top_down.scope-roadmap/structured-artifact-action.json +1 -0
  165. package/dist/knowledge/playbooks/top_down.value-proposition/method.md +204 -0
  166. package/dist/knowledge/playbooks/top_down.value-proposition/playbook.json +54 -0
  167. package/dist/knowledge/playbooks/top_down.vision-elicitation/evaluation-protocol.json +1 -0
  168. package/dist/knowledge/playbooks/top_down.vision-elicitation/evaluation-treatment.json +1 -0
  169. package/dist/knowledge/playbooks/top_down.vision-elicitation/method.md +146 -0
  170. package/dist/knowledge/playbooks/top_down.vision-elicitation/playbook.json +120 -0
  171. package/dist/knowledge/playbooks/top_down.vision-elicitation/structured-artifact-action.json +1 -0
  172. package/dist/knowledge/references/application.database.migration-change-risk.md +28 -0
  173. package/dist/knowledge/references/assertions.authored-metadata.config.md +90 -0
  174. package/dist/knowledge/references/assertions.behaviors.wire-contracts.md +223 -0
  175. package/dist/knowledge/references/assertions.references.conventions.md +92 -0
  176. package/dist/knowledge/references/assertions.snapshot.validation.md +317 -0
  177. package/dist/knowledge/references/assertions.specification.config.md +287 -0
  178. package/dist/knowledge/references/brand.asset.config.md +167 -0
  179. package/dist/knowledge/references/brand.authored-metadata.config.md +51 -0
  180. package/dist/knowledge/references/brand.logo-direction.config.md +88 -0
  181. package/dist/knowledge/references/brand.name.config.md +46 -0
  182. package/dist/knowledge/references/brand.snapshot.config.md +76 -0
  183. package/dist/knowledge/references/brand.snapshot.validation.md +446 -0
  184. package/dist/knowledge/references/brand.visual-tone.config.md +56 -0
  185. package/dist/knowledge/references/build-plan.task-graph.config.md +198 -0
  186. package/dist/knowledge/references/business-model.authored-metadata.config.md +65 -0
  187. package/dist/knowledge/references/business-model.pricing-plan.config.md +122 -0
  188. package/dist/knowledge/references/business-model.references.conventions.md +99 -0
  189. package/dist/knowledge/references/business-model.snapshot.config.md +121 -0
  190. package/dist/knowledge/references/business-model.snapshot.validation.md +325 -0
  191. package/dist/knowledge/references/cli.market.generate-command.md +230 -0
  192. package/dist/knowledge/references/cli.market.utils.md +147 -0
  193. package/dist/knowledge/references/companion.introspection.behaviors.market.md +90 -0
  194. package/dist/knowledge/references/companion.introspection.handlers.market.md +42 -0
  195. package/dist/knowledge/references/companion.market.generation-service.md +270 -0
  196. package/dist/knowledge/references/companion.market.prompt-renderer.md +244 -0
  197. package/dist/knowledge/references/companion.technical-doc.service.md +809 -0
  198. package/dist/knowledge/references/engine.client-bundle.allow-list.md +125 -0
  199. package/dist/knowledge/references/engine.client-bundle.discipline.md +130 -0
  200. package/dist/knowledge/references/engine.client-bundle.external-connectors-public.discipline.md +55 -0
  201. package/dist/knowledge/references/engine.saas-technical-doc.config.md +215 -0
  202. package/dist/knowledge/references/engine.saas-website.config.md +331 -0
  203. package/dist/knowledge/references/example.authorization.unit-narrowing.declaration.md +24 -0
  204. package/dist/knowledge/references/example.backend.addon-wiring.module.md +55 -0
  205. package/dist/knowledge/references/example.backend.custom-operation.create-postfix.md +35 -0
  206. package/dist/knowledge/references/example.backend.operation.error-throw.md +17 -0
  207. package/dist/knowledge/references/example.config.app-shell.command-menu-items.md +63 -0
  208. package/dist/knowledge/references/example.config.app-shell.full.md +147 -0
  209. package/dist/knowledge/references/example.config.app-shell.hosted-components.md +45 -0
  210. package/dist/knowledge/references/example.config.app-shell.quick-switcher-fields.md +37 -0
  211. package/dist/knowledge/references/example.config.backend.billing-enable.md +20 -0
  212. package/dist/knowledge/references/example.config.backend.required-floors.md +46 -0
  213. package/dist/knowledge/references/example.config.design-system.full.md +162 -0
  214. package/dist/knowledge/references/example.config.navigation.full.md +71 -0
  215. package/dist/knowledge/references/example.config.provider.backend-scope-billing.md +27 -0
  216. package/dist/knowledge/references/example.data-seeding.minimal.md +114 -0
  217. package/dist/knowledge/references/example.email.template.minimal.md +54 -0
  218. package/dist/knowledge/references/example.engine.component-registration.lazy-load.md +16 -0
  219. package/dist/knowledge/references/example.engine.product-definitions.feature-and-profiles.md +146 -0
  220. package/dist/knowledge/references/example.flows-actors.chat-assistant.md +196 -0
  221. package/dist/knowledge/references/example.flows-actors.llm-agent-one-shot.md +174 -0
  222. package/dist/knowledge/references/example.i18n.label-generation.engine-barrel.md +15 -0
  223. package/dist/knowledge/references/example.infra.cdn.cloudflare.md +23 -0
  224. package/dist/knowledge/references/example.infra.cdn.generic.md +17 -0
  225. package/dist/knowledge/references/example.infra.environment-config.local.md +250 -0
  226. package/dist/knowledge/references/example.market.alternative.in-house-build.md +49 -0
  227. package/dist/knowledge/references/example.market.authored-metadata.md +32 -0
  228. package/dist/knowledge/references/example.market.buying-journey.core-icp.md +140 -0
  229. package/dist/knowledge/references/example.market.category.config.md +71 -0
  230. package/dist/knowledge/references/example.market.channel.community.md +39 -0
  231. package/dist/knowledge/references/example.market.feature-benefit.kano-threshold.md +67 -0
  232. package/dist/knowledge/references/example.market.feature-benefit.pain-reliever.md +65 -0
  233. package/dist/knowledge/references/example.market.icp.anti-target.md +47 -0
  234. package/dist/knowledge/references/example.market.icp.individual.md +82 -0
  235. package/dist/knowledge/references/example.market.icp.legal-entity-with-geographies.md +95 -0
  236. package/dist/knowledge/references/example.market.is-benefit-available.composition.md +40 -0
  237. package/dist/knowledge/references/example.market.job.emotional.md +27 -0
  238. package/dist/knowledge/references/example.market.job.functional.md +28 -0
  239. package/dist/knowledge/references/example.market.message-template.seeds.md +106 -0
  240. package/dist/knowledge/references/example.market.objection.pricing.md +39 -0
  241. package/dist/knowledge/references/example.market.persona.dmu-with-inheritance.md +62 -0
  242. package/dist/knowledge/references/example.market.persona.individual-self.md +51 -0
  243. package/dist/knowledge/references/example.market.positioning.per-icp.md +103 -0
  244. package/dist/knowledge/references/example.market.proof.metric.md +39 -0
  245. package/dist/knowledge/references/example.market.scoring.golden-case.md +46 -0
  246. package/dist/knowledge/references/example.market.scoring.no-coverage-zero.md +40 -0
  247. package/dist/knowledge/references/example.market.snapshot-validation.duplicate-journey-stage.md +36 -0
  248. package/dist/knowledge/references/example.market.snapshot-validation.errors-by-kind.md +55 -0
  249. package/dist/knowledge/references/example.market.snapshot-validation.objection-proof-benefit-mismatch.md +74 -0
  250. package/dist/knowledge/references/example.market.snapshot-validation.proof-without-support.md +32 -0
  251. package/dist/knowledge/references/example.market.snapshot-validation.threshold-without-job.md +44 -0
  252. package/dist/knowledge/references/example.market.snapshot.assembled.md +49 -0
  253. package/dist/knowledge/references/example.market.tone-of-voice.config.md +41 -0
  254. package/dist/knowledge/references/example.market.trigger.growth-milestone.md +43 -0
  255. package/dist/knowledge/references/example.module.companion-exports.full.md +142 -0
  256. package/dist/knowledge/references/example.module.registration.shared.md +16 -0
  257. package/dist/knowledge/references/example.module.relationships.actor-edge-back-to-scope-owner.md +47 -0
  258. package/dist/knowledge/references/example.module.relationships.discriminator.md +25 -0
  259. package/dist/knowledge/references/example.module.relationships.scope-membership-junction.md +25 -0
  260. package/dist/knowledge/references/example.provider.backend-module-shape.md +110 -0
  261. package/dist/knowledge/references/example.provider.contribution.backend-billing.md +12 -0
  262. package/dist/knowledge/references/example.provider.frontend-file-picker.contribution.md +30 -0
  263. package/dist/knowledge/references/example.provider.frontend-file-picker.module.md +21 -0
  264. package/dist/knowledge/references/example.rag.source-fields.declaration.md +83 -0
  265. package/dist/knowledge/references/example.rate-limit.custom-controller-surface.md +25 -0
  266. package/dist/knowledge/references/example.rate-limit.resource-operation-surface.md +24 -0
  267. package/dist/knowledge/references/example.resource.add-field.priority-enum.md +19 -0
  268. package/dist/knowledge/references/example.resource.add-resource.module-factory-map.md +21 -0
  269. package/dist/knowledge/references/example.resource.config-wiring.fk-relationship.md +33 -0
  270. package/dist/knowledge/references/example.resource.custom-view.read-host.md +28 -0
  271. package/dist/knowledge/references/example.resource.mcp-exposure.md +65 -0
  272. package/dist/knowledge/references/example.resource.reference-constraints.role-constrained.md +27 -0
  273. package/dist/knowledge/references/example.resource.ui-behavior.enum-badge.md +22 -0
  274. package/dist/knowledge/references/example.resource.ui-behavior.operation-icon.md +43 -0
  275. package/dist/knowledge/references/example.spec.composite-view.workspace.md +72 -0
  276. package/dist/knowledge/references/example.spec.feature.flag-with-codehandling.md +64 -0
  277. package/dist/knowledge/references/example.spec.frontend-component.prop-vocabulary.md +88 -0
  278. package/dist/knowledge/references/example.spec.resource.semantic-field.md +23 -0
  279. package/dist/knowledge/references/example.views.app-level.composite-views-config.md +19 -0
  280. package/dist/knowledge/references/example.views.chart-view.resource-owned.md +69 -0
  281. package/dist/knowledge/references/example.views.composite-view.host-embeds.md +31 -0
  282. package/dist/knowledge/references/example.views.composite-view.workspace.md +65 -0
  283. package/dist/knowledge/references/example.views.custom-view.execution-host.md +41 -0
  284. package/dist/knowledge/references/example.views.execution-view.resource-owned.md +25 -0
  285. package/dist/knowledge/references/external-connectors.app.frontend-provider-module.md +42 -0
  286. package/dist/knowledge/references/market.alternative.config.md +68 -0
  287. package/dist/knowledge/references/market.alternative.kind.md +32 -0
  288. package/dist/knowledge/references/market.authored-metadata.config.md +64 -0
  289. package/dist/knowledge/references/market.buying-journey.config.md +43 -0
  290. package/dist/knowledge/references/market.buying-journey.stage.md +33 -0
  291. package/dist/knowledge/references/market.category.config.md +63 -0
  292. package/dist/knowledge/references/market.channel.config.md +59 -0
  293. package/dist/knowledge/references/market.channel.kind.md +49 -0
  294. package/dist/knowledge/references/market.context-block.builder.md +544 -0
  295. package/dist/knowledge/references/market.context-block.response.md +57 -0
  296. package/dist/knowledge/references/market.feature-benefit.config.md +84 -0
  297. package/dist/knowledge/references/market.feature-benefit.kano.md +41 -0
  298. package/dist/knowledge/references/market.gain.config.md +50 -0
  299. package/dist/knowledge/references/market.generation.response.md +108 -0
  300. package/dist/knowledge/references/market.icp.config.md +162 -0
  301. package/dist/knowledge/references/market.icp.geographic-targeting.md +57 -0
  302. package/dist/knowledge/references/market.inherit-from.md +74 -0
  303. package/dist/knowledge/references/market.is-benefit-available.md +58 -0
  304. package/dist/knowledge/references/market.job.config.md +48 -0
  305. package/dist/knowledge/references/market.message-template.config.md +86 -0
  306. package/dist/knowledge/references/market.objection.config.md +56 -0
  307. package/dist/knowledge/references/market.objection.kind.md +34 -0
  308. package/dist/knowledge/references/market.pain.config.md +50 -0
  309. package/dist/knowledge/references/market.persona.config.md +64 -0
  310. package/dist/knowledge/references/market.positioning.config.md +84 -0
  311. package/dist/knowledge/references/market.proof.config.md +48 -0
  312. package/dist/knowledge/references/market.proof.kind.md +34 -0
  313. package/dist/knowledge/references/market.references.weighted-edges.md +105 -0
  314. package/dist/knowledge/references/market.scoring.fit.md +215 -0
  315. package/dist/knowledge/references/market.snapshot.config.md +34 -0
  316. package/dist/knowledge/references/market.snapshot.validation.md +1171 -0
  317. package/dist/knowledge/references/market.tone-of-voice.config.md +80 -0
  318. package/dist/knowledge/references/market.trigger.config.md +45 -0
  319. package/dist/knowledge/references/market.trigger.kind.md +35 -0
  320. package/dist/knowledge/references/placement-plan.config.md +330 -0
  321. package/dist/knowledge/references/platform.config.application-database.md +74 -0
  322. package/dist/knowledge/references/platform.config.application-modules.md +30 -0
  323. package/dist/knowledge/references/platform.config.backing-services.md +266 -0
  324. package/dist/knowledge/references/platform.config.cdn.md +167 -0
  325. package/dist/knowledge/references/platform.config.environment.deployment.md +263 -0
  326. package/dist/knowledge/references/platform.config.saas.md +405 -0
  327. package/dist/knowledge/references/presets.models.design-system.configuration.md +59 -0
  328. package/dist/knowledge/references/presets.models.design-system.source-config.md +72 -0
  329. package/dist/knowledge/references/presets.models.labelling.sections.md +64 -0
  330. package/dist/knowledge/references/presets.models.material.profile-contract.md +192 -0
  331. package/dist/knowledge/references/presets.models.material.runtime-policy.md +60 -0
  332. package/dist/knowledge/references/presets.models.surface-policy.defaults.md +613 -0
  333. package/dist/knowledge/references/presets.models.surface-policy.md +534 -0
  334. package/dist/knowledge/references/presets.models.surface-variant.md +56 -0
  335. package/dist/knowledge/references/requirements.authored-metadata.config.md +64 -0
  336. package/dist/knowledge/references/requirements.functional-requirement.config.md +68 -0
  337. package/dist/knowledge/references/requirements.non-functional-requirement.config.md +100 -0
  338. package/dist/knowledge/references/requirements.references.conventions.md +125 -0
  339. package/dist/knowledge/references/requirements.snapshot.config.md +73 -0
  340. package/dist/knowledge/references/requirements.snapshot.validation.md +333 -0
  341. package/dist/knowledge/references/roadmap.authored-metadata.config.md +64 -0
  342. package/dist/knowledge/references/roadmap.phase.config.md +149 -0
  343. package/dist/knowledge/references/roadmap.references.conventions.md +89 -0
  344. package/dist/knowledge/references/roadmap.snapshot.config.md +65 -0
  345. package/dist/knowledge/references/roadmap.snapshot.validation.md +325 -0
  346. package/dist/knowledge/references/saas.backend.app-config.backend-authored.md +32 -0
  347. package/dist/knowledge/references/saas.backend.application-initialization.assembly.md +38 -0
  348. package/dist/knowledge/references/saas.backend.billing.resolution-failure-reasons.md +45 -0
  349. package/dist/knowledge/references/saas.backend.custom-operation.authoritative-fields.md +53 -0
  350. package/dist/knowledge/references/saas.backend.custom-operation.transactional-core.md +120 -0
  351. package/dist/knowledge/references/saas.backend.domain-module.md +237 -0
  352. package/dist/knowledge/references/saas.backend.email-template.definition.md +69 -0
  353. package/dist/knowledge/references/saas.backend.flows-actors.a2a-agent-card.md +89 -0
  354. package/dist/knowledge/references/saas.backend.flows-actors.a2a-task-surface.md +118 -0
  355. package/dist/knowledge/references/saas.backend.flows-actors.function-tool.md +82 -0
  356. package/dist/knowledge/references/saas.backend.flows-actors.invoke-agent.md +48 -0
  357. package/dist/knowledge/references/saas.backend.flows-actors.resource-read-tool.md +39 -0
  358. package/dist/knowledge/references/saas.backend.flows-actors.resource-write-tool.md +67 -0
  359. package/dist/knowledge/references/saas.backend.pdf-template.bindings.md +52 -0
  360. package/dist/knowledge/references/saas.backend.pdf-template.definition.md +113 -0
  361. package/dist/knowledge/references/saas.backend.rate-limit-service.check-policy.md +75 -0
  362. package/dist/knowledge/references/saas.backend.system-access-service.md +994 -0
  363. package/dist/knowledge/references/saas.data-seeding.admin-endpoints.md +59 -0
  364. package/dist/knowledge/references/saas.data-seeding.bootstrap-wiring.md +184 -0
  365. package/dist/knowledge/references/saas.data-seeding.definition-input.md +95 -0
  366. package/dist/knowledge/references/saas.data-seeding.modes.md +72 -0
  367. package/dist/knowledge/references/saas.data-seeding.run-ledger.md +198 -0
  368. package/dist/knowledge/references/saas.data-seeding.run-status.md +35 -0
  369. package/dist/knowledge/references/saas.data-seeding.schedule.md +91 -0
  370. package/dist/knowledge/references/saas.data-seeding.scope-iteration-strategy.md +46 -0
  371. package/dist/knowledge/references/saas.external-providers.backend-provider-registry.runtime-filter.md +55 -0
  372. package/dist/knowledge/references/saas.external-providers.document-extraction.applicability.md +26 -0
  373. package/dist/knowledge/references/saas.external-providers.embeddings.applicability.md +30 -0
  374. package/dist/knowledge/references/saas.external-providers.llm.model-configuration.md +124 -0
  375. package/dist/knowledge/references/saas.external-providers.llm.operation-key.md +49 -0
  376. package/dist/knowledge/references/saas.frontend.app-level-component.configuration.md +265 -0
  377. package/dist/knowledge/references/saas.frontend.app-level-component.vocabulary.md +148 -0
  378. package/dist/knowledge/references/saas.frontend.app-shell.hosted-components.md +145 -0
  379. package/dist/knowledge/references/saas.frontend.chart-view.inserted-declaration.md +80 -0
  380. package/dist/knowledge/references/saas.frontend.command-menu.omnibox.md +88 -0
  381. package/dist/knowledge/references/saas.frontend.command-menu.search-resource.md +109 -0
  382. package/dist/knowledge/references/saas.frontend.component-registration.entry.md +21 -0
  383. package/dist/knowledge/references/saas.frontend.composite-view.authoring.md +102 -0
  384. package/dist/knowledge/references/saas.frontend.composite-view.define-helper.md +31 -0
  385. package/dist/knowledge/references/saas.frontend.domain-module.md +31 -0
  386. package/dist/knowledge/references/saas.frontend.embedded-resource-descent.md +37 -0
  387. package/dist/knowledge/references/saas.frontend.execution-view.action-status-contract.md +172 -0
  388. package/dist/knowledge/references/saas.frontend.execution-view.action-status-contract.per-action-retry-loop.md +115 -0
  389. package/dist/knowledge/references/saas.frontend.execution-view.definition.md +172 -0
  390. package/dist/knowledge/references/saas.frontend.execution-view.dirty-bridge-contract.local-pane.md +109 -0
  391. package/dist/knowledge/references/saas.frontend.execution-view.dirty-bridge-contract.md +55 -0
  392. package/dist/knowledge/references/saas.frontend.execution-view.dirty-state-contract.md +151 -0
  393. package/dist/knowledge/references/saas.frontend.execution-view.failure-handling-contract.md +302 -0
  394. package/dist/knowledge/references/saas.frontend.execution-view.loading-aggregation.md +89 -0
  395. package/dist/knowledge/references/saas.frontend.execution-view.loading-aggregation.participation-prefetch.md +231 -0
  396. package/dist/knowledge/references/saas.frontend.execution-view.loading-aggregation.participation-prefetch.shell-data-hydrator.md +174 -0
  397. package/dist/knowledge/references/saas.frontend.execution-view.navigation-handling-and-embedding.md +96 -0
  398. package/dist/knowledge/references/saas.frontend.execution-view.navigation-handling-and-embedding.resolution.md +45 -0
  399. package/dist/knowledge/references/saas.frontend.execution-view.outcome-emission-contract.md +71 -0
  400. package/dist/knowledge/references/saas.frontend.execution-view.participation-and-anchor.md +80 -0
  401. package/dist/knowledge/references/saas.frontend.execution-view.three-zone-contract.md +147 -0
  402. package/dist/knowledge/references/saas.frontend.flows-actors-view.md +40 -0
  403. package/dist/knowledge/references/saas.frontend.form-fields.file-provider-constraints.md +80 -0
  404. package/dist/knowledge/references/saas.frontend.full-custom-view.definition.md +64 -0
  405. package/dist/knowledge/references/saas.frontend.inserted-view.identity-bindings-descriptor.md +149 -0
  406. package/dist/knowledge/references/saas.frontend.operation-key-and-resource-config-like.md +63 -0
  407. package/dist/knowledge/references/saas.frontend.quick-switcher.scope-field.md +102 -0
  408. package/dist/knowledge/references/saas.frontend.related-resource-embeds.md +86 -0
  409. package/dist/knowledge/references/saas.frontend.related-resource-preview.md +23 -0
  410. package/dist/knowledge/references/saas.frontend.related-resource-sections.md +28 -0
  411. package/dist/knowledge/references/saas.frontend.resource-header-title.md +43 -0
  412. package/dist/knowledge/references/saas.frontend.resource-layout-templates.md +215 -0
  413. package/dist/knowledge/references/saas.frontend.resource-operation-frontend-config.md +531 -0
  414. package/dist/knowledge/references/saas.frontend.resource-ui-behavior-config.md +210 -0
  415. package/dist/knowledge/references/saas.frontend.resource-ui-behavior-preset-map.md +39 -0
  416. package/dist/knowledge/references/saas.frontend.settings-hub.engine-destinations.md +58 -0
  417. package/dist/knowledge/references/saas.frontend.settings-hub.placement.md +118 -0
  418. package/dist/knowledge/references/saas.frontend.view-definition-scope.md +42 -0
  419. package/dist/knowledge/references/saas.market.generation-agent.md +104 -0
  420. package/dist/knowledge/references/saas.models.core-resource-operation.md +86 -0
  421. package/dist/knowledge/references/saas.models.data-mode-read-list.md +395 -0
  422. package/dist/knowledge/references/saas.models.engine-capabilities.md +114 -0
  423. package/dist/knowledge/references/saas.models.error-type.md +45 -0
  424. package/dist/knowledge/references/saas.models.external-data-pipeline.md +162 -0
  425. package/dist/knowledge/references/saas.models.feature-limit-semantic.md +51 -0
  426. package/dist/knowledge/references/saas.models.flows-actors.agent-configuration.md +127 -0
  427. package/dist/knowledge/references/saas.models.flows-actors.agent-definition.md +115 -0
  428. package/dist/knowledge/references/saas.models.flows-actors.agent-invocation.md +52 -0
  429. package/dist/knowledge/references/saas.models.flows-actors.agent-prompt-spec.md +188 -0
  430. package/dist/knowledge/references/saas.models.http-api-binding.md +237 -0
  431. package/dist/knowledge/references/saas.models.navigation.layout.md +149 -0
  432. package/dist/knowledge/references/saas.models.organization-unit-narrowing-containment.md +22 -0
  433. package/dist/knowledge/references/saas.models.organization-unit-narrowing-declaration.md +42 -0
  434. package/dist/knowledge/references/saas.models.polymorphism.optout-business-key.md +62 -0
  435. package/dist/knowledge/references/saas.models.polymorphism.variant-definition.md +74 -0
  436. package/dist/knowledge/references/saas.models.provider-capabilities.md +97 -0
  437. package/dist/knowledge/references/saas.models.rate-limit-configuration.md +67 -0
  438. package/dist/knowledge/references/saas.models.relationship-handling-contract.md +30 -0
  439. package/dist/knowledge/references/saas.models.relationship-handling-settings.md +62 -0
  440. package/dist/knowledge/references/saas.models.relationship-nature-and-models.md +112 -0
  441. package/dist/knowledge/references/saas.models.resource-config.builder-parameters.md +431 -0
  442. package/dist/knowledge/references/saas.models.resource-config.forwarded-label.md +88 -0
  443. package/dist/knowledge/references/saas.models.resource-config.operation-api-call.md +89 -0
  444. package/dist/knowledge/references/saas.models.resource-config.operation-base.md +79 -0
  445. package/dist/knowledge/references/saas.models.resource-config.operation-mcp-exposure.md +49 -0
  446. package/dist/knowledge/references/saas.models.resource-config.operation-path.md +27 -0
  447. package/dist/knowledge/references/saas.models.resource-config.operation-union.md +26 -0
  448. package/dist/knowledge/references/saas.models.resource-config.operation-variant-for-key.md +62 -0
  449. package/dist/knowledge/references/saas.models.resource-config.resource-configuration.md +124 -0
  450. package/dist/knowledge/references/saas.models.resource-config.resource-relationships-buckets.md +38 -0
  451. package/dist/knowledge/references/saas.models.resource-config.resources-registry.md +69 -0
  452. package/dist/knowledge/references/saas.models.resource-config.searchable-relation.md +89 -0
  453. package/dist/knowledge/references/saas.models.resource-config.system-access-policy.md +121 -0
  454. package/dist/knowledge/references/saas.models.resource-config.token-generation.md +145 -0
  455. package/dist/knowledge/references/saas.models.resource-field-identifier.md +25 -0
  456. package/dist/knowledge/references/saas.models.resource-operation-display-risk.md +77 -0
  457. package/dist/knowledge/references/saas.models.resource-operation-variant-runtime.md +58 -0
  458. package/dist/knowledge/references/saas.models.resource-primary-scope.md +36 -0
  459. package/dist/knowledge/references/saas.models.resource-relationship-access-scope.md +26 -0
  460. package/dist/knowledge/references/saas.models.resource-relationship-builder-parameters.md +100 -0
  461. package/dist/knowledge/references/saas.models.resource-relationship-cardinality.md +57 -0
  462. package/dist/knowledge/references/saas.models.resource-relationship-declaration.md +69 -0
  463. package/dist/knowledge/references/saas.models.resource-relationship-resolved-semantics.md +60 -0
  464. package/dist/knowledge/references/saas.models.resource-relationship-schema.md +172 -0
  465. package/dist/knowledge/references/saas.models.resource-server-instance.md +109 -0
  466. package/dist/knowledge/references/saas.models.resource-type.md +24 -0
  467. package/dist/knowledge/references/saas.models.schema-family-builder.md +242 -0
  468. package/dist/knowledge/references/saas.models.scope-membership.md +143 -0
  469. package/dist/knowledge/references/saas.models.shared-domain-module.md +36 -0
  470. package/dist/knowledge/references/saas.models.shared-saas-module.md +36 -0
  471. package/dist/knowledge/references/saas.public-runtime.contract.md +229 -0
  472. package/dist/knowledge/references/saas.rag.retrieval-bounds.md +106 -0
  473. package/dist/knowledge/references/saas.rag.retrieval-refusals.md +89 -0
  474. package/dist/knowledge/references/saas.rag.retrieval-request.md +130 -0
  475. package/dist/knowledge/references/saas.rag.retrieval-result.md +147 -0
  476. package/dist/knowledge/references/saas.rag.retrieval-scores.md +54 -0
  477. package/dist/knowledge/references/saas.specifications.application-document-fact-specification.contract.md +59 -0
  478. package/dist/knowledge/references/saas.specifications.application-document-publication.contract.md +74 -0
  479. package/dist/knowledge/references/saas.specifications.assurance-document-blueprint.contract.md +1158 -0
  480. package/dist/knowledge/references/saas.specifications.assurance-program.contract.md +2602 -0
  481. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.catalog-spec-shared.md +180 -0
  482. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.discriminated-union.md +138 -0
  483. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-aggregate-offer.md +46 -0
  484. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-aggregate-rating.md +47 -0
  485. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-article.md +49 -0
  486. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-blog-posting.md +62 -0
  487. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-breadcrumb-list.md +46 -0
  488. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-faq-page.md +51 -0
  489. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-offer.md +46 -0
  490. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-organization.md +48 -0
  491. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-product.md +59 -0
  492. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-review.md +46 -0
  493. package/dist/knowledge/references/saas.specifications.catalogs.schema-org.entity-website.md +46 -0
  494. package/dist/knowledge/references/saas.specifications.companion-exports.contract.md +530 -0
  495. package/dist/knowledge/references/saas.specifications.composite-view-specification.md +49 -0
  496. package/dist/knowledge/references/saas.specifications.error-message-specification.md +92 -0
  497. package/dist/knowledge/references/saas.specifications.family-specifications.md +109 -0
  498. package/dist/knowledge/references/saas.specifications.feature-specification.md +93 -0
  499. package/dist/knowledge/references/saas.specifications.frontend-component-spec-factory.md +113 -0
  500. package/dist/knowledge/references/saas.specifications.frontend-component-spec-model.md +366 -0
  501. package/dist/knowledge/references/saas.specifications.resource-frontend-configuration-aspect.md +41 -0
  502. package/dist/knowledge/references/saas.specifications.resource-operation-spec.md +1978 -0
  503. package/dist/knowledge/references/saas.specifications.resource-pdf-template-spec.md +58 -0
  504. package/dist/knowledge/references/saas.specifications.resource-spec-code-handling.md +49 -0
  505. package/dist/knowledge/references/saas.specifications.resource-spec-config.md +156 -0
  506. package/dist/knowledge/references/saas.specifications.resource-spec-factory.md +171 -0
  507. package/dist/knowledge/references/saas.specifications.resource-spec-frontend-config-type.md +54 -0
  508. package/dist/knowledge/references/saas.specifications.resource-spec-frontend-prose.md +171 -0
  509. package/dist/knowledge/references/saas.website.astro.bridge.md +262 -0
  510. package/dist/knowledge/references/saas.website.astro.head-renderer.md +271 -0
  511. package/dist/knowledge/references/saas.website.astro.headers-renderer.md +41 -0
  512. package/dist/knowledge/references/saas.website.astro.i18n-helper.md +121 -0
  513. package/dist/knowledge/references/saas.website.astro.label-key-collector.md +117 -0
  514. package/dist/knowledge/references/saas.website.astro.label-loader.md +377 -0
  515. package/dist/knowledge/references/saas.website.astro.llms-txt-server.md +46 -0
  516. package/dist/knowledge/references/saas.website.astro.pick-labels-for-page.md +90 -0
  517. package/dist/knowledge/references/saas.website.astro.robots-renderer.md +174 -0
  518. package/dist/knowledge/references/saas.website.astro.runtime-helper.md +187 -0
  519. package/dist/knowledge/references/saas.website.astro.site-context.md +141 -0
  520. package/dist/knowledge/references/saas.website.astro.sitemap-coverage.md +188 -0
  521. package/dist/knowledge/references/saas.website.astro.structured-data-renderer.md +174 -0
  522. package/dist/knowledge/references/saas.website.blog.bridge.md +396 -0
  523. package/dist/knowledge/references/saas.website.blog.collection-config.md +180 -0
  524. package/dist/knowledge/references/saas.website.blog.frontmatter.md +116 -0
  525. package/dist/knowledge/references/saas.website.blog.head-renderer.md +292 -0
  526. package/dist/knowledge/references/saas.website.blog.mdx-provider.md +100 -0
  527. package/dist/knowledge/references/saas.website.blog.post-renderer.md +291 -0
  528. package/dist/knowledge/references/saas.website.design-tokens.bundle.md +29 -0
  529. package/dist/knowledge/references/saas.website.design-tokens.colors.md +64 -0
  530. package/dist/knowledge/references/saas.website.design-tokens.radius.md +38 -0
  531. package/dist/knowledge/references/saas.website.factories.define-page-manifest.md +98 -0
  532. package/dist/knowledge/references/saas.website.factories.define-section.md +128 -0
  533. package/dist/knowledge/references/saas.website.label-keys.compose-helper.md +36 -0
  534. package/dist/knowledge/references/saas.website.label-keys.format.md +67 -0
  535. package/dist/knowledge/references/saas.website.label-pack.validator.md +206 -0
  536. package/dist/knowledge/references/saas.website.page-layout.component.md +217 -0
  537. package/dist/knowledge/references/saas.website.page-manifest.meta-label-keys.md +47 -0
  538. package/dist/knowledge/references/saas.website.page-manifest.route-path.md +49 -0
  539. package/dist/knowledge/references/saas.website.page-manifest.schema.md +186 -0
  540. package/dist/knowledge/references/saas.website.page-manifest.seo.md +46 -0
  541. package/dist/knowledge/references/saas.website.page.context.md +57 -0
  542. package/dist/knowledge/references/saas.website.primitives.button.md +123 -0
  543. package/dist/knowledge/references/saas.website.primitives.heading.md +103 -0
  544. package/dist/knowledge/references/saas.website.primitives.image.md +103 -0
  545. package/dist/knowledge/references/saas.website.primitives.internal-button.md +151 -0
  546. package/dist/knowledge/references/saas.website.primitives.internal-link.md +193 -0
  547. package/dist/knowledge/references/saas.website.primitives.link.md +78 -0
  548. package/dist/knowledge/references/saas.website.primitives.text.md +82 -0
  549. package/dist/knowledge/references/saas.website.refs.page.md +56 -0
  550. package/dist/knowledge/references/saas.website.refs.section.md +57 -0
  551. package/dist/knowledge/references/saas.website.root-config.navigation.md +37 -0
  552. package/dist/knowledge/references/saas.website.root-config.schema.md +192 -0
  553. package/dist/knowledge/references/saas.website.root-config.seo.md +98 -0
  554. package/dist/knowledge/references/saas.website.routing.localized-path.md +84 -0
  555. package/dist/knowledge/references/saas.website.runtime.context.md +174 -0
  556. package/dist/knowledge/references/saas.website.section.component.md +138 -0
  557. package/dist/knowledge/references/saas.website.section.context.md +63 -0
  558. package/dist/knowledge/references/saas.website.sections.category-enum.md +72 -0
  559. package/dist/knowledge/references/saas.website.sections.definition-schema.md +121 -0
  560. package/dist/knowledge/references/saas.website.seo.llms-txt-config.md +37 -0
  561. package/dist/knowledge/references/saas.website.seo.robots-config.md +106 -0
  562. package/dist/knowledge/references/saas.website.seo.sitemap-config.md +73 -0
  563. package/dist/knowledge/references/saas.website.structured-data.payload-shape.md +71 -0
  564. package/dist/knowledge/references/saas.website.use-label-by-key.hook.md +45 -0
  565. package/dist/knowledge/references/saas.website.use-label.hook.md +82 -0
  566. package/dist/knowledge/references/saas.website.use-page.hook.md +30 -0
  567. package/dist/knowledge/references/saas.website.use-runtime.hook.md +36 -0
  568. package/dist/knowledge/references/saas.website.use-section.hook.md +30 -0
  569. package/dist/knowledge/references/saas.website.use-tokens.hook.md +32 -0
  570. package/dist/knowledge/references/vision.authored-metadata.config.md +64 -0
  571. package/dist/knowledge/references/vision.constraint.config.md +66 -0
  572. package/dist/knowledge/references/vision.idea.config.md +45 -0
  573. package/dist/knowledge/references/vision.mission.config.md +46 -0
  574. package/dist/knowledge/references/vision.problem.config.md +51 -0
  575. package/dist/knowledge/references/vision.references.conventions.md +115 -0
  576. package/dist/knowledge/references/vision.snapshot.config.md +85 -0
  577. package/dist/knowledge/references/vision.snapshot.validation.md +226 -0
  578. package/dist/knowledge/references/vision.success-criterion.config.md +60 -0
  579. package/dist/knowledge/references/zod.decorators.chainable-runtime.md +550 -0
  580. package/dist/knowledge/references/zod.decorators.conditional-visibility.md +104 -0
  581. package/dist/knowledge/references/zod.decorators.data-categories.md +197 -0
  582. package/dist/knowledge/references/zod.decorators.decorator-vocabulary.md +436 -0
  583. package/dist/knowledge/references/zod.decorators.display-edit-modes.md +174 -0
  584. package/dist/knowledge/references/zod.decorators.enums.frontend-handling.md +101 -0
  585. package/dist/knowledge/references/zod.decorators.field-spec-params.md +317 -0
  586. package/dist/knowledge/references/zod.decorators.file-generation.md +36 -0
  587. package/dist/knowledge/references/zod.decorators.file-rag-source.md +56 -0
  588. package/dist/knowledge/references/zod.decorators.file-schema.md +319 -0
  589. package/dist/knowledge/references/zod.decorators.foreign-key-display-mode.md +83 -0
  590. package/dist/knowledge/references/zod.decorators.per-primitive-ui.md +459 -0
  591. package/dist/knowledge/references/zod.decorators.primitive-ui.md +123 -0
  592. package/dist/knowledge/references/zod.decorators.rag-source.md +164 -0
  593. package/dist/knowledge/references/zod.decorators.schema-metadata.md +122 -0
  594. package/dist/knowledge/references/zod.decorators.shared-structural-methods.md +152 -0
  595. package/dist/knowledge/references/zod.decorators.shared-structural-params.md +314 -0
  596. package/dist/knowledge/references/zod.decorators.structural-lifecycle-params.md +529 -0
  597. package/dist/knowledge/references/zod.factories.bigdecimal.md +155 -0
  598. package/dist/knowledge/references/zod.factories.code.md +127 -0
  599. package/dist/knowledge/references/zod.factories.duration.md +246 -0
  600. package/dist/knowledge/references/zod.factories.money.md +166 -0
  601. package/dist/knowledge/references/zod.factories.phone.md +88 -0
  602. package/dist/knowledge/references/zod.factories.range.md +174 -0
  603. package/dist/knowledge/registries/assurance-authority-bases.json +15 -0
  604. package/dist/knowledge/registries/framework-topics.json +5212 -0
  605. package/dist/knowledge/registries/playbooks.json +488 -0
  606. package/dist/knowledge/registries/source-tags.json +7664 -0
  607. package/dist/knowledge/rules/resource-schema-awareness.md +77 -0
  608. package/dist/knowledge/skills/INDEX.md +349 -0
  609. package/dist/knowledge/skills/application-consumer-documentation-authoring/SKILL.md +415 -0
  610. package/dist/knowledge/skills/application-consumer-documentation-authoring/examples/domain-use-case-and-admin-task.example.md +49 -0
  611. package/dist/knowledge/skills/application-consumer-documentation-authoring/references/source-and-ownership-routing.md +52 -0
  612. package/dist/knowledge/skills/application-database-migrations/SKILL.md +218 -0
  613. package/dist/knowledge/skills/application-database-migrations/references/framework-application-database-api.md +84 -0
  614. package/dist/knowledge/skills/application-database-migrations/references/framework-migration-change-risk-api.md +37 -0
  615. package/dist/knowledge/skills/application-database-migrations/references/migration-refusals.md +64 -0
  616. package/dist/knowledge/skills/application-database-migrations/references/postgresql-vs-mongodb-obligations.md +34 -0
  617. package/dist/knowledge/skills/authorization-unit-narrowing/SKILL.md +323 -0
  618. package/dist/knowledge/skills/authorization-unit-narrowing/references/framework-unit-narrowing-declaration-api.md +84 -0
  619. package/dist/knowledge/skills/backend-addon-wiring/SKILL.md +324 -0
  620. package/dist/knowledge/skills/backend-addon-wiring/references/backend-di-routing.md +7 -0
  621. package/dist/knowledge/skills/backend-addon-wiring/references/framework-backend-bootstrap-api.md +276 -0
  622. package/dist/knowledge/skills/backend-custom-operation/SKILL.md +374 -0
  623. package/dist/knowledge/skills/backend-custom-operation/references/framework-error-handling-api.md +118 -0
  624. package/dist/knowledge/skills/backend-custom-operation/references/framework-operation-base-and-path-api.md +107 -0
  625. package/dist/knowledge/skills/backend-custom-operation/references/framework-transactional-core-api.md +134 -0
  626. package/dist/knowledge/skills/backend-custom-operation/references/operation-file-conventions.md +10 -0
  627. package/dist/knowledge/skills/brand-logo-authoring/SKILL.md +192 -0
  628. package/dist/knowledge/skills/brand-logo-authoring/references/brand-authoring-decisions.md +55 -0
  629. package/dist/knowledge/skills/brand-logo-authoring/references/framework-brand-asset-api.md +184 -0
  630. package/dist/knowledge/skills/brand-logo-authoring/references/framework-brand-snapshot-api.md +279 -0
  631. package/dist/knowledge/skills/compliance-document-authoring/SKILL.md +346 -0
  632. package/dist/knowledge/skills/compliance-document-authoring/references/document-composition-governance.md +160 -0
  633. package/dist/knowledge/skills/compliance-document-authoring/references/document-composition-privacy-notice.md +518 -0
  634. package/dist/knowledge/skills/compliance-document-authoring/references/document-composition-service-terms.md +158 -0
  635. package/dist/knowledge/skills/compliance-document-authoring/references/framework-application-document-fact-specification-contract.md +95 -0
  636. package/dist/knowledge/skills/compliance-document-authoring/references/framework-application-document-publication-contract.md +100 -0
  637. package/dist/knowledge/skills/compliance-document-authoring/references/framework-assurance-document-blueprint-contract.md +1210 -0
  638. package/dist/knowledge/skills/compliance-document-authoring/references/framework-governed-document-after-drafting.md +40 -0
  639. package/dist/knowledge/skills/config-app-shell/SKILL.md +698 -0
  640. package/dist/knowledge/skills/config-app-shell/references/app-shell-surfaces.md +5 -0
  641. package/dist/knowledge/skills/config-app-shell/references/framework-app-shell-api.md +415 -0
  642. package/dist/knowledge/skills/config-app-shell/references/framework-app-shell-hosted-components-api.md +170 -0
  643. package/dist/knowledge/skills/config-app-shell/references/framework-command-menu-omnibox-api.md +212 -0
  644. package/dist/knowledge/skills/config-app-shell/references/framework-quick-switcher-scope-field-api.md +178 -0
  645. package/dist/knowledge/skills/config-design-system/SKILL.md +424 -0
  646. package/dist/knowledge/skills/config-design-system/references/design-system-file.md +10 -0
  647. package/dist/knowledge/skills/config-design-system/references/framework-design-system-configuration-api.md +77 -0
  648. package/dist/knowledge/skills/config-design-system/references/framework-material-profile-api.md +200 -0
  649. package/dist/knowledge/skills/config-design-system/references/framework-material-runtime-policy-api.md +68 -0
  650. package/dist/knowledge/skills/config-design-system/references/framework-surface-policy-api.md +1212 -0
  651. package/dist/knowledge/skills/config-design-system/references/surface-policy-authoring.md +92 -0
  652. package/dist/knowledge/skills/config-navigation/SKILL.md +249 -0
  653. package/dist/knowledge/skills/config-navigation/references/framework-navigation-layout-api.md +152 -0
  654. package/dist/knowledge/skills/config-navigation/references/navigation-zones.md +5 -0
  655. package/dist/knowledge/skills/config-saas/SKILL.md +209 -0
  656. package/dist/knowledge/skills/config-saas/references/framework-provider-capabilities-api.md +221 -0
  657. package/dist/knowledge/skills/config-saas/references/framework-wildo-saas-config-api.md +408 -0
  658. package/dist/knowledge/skills/config-saas/references/saas-config-scope.md +9 -0
  659. package/dist/knowledge/skills/config-saas-backend/SKILL.md +183 -0
  660. package/dist/knowledge/skills/config-saas-backend/references/framework-backend-authored-config-api.md +40 -0
  661. package/dist/knowledge/skills/configure-billing/SKILL.md +261 -0
  662. package/dist/knowledge/skills/configure-billing/references/config-chain-and-failure-map.md +90 -0
  663. package/dist/knowledge/skills/configure-billing/references/example-backend-provider-module-shape.md +122 -0
  664. package/dist/knowledge/skills/configure-billing/references/example-provider-contribution-and-backend-config.md +48 -0
  665. package/dist/knowledge/skills/configure-billing/references/framework-backend-provider-reachability-api.md +69 -0
  666. package/dist/knowledge/skills/configure-billing/references/framework-billing-resolution-failure-api.md +57 -0
  667. package/dist/knowledge/skills/email-add-template/SKILL.md +439 -0
  668. package/dist/knowledge/skills/email-add-template/references/email-artifact-paths.md +9 -0
  669. package/dist/knowledge/skills/email-add-template/references/framework-email-template-api.md +72 -0
  670. package/dist/knowledge/skills/email-definition-wiring/SKILL.md +62 -0
  671. package/dist/knowledge/skills/email-labels-authoring/SKILL.md +64 -0
  672. package/dist/knowledge/skills/email-template-authoring/SKILL.md +62 -0
  673. package/dist/knowledge/skills/engine-component-registration/SKILL.md +257 -0
  674. package/dist/knowledge/skills/engine-component-registration/references/component-registration-file.md +7 -0
  675. package/dist/knowledge/skills/engine-component-registration/references/framework-component-registration-api.md +24 -0
  676. package/dist/knowledge/skills/engine-product-definitions/SKILL.md +429 -0
  677. package/dist/knowledge/skills/engine-product-definitions/references/framework-engine-product-definitions-api.md +287 -0
  678. package/dist/knowledge/skills/engine-product-definitions/references/product-registry-scope.md +5 -0
  679. package/dist/knowledge/skills/flows-actors-a2a-exposure/SKILL.md +491 -0
  680. package/dist/knowledge/skills/flows-actors-a2a-exposure/references/framework-flows-actors-a2a-contract.md +227 -0
  681. package/dist/knowledge/skills/flows-actors-a2a-exposure/references/framework-named-a2a-agents-contract.md +143 -0
  682. package/dist/knowledge/skills/flows-actors-chat-assistant/SKILL.md +368 -0
  683. package/dist/knowledge/skills/flows-actors-chat-assistant/examples/todo-assistant.example.md +226 -0
  684. package/dist/knowledge/skills/flows-actors-chat-assistant/references/framework-flows-actors-tool-api.md +208 -0
  685. package/dist/knowledge/skills/flows-actors-chat-assistant/references/framework-flows-actors-view-api.md +286 -0
  686. package/dist/knowledge/skills/flows-actors-llm-agent-invocation/SKILL.md +376 -0
  687. package/dist/knowledge/skills/flows-actors-llm-agent-invocation/references/framework-llm-agent-definition-api.md +262 -0
  688. package/dist/knowledge/skills/flows-actors-llm-agent-invocation/references/framework-llm-agent-invocation-api.md +130 -0
  689. package/dist/knowledge/skills/flows-actors-llm-agent-invocation/references/framework-llm-agent-prompt-spec-api.md +214 -0
  690. package/dist/knowledge/skills/flows-actors-llm-agent-invocation/references/framework-llm-operation-and-model-api.md +195 -0
  691. package/dist/knowledge/skills/flows-actors-llm-agent-invocation/references/operation-key-selection.md +60 -0
  692. package/dist/knowledge/skills/frontend-cdn-publish/SKILL.md +237 -0
  693. package/dist/knowledge/skills/frontend-cdn-publish/references/cloudflare-and-operator-setup.md +56 -0
  694. package/dist/knowledge/skills/frontend-cdn-publish/references/framework-cdn-config-api.md +176 -0
  695. package/dist/knowledge/skills/i18n-label-generation/SKILL.md +261 -0
  696. package/dist/knowledge/skills/i18n-label-generation/references/framework-labelling-sections-api.md +67 -0
  697. package/dist/knowledge/skills/i18n-label-generation/references/label-placement.md +7 -0
  698. package/dist/knowledge/skills/i18n-rerun-pipeline/SKILL.md +269 -0
  699. package/dist/knowledge/skills/i18n-rerun-pipeline/references/framework-labelling-sections-api.md +67 -0
  700. package/dist/knowledge/skills/i18n-rerun-pipeline/references/i18n-routing.md +9 -0
  701. package/dist/knowledge/skills/i18n-translation-rerun/SKILL.md +245 -0
  702. package/dist/knowledge/skills/i18n-translation-rerun/references/framework-labelling-sections-api.md +67 -0
  703. package/dist/knowledge/skills/i18n-translation-rerun/references/translation-workflow.md +17 -0
  704. package/dist/knowledge/skills/infra-environment-config/SKILL.md +646 -0
  705. package/dist/knowledge/skills/infra-environment-config/references/framework-application-database-api.md +77 -0
  706. package/dist/knowledge/skills/infra-environment-config/references/framework-backing-services-api.md +282 -0
  707. package/dist/knowledge/skills/infra-environment-config/references/framework-environment-deployment-api.md +265 -0
  708. package/dist/knowledge/skills/infra-environment-config/references/infra-config-files.md +7 -0
  709. package/dist/knowledge/skills/journey-approve/SKILL.md +43 -0
  710. package/dist/knowledge/skills/journey-bootstrap-scope/SKILL.md +42 -0
  711. package/dist/knowledge/skills/journey-next/SKILL.md +42 -0
  712. package/dist/knowledge/skills/journey-report/SKILL.md +43 -0
  713. package/dist/knowledge/skills/journey-run/SKILL.md +55 -0
  714. package/dist/knowledge/skills/journey-status/SKILL.md +50 -0
  715. package/dist/knowledge/skills/local-environment-bootstrap/SKILL.md +370 -0
  716. package/dist/knowledge/skills/local-environment-bootstrap/references/initialization-recovery-recipe.md +50 -0
  717. package/dist/knowledge/skills/local-environment-bootstrap/references/local-environment-troubleshooting.md +409 -0
  718. package/dist/knowledge/skills/local-environment-bootstrap/references/wildo-cli-bootstrap-commands.md +247 -0
  719. package/dist/knowledge/skills/market-add-feature-benefit/SKILL.md +474 -0
  720. package/dist/knowledge/skills/market-add-feature-benefit/references/framework-feature-benefit-api.md +139 -0
  721. package/dist/knowledge/skills/market-alternatives/SKILL.md +543 -0
  722. package/dist/knowledge/skills/market-authoring-overview/SKILL.md +354 -0
  723. package/dist/knowledge/skills/market-authoring-overview/references/framework-market-references-api.md +138 -0
  724. package/dist/knowledge/skills/market-authoring-overview/references/framework-market-snapshot-api.md +129 -0
  725. package/dist/knowledge/skills/market-category/SKILL.md +290 -0
  726. package/dist/knowledge/skills/market-channels/SKILL.md +361 -0
  727. package/dist/knowledge/skills/market-companion-prompt-enrichment/SKILL.md +2752 -0
  728. package/dist/knowledge/skills/market-companion-prompt-enrichment/references/framework-companion-behavior-api.md +2443 -0
  729. package/dist/knowledge/skills/market-generation-cli/SKILL.md +1484 -0
  730. package/dist/knowledge/skills/market-generation-cli/references/framework-market-generation-cli.md +1230 -0
  731. package/dist/knowledge/skills/market-icp/SKILL.md +625 -0
  732. package/dist/knowledge/skills/market-jobs-pains-gains/SKILL.md +352 -0
  733. package/dist/knowledge/skills/market-message-templates-authoring/SKILL.md +415 -0
  734. package/dist/knowledge/skills/market-message-templates-authoring/references/framework-message-template-api.md +1439 -0
  735. package/dist/knowledge/skills/market-persona/SKILL.md +407 -0
  736. package/dist/knowledge/skills/market-positioning-authoring/SKILL.md +392 -0
  737. package/dist/knowledge/skills/market-positioning-authoring/references/framework-positioning-api.md +97 -0
  738. package/dist/knowledge/skills/market-proof-and-objection/SKILL.md +665 -0
  739. package/dist/knowledge/skills/market-scoring-interpretation/SKILL.md +620 -0
  740. package/dist/knowledge/skills/market-scoring-interpretation/references/framework-scoring-api.md +291 -0
  741. package/dist/knowledge/skills/market-snapshot-validation/SKILL.md +1706 -0
  742. package/dist/knowledge/skills/market-snapshot-validation/references/framework-snapshot-validation-api.md +1228 -0
  743. package/dist/knowledge/skills/market-tone-of-voice/SKILL.md +260 -0
  744. package/dist/knowledge/skills/market-triggers-and-journey/SKILL.md +579 -0
  745. package/dist/knowledge/skills/module-companion-exports/SKILL.md +318 -0
  746. package/dist/knowledge/skills/module-companion-exports/references/companion-exports-by-package.md +544 -0
  747. package/dist/knowledge/skills/module-registration/SKILL.md +212 -0
  748. package/dist/knowledge/skills/module-registration/references/framework-domain-modules-api.md +366 -0
  749. package/dist/knowledge/skills/module-registration/references/registry-files.md +9 -0
  750. package/dist/knowledge/skills/module-relationships/SKILL.md +523 -0
  751. package/dist/knowledge/skills/module-relationships/references/cross-resource-fk-checklist.md +7 -0
  752. package/dist/knowledge/skills/module-relationships/references/framework-resource-relationship-authoring-api.md +738 -0
  753. package/dist/knowledge/skills/pdf-template-authoring/SKILL.md +174 -0
  754. package/dist/knowledge/skills/pdf-template-authoring/references/framework-pdf-template-api.md +203 -0
  755. package/dist/knowledge/skills/pdf-template-authoring/references/framework-pdf-template-spec-api.md +62 -0
  756. package/dist/knowledge/skills/provider-frontend-file-picker/SKILL.md +239 -0
  757. package/dist/knowledge/skills/provider-frontend-file-picker/references/framework-file-provider-constraints-api.md +90 -0
  758. package/dist/knowledge/skills/provider-frontend-file-picker/references/framework-frontend-provider-module-api.md +50 -0
  759. package/dist/knowledge/skills/rate-limit-authoring/SKILL.md +652 -0
  760. package/dist/knowledge/skills/rate-limit-authoring/references/framework-rate-limit-policy-api.md +182 -0
  761. package/dist/knowledge/skills/rate-limit-authoring/references/scope-key-and-bucket-conventions.md +137 -0
  762. package/dist/knowledge/skills/resource-add-field/SKILL.md +272 -0
  763. package/dist/knowledge/skills/resource-add-field/examples/add-priority-field-to-todos.example.md +153 -0
  764. package/dist/knowledge/skills/resource-add-field/references/framework-field-cross-layer-api.md +845 -0
  765. package/dist/knowledge/skills/resource-add-module/SKILL.md +322 -0
  766. package/dist/knowledge/skills/resource-add-module/references/framework-new-module-wiring-api.md +67 -0
  767. package/dist/knowledge/skills/resource-add-module/references/module-scaffold-layout.md +15 -0
  768. package/dist/knowledge/skills/resource-add-resource/SKILL.md +222 -0
  769. package/dist/knowledge/skills/resource-add-resource/references/framework-new-resource-core-config-api.md +540 -0
  770. package/dist/knowledge/skills/resource-add-resource/references/scaffold-surfaces-checklist.md +25 -0
  771. package/dist/knowledge/skills/resource-config-wiring/SKILL.md +370 -0
  772. package/dist/knowledge/skills/resource-config-wiring/references/config-change-routing.md +11 -0
  773. package/dist/knowledge/skills/resource-config-wiring/references/framework-personal-data-declaration-api.md +622 -0
  774. package/dist/knowledge/skills/resource-config-wiring/references/framework-saas-models-operation-scope-enums-api.md +248 -0
  775. package/dist/knowledge/skills/resource-config-wiring/references/framework-saas-models-resource-config-api.md +1769 -0
  776. package/dist/knowledge/skills/resource-config-wiring/references/framework-system-access-reads-api.md +1209 -0
  777. package/dist/knowledge/skills/resource-custom-view/SKILL.md +228 -0
  778. package/dist/knowledge/skills/resource-custom-view/references/custom-view-contracts.md +693 -0
  779. package/dist/knowledge/skills/resource-external-data/SKILL.md +349 -0
  780. package/dist/knowledge/skills/resource-external-data/references/framework-external-data-pipeline-api.md +187 -0
  781. package/dist/knowledge/skills/resource-external-data/references/framework-http-api-binding-api.md +261 -0
  782. package/dist/knowledge/skills/resource-external-data/references/lane-selection.md +49 -0
  783. package/dist/knowledge/skills/resource-external-data/references/pipeline-destination-schema.md +43 -0
  784. package/dist/knowledge/skills/resource-mcp-tool-exposure/SKILL.md +308 -0
  785. package/dist/knowledge/skills/resource-mcp-tool-exposure/references/framework-named-mcp-servers-contract.md +166 -0
  786. package/dist/knowledge/skills/resource-mcp-tool-exposure/references/framework-resource-mcp-exposure-contract.md +63 -0
  787. package/dist/knowledge/skills/resource-mcp-tool-exposure/references/mcp-catalogue-withdrawal-and-verification.md +77 -0
  788. package/dist/knowledge/skills/resource-mcp-tool-exposure/references/mcp-client-registration-postures.md +90 -0
  789. package/dist/knowledge/skills/resource-rag-source-fields/SKILL.md +424 -0
  790. package/dist/knowledge/skills/resource-rag-source-fields/references/corpus-field-selection.md +90 -0
  791. package/dist/knowledge/skills/resource-rag-source-fields/references/framework-embeddings-capability-api.md +261 -0
  792. package/dist/knowledge/skills/resource-rag-source-fields/references/framework-file-rag-source-api.md +117 -0
  793. package/dist/knowledge/skills/resource-rag-source-fields/references/framework-rag-retrieval-api.md +597 -0
  794. package/dist/knowledge/skills/resource-rag-source-fields/references/framework-rag-source-decorator-api.md +181 -0
  795. package/dist/knowledge/skills/resource-schema-authoring/SKILL.md +318 -0
  796. package/dist/knowledge/skills/resource-schema-authoring/examples/add-enum-field-with-ui.example.md +132 -0
  797. package/dist/knowledge/skills/resource-schema-authoring/examples/basic-resource-schema.example.md +62 -0
  798. package/dist/knowledge/skills/resource-schema-authoring/references/decorator-layer-map.md +63 -0
  799. package/dist/knowledge/skills/resource-schema-authoring/references/field-type-selection.md +70 -0
  800. package/dist/knowledge/skills/resource-schema-authoring/references/framework-decorator-vocabulary-api.md +559 -0
  801. package/dist/knowledge/skills/resource-schema-authoring/references/framework-personal-data-category-api.md +245 -0
  802. package/dist/knowledge/skills/resource-schema-authoring/references/framework-polymorphic-resources-api.md +147 -0
  803. package/dist/knowledge/skills/resource-schema-authoring/references/framework-schema-family-api.md +247 -0
  804. package/dist/knowledge/skills/resource-schema-authoring/references/framework-shared-decorator-methods-api.md +164 -0
  805. package/dist/knowledge/skills/resource-schema-authoring/references/framework-shared-structural-params-api.md +327 -0
  806. package/dist/knowledge/skills/resource-schema-authoring/references/framework-special-factories-api.md +1286 -0
  807. package/dist/knowledge/skills/resource-schema-authoring/references/framework-zod-lifecycle-and-chainable-api.md +1080 -0
  808. package/dist/knowledge/skills/resource-schema-authoring/references/polymorphic-per-scope-resources.md +75 -0
  809. package/dist/knowledge/skills/resource-schema-authoring/references/schema-variants-and-discriminators.md +62 -0
  810. package/dist/knowledge/skills/resource-schema-authoring/references/shared-layer-decorator-checklist.md +69 -0
  811. package/dist/knowledge/skills/resource-schema-authoring/references/special-factories.md +45 -0
  812. package/dist/knowledge/skills/resource-ui-behavior/SKILL.md +389 -0
  813. package/dist/knowledge/skills/resource-ui-behavior/references/framework-conditional-visibility-api.md +106 -0
  814. package/dist/knowledge/skills/resource-ui-behavior/references/framework-display-edit-modes-api.md +176 -0
  815. package/dist/knowledge/skills/resource-ui-behavior/references/framework-enum-frontend-handling-api.md +103 -0
  816. package/dist/knowledge/skills/resource-ui-behavior/references/framework-foreign-key-ui-api.md +97 -0
  817. package/dist/knowledge/skills/resource-ui-behavior/references/framework-frontend-resource-ui-contracts-api.md +839 -0
  818. package/dist/knowledge/skills/resource-ui-behavior/references/framework-per-primitive-ui-api.md +461 -0
  819. package/dist/knowledge/skills/resource-ui-behavior/references/framework-primitive-ui-api.md +125 -0
  820. package/dist/knowledge/skills/resource-ui-behavior/references/framework-related-resource-embeds-api.md +245 -0
  821. package/dist/knowledge/skills/resource-ui-behavior/references/framework-resource-layout-templates-api.md +302 -0
  822. package/dist/knowledge/skills/resource-ui-behavior/references/ui-layer-boundaries.md +13 -0
  823. package/dist/knowledge/skills/seeding-authoring/SKILL.md +569 -0
  824. package/dist/knowledge/skills/seeding-authoring/references/data-seeding-mode-picker.md +154 -0
  825. package/dist/knowledge/skills/seeding-authoring/references/framework-data-seeding-api.md +176 -0
  826. package/dist/knowledge/skills/seeding-operations/SKILL.md +505 -0
  827. package/dist/knowledge/skills/seeding-operations/references/data-seeding-admin-runbook.md +337 -0
  828. package/dist/knowledge/skills/seeding-operations/references/data-seeding-cron-scheduler.md +171 -0
  829. package/dist/knowledge/skills/seeding-operations/references/framework-data-seeding-operations-api.md +662 -0
  830. package/dist/knowledge/skills/settings-placement-authoring/SKILL.md +134 -0
  831. package/dist/knowledge/skills/settings-placement-authoring/references/framework-settings-destinations-catalog.md +65 -0
  832. package/dist/knowledge/skills/settings-placement-authoring/references/framework-settings-placement-api.md +127 -0
  833. package/dist/knowledge/skills/spec-catalog-authoring/SKILL.md +726 -0
  834. package/dist/knowledge/skills/spec-catalog-authoring/references/catalog-spec-pattern-overview.md +242 -0
  835. package/dist/knowledge/skills/spec-companion-exports/SKILL.md +362 -0
  836. package/dist/knowledge/skills/spec-companion-exports/references/companion-export-checklist.md +8 -0
  837. package/dist/knowledge/skills/spec-companion-exports/references/framework-companion-exports-contract-api.md +533 -0
  838. package/dist/knowledge/skills/spec-component-update/SKILL.md +315 -0
  839. package/dist/knowledge/skills/spec-component-update/references/component-spec-props.md +8 -0
  840. package/dist/knowledge/skills/spec-component-update/references/framework-frontend-component-spec-api.md +481 -0
  841. package/dist/knowledge/skills/spec-composite-view-update/SKILL.md +283 -0
  842. package/dist/knowledge/skills/spec-composite-view-update/references/composite-spec-sections.md +5 -0
  843. package/dist/knowledge/skills/spec-composite-view-update/references/framework-composite-view-specification-api.md +51 -0
  844. package/dist/knowledge/skills/spec-family-update/SKILL.md +300 -0
  845. package/dist/knowledge/skills/spec-family-update/references/family-spec-routing.md +13 -0
  846. package/dist/knowledge/skills/spec-family-update/references/framework-error-message-specifications-api.md +108 -0
  847. package/dist/knowledge/skills/spec-family-update/references/framework-family-specifications-api.md +111 -0
  848. package/dist/knowledge/skills/spec-feature-update/SKILL.md +306 -0
  849. package/dist/knowledge/skills/spec-feature-update/references/feature-spec-scope.md +5 -0
  850. package/dist/knowledge/skills/spec-feature-update/references/framework-feature-specification-api.md +95 -0
  851. package/dist/knowledge/skills/spec-resource-update/SKILL.md +220 -0
  852. package/dist/knowledge/skills/spec-resource-update/references/framework-field-spec-params-api.md +319 -0
  853. package/dist/knowledge/skills/spec-resource-update/references/framework-spec-resource-contracts-api.md +2610 -0
  854. package/dist/knowledge/skills/spec-resource-update/references/resource-spec-field-routing.md +12 -0
  855. package/dist/knowledge/skills/spec-update-after-change/SKILL.md +195 -0
  856. package/dist/knowledge/skills/spec-update-after-change/references/framework-spec-factory-api.md +173 -0
  857. package/dist/knowledge/skills/spec-update-after-change/references/spec-maintenance-by-surface.md +33 -0
  858. package/dist/knowledge/skills/spec-update-after-change/references/surface-to-spec-routing.md +14 -0
  859. package/dist/knowledge/skills/views-add-composite-view/SKILL.md +259 -0
  860. package/dist/knowledge/skills/views-add-composite-view/references/composite-view-routing.md +10 -0
  861. package/dist/knowledge/skills/views-add-composite-view/references/framework-inserted-view-identity-api.md +151 -0
  862. package/dist/knowledge/skills/views-add-custom-view/SKILL.md +225 -0
  863. package/dist/knowledge/skills/views-add-custom-view/references/custom-view-routing.md +10 -0
  864. package/dist/knowledge/skills/views-add-custom-view/references/framework-view-scope-and-full-custom-api.md +107 -0
  865. package/dist/knowledge/skills/views-app-level/SKILL.md +201 -0
  866. package/dist/knowledge/skills/views-app-level/references/app-level-views-routing.md +9 -0
  867. package/dist/knowledge/skills/views-app-level/references/framework-view-scope-and-full-custom-api.md +107 -0
  868. package/dist/knowledge/skills/views-chart-authoring/SKILL.md +264 -0
  869. package/dist/knowledge/skills/views-chart-authoring/references/chart-view-checklist.md +7 -0
  870. package/dist/knowledge/skills/views-chart-authoring/references/framework-chart-view-contracts-api.md +82 -0
  871. package/dist/knowledge/skills/views-chart-authoring/references/framework-inserted-view-identity-api.md +152 -0
  872. package/dist/knowledge/skills/views-composite-authoring/SKILL.md +302 -0
  873. package/dist/knowledge/skills/views-composite-authoring/references/composite-embedding-checklist.md +23 -0
  874. package/dist/knowledge/skills/views-composite-authoring/references/framework-composite-view-contracts-api.md +133 -0
  875. package/dist/knowledge/skills/views-composite-authoring/references/framework-inserted-view-identity-api.md +152 -0
  876. package/dist/knowledge/skills/views-execution-authoring/SKILL.md +209 -0
  877. package/dist/knowledge/skills/views-execution-authoring/references/execution-view-checklist.md +7 -0
  878. package/dist/knowledge/skills/views-execution-authoring/references/framework-execution-view-contracts-api.md +389 -0
  879. package/dist/knowledge/skills/views-execution-authoring/references/framework-inserted-view-identity-api.md +152 -0
  880. package/dist/knowledge/skills/website-anonymous-session/SKILL.md +444 -0
  881. package/dist/knowledge/skills/website-blog-authoring/SKILL.md +587 -0
  882. package/dist/knowledge/skills/website-blog-authoring/references/blog-adapter-api.md +1426 -0
  883. package/dist/knowledge/skills/website-bundle-discipline/SKILL.md +553 -0
  884. package/dist/knowledge/skills/website-bundle-discipline/references/example-website-button-override.md +52 -0
  885. package/dist/knowledge/skills/website-bundle-discipline/references/website-bundle-rules.md +357 -0
  886. package/dist/knowledge/skills/website-consent-gate-overrides/SKILL.md +511 -0
  887. package/dist/knowledge/skills/website-factory-advanced/SKILL.md +376 -0
  888. package/dist/knowledge/skills/website-inbound-contact-forms/SKILL.md +304 -0
  889. package/dist/knowledge/skills/website-label-pack/SKILL.md +390 -0
  890. package/dist/knowledge/skills/website-layout-overrides/SKILL.md +461 -0
  891. package/dist/knowledge/skills/website-marketing-metadata-extension/SKILL.md +264 -0
  892. package/dist/knowledge/skills/website-navigation-authoring/SKILL.md +414 -0
  893. package/dist/knowledge/skills/website-navigation-authoring/references/worked-examples-header-footer.md +366 -0
  894. package/dist/knowledge/skills/website-page-authoring/SKILL.md +420 -0
  895. package/dist/knowledge/skills/website-page-variants/SKILL.md +256 -0
  896. package/dist/knowledge/skills/website-primitive-overrides/SKILL.md +302 -0
  897. package/dist/knowledge/skills/website-section-contact/SKILL.md +950 -0
  898. package/dist/knowledge/skills/website-section-contact/references/define-website-section-api.md +579 -0
  899. package/dist/knowledge/skills/website-section-cta/SKILL.md +822 -0
  900. package/dist/knowledge/skills/website-section-cta/references/define-website-section-api.md +579 -0
  901. package/dist/knowledge/skills/website-section-faq/SKILL.md +917 -0
  902. package/dist/knowledge/skills/website-section-faq/references/define-website-section-api.md +579 -0
  903. package/dist/knowledge/skills/website-section-feature-benefit-summary/SKILL.md +878 -0
  904. package/dist/knowledge/skills/website-section-feature-benefit-summary/references/define-website-section-api.md +579 -0
  905. package/dist/knowledge/skills/website-section-feature-detail/SKILL.md +895 -0
  906. package/dist/knowledge/skills/website-section-feature-detail/references/define-website-section-api.md +579 -0
  907. package/dist/knowledge/skills/website-section-footer-cta/SKILL.md +814 -0
  908. package/dist/knowledge/skills/website-section-footer-cta/references/define-website-section-api.md +579 -0
  909. package/dist/knowledge/skills/website-section-hero/SKILL.md +944 -0
  910. package/dist/knowledge/skills/website-section-hero/references/define-website-section-api.md +583 -0
  911. package/dist/knowledge/skills/website-section-pricing/SKILL.md +934 -0
  912. package/dist/knowledge/skills/website-section-pricing/references/define-website-section-api.md +579 -0
  913. package/dist/knowledge/skills/website-section-social-proof/SKILL.md +912 -0
  914. package/dist/knowledge/skills/website-section-social-proof/references/define-website-section-api.md +579 -0
  915. package/dist/knowledge/skills/website-seo-aeo-geo/SKILL.md +624 -0
  916. package/dist/knowledge/skills/website-seo-aeo-geo/references/aeo-api.md +633 -0
  917. package/dist/knowledge/skills/website-seo-aeo-geo/references/geo-api.md +193 -0
  918. package/dist/knowledge/skills/website-seo-aeo-geo/references/seo-api.md +790 -0
  919. package/dist/knowledge/topic-index.json +17510 -0
  920. package/dist/tsconfig.build.tsbuildinfo +1 -0
  921. package/dist/tsconfig.tsbuildinfo +1 -0
  922. package/package.json +49 -0
@@ -0,0 +1,1706 @@
1
+ ---
2
+ name: market-snapshot-validation
3
+ description: Run validateMarketSnapshot at app boot to enforce authoring-consistency invariants across the assembled MarketSnapshot. Covers the 18 locked issue kinds (ORPHAN_REF, MULTIPLE_THRESHOLDS_PER_ICP_JOB, THRESHOLD_BENEFIT_WITHOUT_JOB, EMPTY_BENEFIT_DELIVERED_BY, ICP_WITHOUT_PERSONA, INFLUENCE_CYCLE, MISSING_POSITIONING_FOR_ICP, STALE_AUTHORED, DUPLICATE_EDGE_PER_ENTITY, INVALID_ANTI_TARGET_PURPOSE_MIX, BUYING_GROUP_PERSONA_MISSING_DMU_ROLE, BUYING_GROUP_BACKLINK_MISSING, PROOF_WITHOUT_SUPPORT, PROOF_KIND_PAYLOAD_MISMATCH, DUPLICATE_JOURNEY_STAGE, DUPLICATE_BUYING_JOURNEY_FOR_ICP, OBJECTION_PROOF_BENEFIT_MISMATCH, MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH) with ERROR/WARN severities — see the SKILL body for the per-kind reference table. Use when the user says "validate the market snapshot", "why is my snapshot rejected", "what does ORPHAN_REF mean", "wire validation into bootstrap", or "what is MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH".
4
+ ---
5
+
6
+ # Validate the Market Snapshot at Boot (Phases 2–3)
7
+
8
+ ### Target Application Framing
9
+
10
+ This knowledge is for configuring behavior in the target application.
11
+ Wildo is the framework surface being used, not the product being built.
12
+
13
+ Read and apply these patterns from the application-developer point of view:
14
+
15
+ - how the application should configure the relevant app-level file
16
+ - how the application should use framework-provided factories, enums, and helpers
17
+ - how the application should avoid mixing frontend, backend, and infrastructure concerns
18
+
19
+
20
+ ## Overview
21
+
22
+ `validateMarketSnapshot(snapshot, options?)` is the **boot-time
23
+ authoring-consistency check** for the assembled `MarketSnapshot`. It
24
+ is a pure, typed graph walker — no Zod introspection, no runtime
25
+ registry access beyond optional caller-supplied ref sets.
26
+
27
+ It returns `{ ok, issues[] }`:
28
+
29
+ - `ok === true` iff NO issue carries `severity: 'ERROR'`. WARN-only
30
+ results are still `ok === true`.
31
+ - Each issue carries `kind` (one of `MarketSnapshotIssueKind`),
32
+ `path` (dotted path inside the snapshot, e.g.
33
+ `'icps[0].pains[2].painRef'`), `message`, and `severity`.
34
+
35
+ Schema-level checks (Zod) catch shape violations. The validator
36
+ catches the **graph-level** invariants Zod cannot express:
37
+ cross-entity orphans, "at most one THRESHOLD per (icp, job)",
38
+ "every CORE/EXPANSION ICP has positioning", influence cycles, etc.
39
+
40
+ ## App Paths
41
+
42
+ Locate the bootstrap surfaces this validator wires into and the snapshot it audits:
43
+
44
+ | Surface | Glob (relative to app root) |
45
+ |---------|------------------------------|
46
+ | App bootstrap (where `validateMarketSnapshot` is called) | `frontend/src/**/bootstrap*.ts` (or wherever the app composes its boot sequence) |
47
+ | Snapshot the validator consumes | `specifications/src/market/**/*.ts` |
48
+
49
+ ## When to Use
50
+
51
+ - Wiring the snapshot into application bootstrap (run `validateMarketSnapshot`
52
+ before any consumer touches the snapshot)
53
+ - Diagnosing a `BusinessConfigError` thrown by the bootstrap
54
+ (read the `issues[]` payload)
55
+ - Authoring tools that need a "lint" pass over the snapshot
56
+ before saving
57
+ - CI checks that catch market-spec drift before merge
58
+
59
+ ## When NOT to Use
60
+
61
+ - Field-level validation (use the Zod schema directly)
62
+ - Runtime feature availability checks (use `isBenefitAvailable`)
63
+ - Computing FIT scores (use `computeFeatureFitScoreForICP`)
64
+ - Mutating the snapshot in any way (the validator is pure)
65
+
66
+ ## Locked rule table (18 kinds)
67
+
68
+ The validator's `validateMarketSnapshot(snapshot, options?)` signature
69
+ takes an optional `now?: Date` test affordance for `STALE_AUTHORED`.
70
+ Issue ordering inside `result.issues[]` is detector-order, then
71
+ snapshot-walk order — **not** a stable contract. Callers must group
72
+ or sort by `kind` + `severity` themselves.
73
+
74
+ | `MarketSnapshotIssueKind` | Severity | Trigger |
75
+ |----------------------------------------------|-------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
76
+ | `ORPHAN_REF` | ERROR | A `<entity>Ref` does not resolve inside the snapshot. Coverage includes: `MarketICP.{channelRefs,triggerRefs,alternativeRefs,proofRefs,objectionRefs,influences[].icpRef,buyingGroup[].personaRef,preferredVoiceRef,recommendedProductRefs,upsellPathProductRefs}`, `MarketPersona.{belongsToIcpRefs,channelRefs,preferredVoiceRef}` + edge refs, `MarketPositioning.{icpRef,preferredVoiceRef,valuePillars[].backedByBenefitRefs,alternativesContrasted[].alternativeRef}`, `MarketTrigger.{affectedIcpRefs,recommendedChannelRefs}`, `MarketBuyingJourney.icpRef`, `MarketProof.{supportsBenefitRefs,supportsIcpRefs}`, all `MarketObjection` ref fields, `FeatureBenefit.{proofRefs,addressesObjectionRefs,deliveredByFeatureRefs,relieves/creates/advances/importanceByICP edges}`, and `MarketMessageTemplate.preferredVoiceRef`. Cross-family refs (`featureRefs`, `productRefs`) are skipped if no set passed. |
77
+ | `MULTIPLE_THRESHOLDS_PER_ICP_JOB` | ERROR | An `(icpRef, jobRef)` cluster has more than one distinct benefit (deduped by `benefit.ref`) with `kanoCategory: THRESHOLD`. |
78
+ | `THRESHOLD_BENEFIT_WITHOUT_JOB` | ERROR | A benefit declares any `kanoCategory: THRESHOLD` `importanceByICP` entry but `advances[]` is empty — without a job to anchor against, the THRESHOLD claim has no semantic cluster and the `MULTIPLE_THRESHOLDS_PER_ICP_JOB` invariant is structurally bypassed. |
79
+ | `EMPTY_BENEFIT_DELIVERED_BY` | ERROR | A `FeatureBenefit.deliveredByFeatureRefs[]` is empty (defence in depth — Zod also rejects this). |
80
+ | `ICP_WITHOUT_PERSONA` | ERROR (`LEGAL_ENTITY`) / WARN (`INDIVIDUAL`) | An ICP has no persona pointing at its `ref` via `belongsToIcpRefs`. `ANTI_TARGET` is exempt. |
81
+ | `INFLUENCE_CYCLE` | ERROR (self-loop) / WARN (multi-node cycle) | Cycle in the ICP→ICP influence graph. Self-loops are always ERROR; multi-node cycles are WARN (real GTM dynamics may include them). |
82
+ | `MISSING_POSITIONING_FOR_ICP` | ERROR | An ICP of priority `CORE` or `EXPANSION` has no `MarketPositioning`. Other priorities exempt. |
83
+ | `STALE_AUTHORED` | WARN | `lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |
84
+ | `DUPLICATE_EDGE_PER_ENTITY` | WARN | Same target ref appears more than once in the same per-entity edge list. Covers ICP/persona `pains[].painRef`, `gains[].gainRef`, `jobs[].jobRef` (typically a forgotten `.filter()` after `inheritFrom()`) AND benefit `importanceByICP[].icpRef` (duplicate (benefit, icp) pairs make per-ICP scoring non-deterministic). |
85
+ | `INVALID_ANTI_TARGET_PURPOSE_MIX` | ERROR | `priority === ANTI_TARGET` and `purposeMix !== { adoption: 0, revenue: 0 }`. |
86
+ | `BUYING_GROUP_PERSONA_MISSING_DMU_ROLE` | ERROR | `personaScope === BUYING_GROUP_MEMBER` and `dmuRole` is undefined. |
87
+ | `BUYING_GROUP_BACKLINK_MISSING` | ERROR | An ICP's `buyingGroup[].personaRef` resolves to a persona whose `belongsToIcpRefs[]` does NOT include that ICP. The link must be symmetric — asymmetric links cause downstream consumers (DMU rendering, persona-by-ICP indexing) to silently drop the persona. |
88
+ | `PROOF_WITHOUT_SUPPORT` | WARN | A `MarketProof` has empty `supportsBenefitRefs` AND empty `supportsIcpRefs`. The proof exists but is unreachable for AI routing. |
89
+ | `PROOF_KIND_PAYLOAD_MISMATCH` | WARN | A `MarketProof` carries a payload incoherent with its `proofKind`: `METRIC` without a `metric` block, OR `LOGO` with a `metric` block. Other kind/payload combinations are deliberately accepted (a `QUOTE` may carry a metric, an `AWARD` may carry an attribution, etc.). |
90
+ | `DUPLICATE_JOURNEY_STAGE` | ERROR | A `MarketBuyingJourney` lists the same `BuyingJourneyStage` value more than once. (Two flavours of the same stage means two journeys for two ICPs, not two stages.) |
91
+ | `DUPLICATE_BUYING_JOURNEY_FOR_ICP` | ERROR | Two `MarketBuyingJourney` entries point at the same `icpRef`. The model is "one journey per ICP" — merge or remove one. |
92
+ | `OBJECTION_PROOF_BENEFIT_MISMATCH` | WARN | A `MarketObjection` cites `proofRefs` whose combined `supportsBenefitRefs` ∪ `supportsIcpRefs` do not intersect with the objection's `relatedBenefitRefs` ∪ `raisedByIcpRefs` — the cited proofs do not back what the objection is about. |
93
+ | `MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH` | WARN | Symmetric drift between `MarketMessageTemplate.requiredInputs[]` and the actual Mustache placeholders inside `promptTemplate`: a declared `requiredInputs[]` entry whose `{{<entity>.*}}` / `{{<entity>Ref}}` placeholder is never substituted in the body, OR a placeholder used in the body whose entry is missing from `requiredInputs[]`. Both directions surface under this kind; the message text disambiguates. `{{output_language}}` is exempt (CLI-injected at render time per `PLACEHOLDER_ENTITY_EXEMPT_FROM_REQUIRED_INPUTS`). Bare `{{<entity>}}` (without `.<segment>` and without `Ref` suffix) is silently ignored on both sides. |
94
+
95
+ ## Workflow
96
+
97
+ ### Step 1 — Wire the validator at bootstrap
98
+
99
+ Run the validator once at app boot, after the `MarketSnapshot` has
100
+ been imported and **before** any consumer (FIT scorer, prompt
101
+ enrichment, market generation agent) touches it.
102
+
103
+ <!-- TIER C WAIVER: bootstrap wiring is per-application code that lives in the consumer (not the framework); no canonical anchor exists or should exist. The example below is a copy-paste template for app developers wiring validation at boot. -->
104
+ ```ts
105
+ import { validateMarketSnapshot } from '@wildo-ai/saas-specifications';
106
+ import { BusinessConfigError } from '@wildo-ai/saas-backend-lib';
107
+
108
+ const result = validateMarketSnapshot(applicationMarketSnapshot, {
109
+ availableFeatureRefs: featureRegistry.allRefs(),
110
+ availableProductRefs: productRegistry.allRefs(),
111
+ });
112
+
113
+ if (!result.ok) {
114
+ const errors = result.issues.filter(i => i.severity === 'ERROR');
115
+ throw new BusinessConfigError(
116
+ `Market snapshot has ${errors.length} ERROR-severity issue(s)`,
117
+ { issues: errors },
118
+ );
119
+ }
120
+ for (const warn of result.issues.filter(i => i.severity === 'WARN')) {
121
+ logger.warn({ kind: warn.kind, path: warn.path }, warn.message);
122
+ }
123
+ ```
124
+
125
+ ### Step 2 — Pass cross-family ref sets when available
126
+
127
+ The optional `availableFeatureRefs` and `availableProductRefs` sets
128
+ unlock the cross-family orphan check:
129
+
130
+ - Without `availableFeatureRefs`: `FeatureBenefit.deliveredByFeatureRefs[]`
131
+ refs are NOT cross-checked (only intra-snapshot refs are).
132
+ - Without `availableProductRefs`: `MarketICP.recommendedProductRefs[]`
133
+ and `upsellPathProductRefs[]` are NOT cross-checked.
134
+
135
+ Pass the sets in production; omit them only in unit tests where the
136
+ focus is on intra-snapshot invariants.
137
+
138
+ ### Step 3 — Override `now` for staleness in tests
139
+
140
+ The `STALE_AUTHORED` detector defaults `now = new Date()`. Override
141
+ it in tests so the result is deterministic regardless of when the
142
+ test runs:
143
+
144
+ ```ts
145
+ validateMarketSnapshot(snapshot, { now: new Date('2026-04-17T00:00:00Z') });
146
+ ```
147
+
148
+ ### Step 4 — Treat severity boundaries as a hard contract
149
+
150
+ - ERROR ⇒ throw at boot (the snapshot is not safe to consume).
151
+ - WARN ⇒ log + dashboard, never throw (intentional design choice
152
+ for `STALE_AUTHORED`, `DUPLICATE_EDGE_PER_ENTITY`, multi-node
153
+ `INFLUENCE_CYCLE`).
154
+
155
+ ## Validator shape (source)
156
+
157
+ ## Import Origins
158
+
159
+ - `@wildo-ai/saas-specifications`
160
+
161
+ ## Source Excerpts
162
+
163
+ ### Origin Package: `@wildo-ai/saas-specifications`
164
+
165
+ ```typescript
166
+ *
167
+ * Authoring-consistency validator for an assembled `MarketSnapshot`.
168
+ *
169
+ * The function is a **pure**, **typed** graph walker over the
170
+ * snapshot — no Zod introspection, no LocalizedString visitor, no
171
+ * runtime registry access. Each rule is implemented as a tiny
172
+ * standalone detector composed by the top-level
173
+ * `validateMarketSnapshot`.
174
+ *
175
+ * Rule table — currently 18 kinds:
176
+ *
177
+ * | Kind | Severity | Trigger |
178
+ * |--------------------------------------------|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
179
+ * | `ORPHAN_REF` | ERROR | A `<entity>Ref` does not resolve inside the snapshot. Cross-family refs (`featureRefs`, `productRefs`) are skipped if no set is passed. |
180
+ * | `MULTIPLE_THRESHOLDS_PER_ICP_JOB` | ERROR | An (icpRef, jobRef) cluster has more than one distinct benefit with `kanoCategory: THRESHOLD`. Deduped by benefit `ref`. |
181
+ * | `THRESHOLD_BENEFIT_WITHOUT_JOB` | ERROR | A benefit declares any `kanoCategory: THRESHOLD` entry but `advances[]` is empty (no job to anchor the THRESHOLD claim against). |
182
+ * | `EMPTY_BENEFIT_DELIVERED_BY` | ERROR | A `FeatureBenefit.deliveredByFeatureRefs[]` is empty (defence in depth — Zod also rejects). |
183
+ * | `ICP_WITHOUT_PERSONA` | ERROR (LEGAL_ENTITY) / WARN (INDIVIDUAL) | A non-`ANTI_TARGET` ICP has no persona pointing at its `ref` via `belongsToIcpRefs`. |
184
+ * | `INFLUENCE_CYCLE` | ERROR (self-loop) / WARN (multi-node) | Cycle in the ICP→ICP influence graph. Self-loops are always ERROR; non-trivial cycles are WARN (real GTM dynamics may include them). |
185
+ * | `MISSING_POSITIONING_FOR_ICP` | ERROR | An ICP of priority `CORE` or `EXPANSION` has no `MarketPositioning`. Other priorities exempt. |
186
+ * | `STALE_AUTHORED` | WARN | `lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |
187
+ * | `DUPLICATE_EDGE_PER_ENTITY` | WARN | Same target ref appears twice in the same edge list. Covers ICP/persona `pains/gains/jobs` (by edge ref) and benefit `importanceByICP` (by `icpRef`). |
188
+ * | `INVALID_ANTI_TARGET_PURPOSE_MIX` | ERROR | `priority === ANTI_TARGET` and `purposeMix !== { adoption: 0, revenue: 0 }`. |
189
+ * | `BUYING_GROUP_PERSONA_MISSING_DMU_ROLE` | ERROR | `personaScope === BUYING_GROUP_MEMBER` and `dmuRole` is undefined. |
190
+ * | `BUYING_GROUP_BACKLINK_MISSING` | ERROR | An ICP's `buyingGroup[].personaRef` resolves to a persona whose `belongsToIcpRefs[]` does NOT include the ICP (asymmetric link). |
191
+ * | `PROOF_WITHOUT_SUPPORT` | WARN | A `MarketProof` carries empty `supportsBenefitRefs[]` AND empty `supportsIcpRefs[]`. |
192
+ * | `PROOF_KIND_PAYLOAD_MISMATCH` | WARN | A `MarketProof` carries a payload incoherent with its `proofKind` (`METRIC` without `metric`, `LOGO` with `metric`). |
193
+ * | `DUPLICATE_JOURNEY_STAGE` | ERROR | A `MarketBuyingJourney` lists the same `BuyingJourneyStage` enum value more than once. |
194
+ * | `DUPLICATE_BUYING_JOURNEY_FOR_ICP` | ERROR | Two `MarketBuyingJourney` entries point at the same `icpRef`. The model is "one journey per ICP". |
195
+ * | `OBJECTION_PROOF_BENEFIT_MISMATCH` | WARN | An objection cites `proofRefs[]` whose union of `supportsBenefitRefs[]` ∪ `supportsIcpRefs[]` does not intersect `relatedBenefitRefs[]` ∪ `raisedByIcpRefs[]`. |
196
+ * | `MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH` | WARN | A `MarketMessageTemplate` declares a `requiredInputs[]` entry that no `{{<entity>.*}}` / `{{<entity>Ref}}` placeholder consumes — or vice-versa. `{{output_language}}` is exempt (CLI-injected at render time). |
197
+ *
198
+ * Issue ordering inside `result.issues[]` is detector-order, then
199
+ * snapshot-walk order. It is **not** a stable contract — callers
200
+ * must group/sort by `kind` + `severity` themselves.
201
+ *
202
+ * Loaded by application registries at boot. Callers should:
203
+ * - throw a `BusinessConfigError` (re-exported from
204
+ * `@wildo-ai/saas-backend-lib`) when `result.ok === false`,
205
+ * listing every ERROR-severity issue;
206
+ * - log WARN-severity issues through the standard backend logger.
207
+ *
208
+ * The validator never mutates the snapshot.
209
+ */
210
+ export enum MarketSnapshotIssueKind {
211
+ ORPHAN_REF = 'ORPHAN_REF',
212
+ MULTIPLE_THRESHOLDS_PER_ICP_JOB = 'MULTIPLE_THRESHOLDS_PER_ICP_JOB',
213
+ /**
214
+ * A benefit declares any `kanoCategory: THRESHOLD` entry on
215
+ * `importanceByICP[]` but its `advances[]` is empty. THRESHOLD is
216
+ * defined as "table-stakes for a specific (icp, job)" — without a
217
+ * job to anchor against, the THRESHOLD claim has no semantic
218
+ * cluster and the `MULTIPLE_THRESHOLDS_PER_ICP_JOB` invariant is
219
+ * structurally bypassed (ERROR).
220
+ */
221
+ THRESHOLD_BENEFIT_WITHOUT_JOB = 'THRESHOLD_BENEFIT_WITHOUT_JOB',
222
+ EMPTY_BENEFIT_DELIVERED_BY = 'EMPTY_BENEFIT_DELIVERED_BY',
223
+ ICP_WITHOUT_PERSONA = 'ICP_WITHOUT_PERSONA',
224
+ INFLUENCE_CYCLE = 'INFLUENCE_CYCLE',
225
+ MISSING_POSITIONING_FOR_ICP = 'MISSING_POSITIONING_FOR_ICP',
226
+ STALE_AUTHORED = 'STALE_AUTHORED',
227
+ /**
228
+ * Same target ref appears more than once in the same per-entity
229
+ * edge list. Currently covers:
230
+ * - ICP and persona `pains[].painRef`, `gains[].gainRef`,
231
+ * `jobs[].jobRef` — typically the result of an `inheritFrom()`
232
+ * spread followed by a forgotten `.filter()` step;
233
+ * - benefit `importanceByICP[].icpRef` — duplicate (benefit, icp)
234
+ * pairs make per-ICP scoring non-deterministic.
235
+ *
236
+ * Severity is WARN — the snapshot still parses, but the duplicate
237
+ * edge silently double-counts in downstream FIT scoring.
238
+ */
239
+ DUPLICATE_EDGE_PER_ENTITY = 'DUPLICATE_EDGE_PER_ENTITY',
240
+ INVALID_ANTI_TARGET_PURPOSE_MIX = 'INVALID_ANTI_TARGET_PURPOSE_MIX',
241
+ BUYING_GROUP_PERSONA_MISSING_DMU_ROLE = 'BUYING_GROUP_PERSONA_MISSING_DMU_ROLE',
242
+ /**
243
+ * An ICP's `buyingGroup[].personaRef` resolves to a persona, but
244
+ * the persona's `belongsToIcpRefs[]` does not contain the ICP. The
245
+ * link is asymmetric and downstream consumers (DMU rendering,
246
+ * persona-by-ICP indexing) silently drop the persona. ERROR.
247
+ */
248
+ BUYING_GROUP_BACKLINK_MISSING = 'BUYING_GROUP_BACKLINK_MISSING',
249
+ /** A proof entity that supports neither a benefit nor an ICP — has no place to land in copy (WARN). */
250
+ PROOF_WITHOUT_SUPPORT = 'PROOF_WITHOUT_SUPPORT',
251
+ /**
252
+ * A `MarketProof` carries a payload incoherent with its
253
+ * `proofKind`. The schema is permissive (both `attribution` and
254
+ * `metric` are optional on every kind). This detector catches the
255
+ * strongest mismatches as authoring drift (WARN — the spec parses,
256
+ * but the proof renders badly):
257
+ * - `METRIC` without a `metric` block;
258
+ * - `LOGO` with a `metric` block.
259
+ */
260
+ PROOF_KIND_PAYLOAD_MISMATCH = 'PROOF_KIND_PAYLOAD_MISMATCH',
261
+ /** Same `BuyingJourneyStage` enum value listed twice on a single journey (ERROR). */
262
+ DUPLICATE_JOURNEY_STAGE = 'DUPLICATE_JOURNEY_STAGE',
263
+ /** Two `MarketBuyingJourney` entries point at the same `icpRef`. The model is one journey per ICP (ERROR). */
264
+ DUPLICATE_BUYING_JOURNEY_FOR_ICP = 'DUPLICATE_BUYING_JOURNEY_FOR_ICP',
265
+ /** Objection's cited proofs do not back any of its `relatedBenefitRefs` or `raisedByIcpRefs` (WARN). */
266
+ OBJECTION_PROOF_BENEFIT_MISMATCH = 'OBJECTION_PROOF_BENEFIT_MISMATCH',
267
+ /**
268
+ * A `MarketMessageTemplate` has a mismatch between its declared
269
+ * `requiredInputs[]` and the `{{<entity>.*}}` / `{{<entity>Ref}}`
270
+ * placeholders that actually appear inside `promptTemplate`.
271
+ *
272
+ * Two symmetric cases:
273
+ * 1. Declared but unused — `requiredInputs` lists `icpRef` but the
274
+ * body has no `{{icp.*}}` / `{{icpRef}}` reference. The CLI will
275
+ * require the caller to pass the input but never substitute it.
276
+ * 2. Used but undeclared — the body references `{{benefit.claim}}`
277
+ * but `requiredInputs` does not include `benefitRef`. The CLI
278
+ * will not enforce the input and the placeholder will render
279
+ * literally (e.g. `{{benefit.claim}}`).
280
+ *
281
+ * The `{{output_language}}` placeholder is **exempt** from this
282
+ * check: it is injected by the market generation CLI from the
283
+ * `--output-language` flag, not from `requiredInputs[]`.
284
+ *
285
+ * WARN severity — the snapshot still parses and the template still
286
+ * renders, but the output will be off-spec at runtime. Authors
287
+ * should either prune the unused entry from `requiredInputs[]` or
288
+ * add the missing placeholder / entry.
289
+ */
290
+ MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH = 'MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH',
291
+ }
292
+
293
+ export type MarketSnapshotIssueSeverity = 'ERROR' | 'WARN';
294
+
295
+ export interface MarketSnapshotIssue {
296
+ kind: MarketSnapshotIssueKind;
297
+ /** Dotted path inside the snapshot (e.g. `'icps[0].pains[2].painRef'`). */
298
+ path: string;
299
+ message: string;
300
+ severity: MarketSnapshotIssueSeverity;
301
+ }
302
+
303
+ export interface MarketSnapshotValidationResult {
304
+ /** `true` iff no issue has severity `ERROR`. */
305
+ ok: boolean;
306
+ issues: MarketSnapshotIssue[];
307
+ }
308
+
309
+ export interface ValidateMarketSnapshotOptions {
310
+ /**
311
+ * Cross-family ref check for `FeatureBenefit.deliveredByFeatureRefs`.
312
+ * Pass the application's full feature-spec key set; orphans are
313
+ * reported as `ORPHAN_REF`. When omitted, the cross-family check is
314
+ * SKIPPED (intra-snapshot orphans are still detected).
315
+ */
316
+ availableFeatureRefs?: ReadonlySet<string>;
317
+ /**
318
+ * Cross-family ref check for `MarketICP.recommendedProductRefs` /
319
+ * `upsellPathProductRefs`. Same skip-when-omitted semantics.
320
+ */
321
+ availableProductRefs?: ReadonlySet<string>;
322
+ /** Override "now" for `STALE_AUTHORED` checks (test affordance). Defaults to `new Date()`. */
323
+ now?: Date;
324
+ }
325
+
326
+ export function validateMarketSnapshot(
327
+ snapshot: MarketSnapshot,
328
+ options?: ValidateMarketSnapshotOptions,
329
+ ): MarketSnapshotValidationResult {
330
+ const issues: MarketSnapshotIssue[] = [];
331
+
332
+ detectOrphanRefs(snapshot, options, issues);
333
+ detectThresholdBenefitsWithoutJob(snapshot, issues);
334
+ detectMultipleThresholdsPerIcpJob(snapshot, issues);
335
+ detectEmptyBenefitDeliveredBy(snapshot, issues);
336
+ detectIcpWithoutPersona(snapshot, issues);
337
+ detectInfluenceCycles(snapshot, issues);
338
+ detectMissingPositioningForIcp(snapshot, issues);
339
+ detectStaleAuthored(snapshot, options?.now ?? new Date(), issues);
340
+ detectDuplicateEdgesPerEntity(snapshot, issues);
341
+ detectInvalidAntiTargetPurposeMix(snapshot, issues);
342
+ detectBuyingGroupPersonasMissingDmuRole(snapshot, issues);
343
+ detectBuyingGroupBacklinkMissing(snapshot, issues);
344
+ detectProofsWithoutSupport(snapshot, issues);
345
+ detectProofKindPayloadMismatch(snapshot, issues);
346
+ detectDuplicateJourneyStages(snapshot, issues);
347
+ detectDuplicateBuyingJourneyForIcp(snapshot, issues);
348
+ detectObjectionProofBenefitMismatch(snapshot, issues);
349
+ detectMessageTemplatePlaceholderMismatch(snapshot, issues);
350
+
351
+ const ok = issues.every(i => i.severity !== 'ERROR');
352
+ return { ok, issues };
353
+ }
354
+
355
+ // ────────────────────────────────────────────────────────────────────
356
+ // Detectors — one per rule, kept small and independently testable.
357
+ // ────────────────────────────────────────────────────────────────────
358
+
359
+ function detectOrphanRefs(
360
+ snapshot: MarketSnapshot,
361
+ options: ValidateMarketSnapshotOptions | undefined,
362
+ issues: MarketSnapshotIssue[],
363
+ ): void {
364
+ const icpRefs = new Set(snapshot.icps.map(i => i.ref));
365
+ const personaRefs = new Set(snapshot.personas.map(p => p.ref));
366
+ const jobRefs = new Set(snapshot.jobs.map(j => j.ref));
367
+ const painRefs = new Set(snapshot.pains.map(p => p.ref));
368
+ const gainRefs = new Set(snapshot.gains.map(g => g.ref));
369
+ const voiceRefs = new Set(snapshot.tonesOfVoice.map(v => v.ref));
370
+ const benefitRefs = new Set(snapshot.benefits.map(b => b.ref));
371
+ const channelRefs = new Set(snapshot.channels.map(c => c.ref));
372
+ const alternativeRefs = new Set(snapshot.alternatives.map(a => a.ref));
373
+ const triggerRefs = new Set(snapshot.triggers.map(t => t.ref));
374
+ const proofRefs = new Set(snapshot.proofs.map(p => p.ref));
375
+ const objectionRefs = new Set(snapshot.objections.map(o => o.ref));
376
+
377
+ const reportOrphan = (path: string, ref: string, kind: string): void => {
378
+ issues.push({
379
+ kind: MarketSnapshotIssueKind.ORPHAN_REF,
380
+ path,
381
+ message: `${kind} ref "${ref}" at ${path} does not resolve inside the snapshot.`,
382
+ severity: 'ERROR',
383
+ });
384
+ };
385
+
386
+ // ICP edges + cross-family + influences + voices + Phase-3 ref arrays.
387
+ for (const [iIdx, icp] of snapshot.icps.entries()) {
388
+ const basePath = `icps[${iIdx}]`;
389
+
390
+ icp.buyingGroup.forEach((entry, idx) => {
391
+ if (!personaRefs.has(entry.personaRef)) {
392
+ reportOrphan(`${basePath}.buyingGroup[${idx}].personaRef`, entry.personaRef, 'persona');
393
+ }
394
+ });
395
+ icp.jobs.forEach((edge, idx) => {
396
+ if (!jobRefs.has(edge.jobRef)) reportOrphan(`${basePath}.jobs[${idx}].jobRef`, edge.jobRef, 'job');
397
+ });
398
+ icp.pains.forEach((edge, idx) => {
399
+ if (!painRefs.has(edge.painRef)) reportOrphan(`${basePath}.pains[${idx}].painRef`, edge.painRef, 'pain');
400
+ });
401
+ icp.gains.forEach((edge, idx) => {
402
+ if (!gainRefs.has(edge.gainRef)) reportOrphan(`${basePath}.gains[${idx}].gainRef`, edge.gainRef, 'gain');
403
+ });
404
+ icp.influences.forEach((edge, idx) => {
405
+ if (!icpRefs.has(edge.icpRef)) reportOrphan(`${basePath}.influences[${idx}].icpRef`, edge.icpRef, 'icp');
406
+ });
407
+ if (icp.preferredVoiceRef !== undefined && !voiceRefs.has(icp.preferredVoiceRef)) {
408
+ reportOrphan(`${basePath}.preferredVoiceRef`, icp.preferredVoiceRef, 'voice');
409
+ }
410
+
411
+ // Phase-3 ICP ref arrays (channels / triggers / alternatives /
412
+ // proofs / objections). All are intra-snapshot — no caller-supplied
413
+ // set required. Orphans here silently waste downstream targeting
414
+ // (channel never reached, trigger never observed) so ERROR is the
415
+ // right severity (D16).
416
+ icp.channelRefs.forEach((ref, idx) => {
417
+ if (!channelRefs.has(ref)) reportOrphan(`${basePath}.channelRefs[${idx}]`, ref, 'channel');
418
+ });
419
+ icp.triggerRefs.forEach((ref, idx) => {
420
+ if (!triggerRefs.has(ref)) reportOrphan(`${basePath}.triggerRefs[${idx}]`, ref, 'trigger');
421
+ });
422
+ icp.alternativeRefs.forEach((ref, idx) => {
423
+ if (!alternativeRefs.has(ref)) reportOrphan(`${basePath}.alternativeRefs[${idx}]`, ref, 'alternative');
424
+ });
425
+ icp.proofRefs.forEach((ref, idx) => {
426
+ if (!proofRefs.has(ref)) reportOrphan(`${basePath}.proofRefs[${idx}]`, ref, 'proof');
427
+ });
428
+ icp.objectionRefs.forEach((ref, idx) => {
429
+ if (!objectionRefs.has(ref)) reportOrphan(`${basePath}.objectionRefs[${idx}]`, ref, 'objection');
430
+ });
431
+
432
+ if (options?.availableProductRefs !== undefined) {
433
+ icp.recommendedProductRefs.forEach((ref, idx) => {
434
+ if (!options.availableProductRefs!.has(ref)) {
435
+ reportOrphan(`${basePath}.recommendedProductRefs[${idx}]`, ref, 'product');
436
+ }
437
+ });
438
+ icp.upsellPathProductRefs.forEach((ref, idx) => {
439
+ if (!options.availableProductRefs!.has(ref)) {
440
+ reportOrphan(`${basePath}.upsellPathProductRefs[${idx}]`, ref, 'product');
441
+ }
442
+ });
443
+ }
444
+ }
445
+
446
+ // Persona edges + cross-family voice ref + parent ICP refs + Phase-3
447
+ // channel refs.
448
+ for (const [pIdx, persona] of snapshot.personas.entries()) {
449
+ const basePath = `personas[${pIdx}]`;
450
+
451
+ persona.belongsToIcpRefs.forEach((ref, idx) => {
452
+ if (!icpRefs.has(ref)) reportOrphan(`${basePath}.belongsToIcpRefs[${idx}]`, ref, 'icp');
453
+ });
454
+ persona.jobs.forEach((edge, idx) => {
455
+ if (!jobRefs.has(edge.jobRef)) reportOrphan(`${basePath}.jobs[${idx}].jobRef`, edge.jobRef, 'job');
456
+ });
457
+ persona.pains.forEach((edge, idx) => {
458
+ if (!painRefs.has(edge.painRef)) reportOrphan(`${basePath}.pains[${idx}].painRef`, edge.painRef, 'pain');
459
+ });
460
+ persona.gains.forEach((edge, idx) => {
461
+ if (!gainRefs.has(edge.gainRef)) reportOrphan(`${basePath}.gains[${idx}].gainRef`, edge.gainRef, 'gain');
462
+ });
463
+ persona.channelRefs.forEach((ref, idx) => {
464
+ if (!channelRefs.has(ref)) reportOrphan(`${basePath}.channelRefs[${idx}]`, ref, 'channel');
465
+ });
466
+ if (persona.preferredVoiceRef !== undefined && !voiceRefs.has(persona.preferredVoiceRef)) {
467
+ reportOrphan(`${basePath}.preferredVoiceRef`, persona.preferredVoiceRef, 'voice');
468
+ }
469
+ }
470
+
471
+ // Benefits — pain/gain/job + ICP refs + cross-family feature refs +
472
+ // Phase-3 proof / objection back-refs.
473
+ for (const [bIdx, benefit] of snapshot.benefits.entries()) {
474
+ const basePath = `benefits[${bIdx}]`;
475
+
476
+ benefit.relieves.forEach((edge, idx) => {
477
+ if (!painRefs.has(edge.painRef)) {
478
+ reportOrphan(`${basePath}.relieves[${idx}].painRef`, edge.painRef, 'pain');
479
+ }
480
+ });
481
+ benefit.creates.forEach((edge, idx) => {
482
+ if (!gainRefs.has(edge.gainRef)) {
483
+ reportOrphan(`${basePath}.creates[${idx}].gainRef`, edge.gainRef, 'gain');
484
+ }
485
+ });
486
+ benefit.advances.forEach((edge, idx) => {
487
+ if (!jobRefs.has(edge.jobRef)) {
488
+ reportOrphan(`${basePath}.advances[${idx}].jobRef`, edge.jobRef, 'job');
489
+ }
490
+ });
491
+ benefit.importanceByICP.forEach((edge, idx) => {
492
+ if (!icpRefs.has(edge.icpRef)) {
493
+ reportOrphan(`${basePath}.importanceByICP[${idx}].icpRef`, edge.icpRef, 'icp');
494
+ }
495
+ });
496
+ benefit.proofRefs.forEach((ref, idx) => {
497
+ if (!proofRefs.has(ref)) reportOrphan(`${basePath}.proofRefs[${idx}]`, ref, 'proof');
498
+ });
499
+ benefit.addressesObjectionRefs.forEach((ref, idx) => {
500
+ if (!objectionRefs.has(ref)) {
501
+ reportOrphan(`${basePath}.addressesObjectionRefs[${idx}]`, ref, 'objection');
502
+ }
503
+ });
504
+
505
+ if (options?.availableFeatureRefs !== undefined) {
506
+ benefit.deliveredByFeatureRefs.forEach((ref, idx) => {
507
+ if (!options.availableFeatureRefs!.has(ref)) {
508
+ reportOrphan(`${basePath}.deliveredByFeatureRefs[${idx}]`, ref, 'feature');
509
+ }
510
+ });
511
+ }
512
+ }
513
+
514
+ // Positionings — back to ICP + benefits + alternatives.
515
+ for (const [pIdx, positioning] of snapshot.positionings.entries()) {
516
+ const basePath = `positionings[${pIdx}]`;
517
+
518
+ if (!icpRefs.has(positioning.icpRef)) {
519
+ reportOrphan(`${basePath}.icpRef`, positioning.icpRef, 'icp');
520
+ }
521
+ if (positioning.preferredVoiceRef !== undefined && !voiceRefs.has(positioning.preferredVoiceRef)) {
522
+ reportOrphan(`${basePath}.preferredVoiceRef`, positioning.preferredVoiceRef, 'voice');
523
+ }
524
+ positioning.valuePillars.forEach((pillar, idx) => {
525
+ pillar.backedByBenefitRefs.forEach((ref, j) => {
526
+ if (!benefitRefs.has(ref)) {
527
+ reportOrphan(`${basePath}.valuePillars[${idx}].backedByBenefitRefs[${j}]`, ref, 'benefit');
528
+ }
529
+ });
530
+ });
531
+ positioning.alternativesContrasted.forEach((entry, idx) => {
532
+ if (!alternativeRefs.has(entry.alternativeRef)) {
533
+ reportOrphan(
534
+ `${basePath}.alternativesContrasted[${idx}].alternativeRef`,
535
+ entry.alternativeRef,
536
+ 'alternative',
537
+ );
538
+ }
539
+ });
540
+ }
541
+
542
+ // Triggers — affected ICPs + recommended channels.
543
+ for (const [tIdx, trigger] of snapshot.triggers.entries()) {
544
+ const basePath = `triggers[${tIdx}]`;
545
+ trigger.affectedIcpRefs.forEach((ref, idx) => {
546
+ if (!icpRefs.has(ref)) reportOrphan(`${basePath}.affectedIcpRefs[${idx}]`, ref, 'icp');
547
+ });
548
+ trigger.recommendedChannelRefs.forEach((ref, idx) => {
549
+ if (!channelRefs.has(ref)) reportOrphan(`${basePath}.recommendedChannelRefs[${idx}]`, ref, 'channel');
550
+ });
551
+ }
552
+
553
+ // Buying journeys — back to ICP.
554
+ for (const [jIdx, journey] of snapshot.buyingJourneys.entries()) {
555
+ const basePath = `buyingJourneys[${jIdx}]`;
556
+ if (!icpRefs.has(journey.icpRef)) {
557
+ reportOrphan(`${basePath}.icpRef`, journey.icpRef, 'icp');
558
+ }
559
+ }
560
+
561
+ // Proofs — supports benefits + ICPs.
562
+ for (const [pIdx, proof] of snapshot.proofs.entries()) {
563
+ const basePath = `proofs[${pIdx}]`;
564
+ proof.supportsBenefitRefs.forEach((ref, idx) => {
565
+ if (!benefitRefs.has(ref)) reportOrphan(`${basePath}.supportsBenefitRefs[${idx}]`, ref, 'benefit');
566
+ });
567
+ proof.supportsIcpRefs.forEach((ref, idx) => {
568
+ if (!icpRefs.has(ref)) reportOrphan(`${basePath}.supportsIcpRefs[${idx}]`, ref, 'icp');
569
+ });
570
+ }
571
+
572
+ // Objections — raised by ICPs + personas, cite proofs + related benefits.
573
+ for (const [oIdx, objection] of snapshot.objections.entries()) {
574
+ const basePath = `objections[${oIdx}]`;
575
+ objection.raisedByIcpRefs.forEach((ref, idx) => {
576
+ if (!icpRefs.has(ref)) reportOrphan(`${basePath}.raisedByIcpRefs[${idx}]`, ref, 'icp');
577
+ });
578
+ objection.raisedByPersonaRefs.forEach((ref, idx) => {
579
+ if (!personaRefs.has(ref)) reportOrphan(`${basePath}.raisedByPersonaRefs[${idx}]`, ref, 'persona');
580
+ });
581
+ objection.proofRefs.forEach((ref, idx) => {
582
+ if (!proofRefs.has(ref)) reportOrphan(`${basePath}.proofRefs[${idx}]`, ref, 'proof');
583
+ });
584
+ objection.relatedBenefitRefs.forEach((ref, idx) => {
585
+ if (!benefitRefs.has(ref)) reportOrphan(`${basePath}.relatedBenefitRefs[${idx}]`, ref, 'benefit');
586
+ });
587
+ }
588
+
589
+ // Message templates — Phase-2 slot, Phase-4 fill. The preferred-voice
590
+ // ref MUST resolve when authored, otherwise the market generation CLI
591
+ // silently falls back to the default voice and produces off-brand
592
+ // copy.
593
+ for (const [tIdx, template] of snapshot.messageTemplates.entries()) {
594
+ const basePath = `messageTemplates[${tIdx}]`;
595
+ if (template.preferredVoiceRef !== undefined && !voiceRefs.has(template.preferredVoiceRef)) {
596
+ reportOrphan(`${basePath}.preferredVoiceRef`, template.preferredVoiceRef, 'voice');
597
+ }
598
+ }
599
+ }
600
+
601
+ /**
602
+ * D4 invariant: at most ONE THRESHOLD-classified benefit per
603
+ * `(icpRef, jobRef)` cluster. THRESHOLD means "table-stakes — without
604
+ * it the offer is rejected", so two competing THRESHOLDs against the
605
+ * same (icp, job) means we have two unrelated table-stakes claims for
606
+ * the same outcome which is structurally undefined for the FIT scorer
607
+ * (`market-scoring.ts`).
608
+ *
609
+ * The detector dedupes per benefit by tracking the SET of benefit
610
+ * `ref`s per (icp, job) — repeated `advances[]` entries on the SAME
611
+ * benefit (which is itself a `DUPLICATE_EDGE_PER_ENTITY` WARN) do not
612
+ * double-count and therefore do not trigger a false-positive ERROR
613
+ * here. Benefits with empty `advances[]` are caught by
614
+ * `THRESHOLD_BENEFIT_WITHOUT_JOB` (ERROR) — they would otherwise
615
+ * structurally bypass this rule by having no (icp, job) cluster to
616
+ * be counted in.
617
+ */
618
+ function detectMultipleThresholdsPerIcpJob(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
619
+ const benefitRefsByJobByIcp = new Map<string, Map<string, Set<string>>>();
620
+
621
+ for (const benefit of snapshot.benefits) {
622
+ const icpRefsWithThreshold = new Set(
623
+ benefit.importanceByICP
624
+ .filter(e => e.kanoCategory === BenefitKanoCategory.THRESHOLD)
625
+ .map(e => e.icpRef),
626
+ );
627
+ if (icpRefsWithThreshold.size === 0) continue;
628
+
629
+ const distinctJobRefs = new Set(benefit.advances.map(e => e.jobRef));
630
+ if (distinctJobRefs.size === 0) continue; // caught by THRESHOLD_BENEFIT_WITHOUT_JOB
631
+
632
+ for (const icpRef of icpRefsWithThreshold) {
633
+ const byJob = benefitRefsByJobByIcp.get(icpRef) ?? new Map<string, Set<string>>();
634
+ for (const jobRef of distinctJobRefs) {
635
+ const set = byJob.get(jobRef) ?? new Set<string>();
636
+ set.add(benefit.ref);
637
+ byJob.set(jobRef, set);
638
+ }
639
+ benefitRefsByJobByIcp.set(icpRef, byJob);
640
+ }
641
+ }
642
+
643
+ for (const [icpRef, byJob] of benefitRefsByJobByIcp.entries()) {
644
+ for (const [jobRef, refsSet] of byJob.entries()) {
645
+ if (refsSet.size > 1) {
646
+ const refs = [...refsSet].join(', ');
647
+ issues.push({
648
+ kind: MarketSnapshotIssueKind.MULTIPLE_THRESHOLDS_PER_ICP_JOB,
649
+ path: `benefits.importanceByICP[icp=${icpRef}].advances[job=${jobRef}]`,
650
+ message: `ICP "${icpRef}" job "${jobRef}" has multiple THRESHOLD benefits (${refs}). Only one THRESHOLD per (icp, job) cluster is allowed.`,
651
+ severity: 'ERROR',
652
+ });
653
+ }
654
+ }
655
+ }
656
+ }
657
+
658
+ /**
659
+ * Companion to `MULTIPLE_THRESHOLDS_PER_ICP_JOB`. THRESHOLD is defined
660
+ * as a per-(ICP, job) classification — a benefit that declares any
661
+ * `kanoCategory: THRESHOLD` entry on `importanceByICP[]` MUST also
662
+ * advance at least one job, otherwise the invariant has no anchor and
663
+ * the FIT scorer cannot place the table-stakes claim. ERROR.
664
+ */
665
+ function detectThresholdBenefitsWithoutJob(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
666
+ for (const [bIdx, benefit] of snapshot.benefits.entries()) {
667
+ const hasThreshold = benefit.importanceByICP.some(
668
+ e => e.kanoCategory === BenefitKanoCategory.THRESHOLD,
669
+ );
670
+ if (!hasThreshold) continue;
671
+ if (benefit.advances.length > 0) continue;
672
+
673
+ const thresholdIcpRefs = benefit.importanceByICP
674
+ .filter(e => e.kanoCategory === BenefitKanoCategory.THRESHOLD)
675
+ .map(e => e.icpRef)
676
+ .join(', ');
677
+ issues.push({
678
+ kind: MarketSnapshotIssueKind.THRESHOLD_BENEFIT_WITHOUT_JOB,
679
+ path: `benefits[${bIdx}].advances`,
680
+ message: `Benefit "${benefit.ref}" is THRESHOLD for ICP(s) [${thresholdIcpRefs}] but advances[] is empty. THRESHOLD is a per-(icp, job) claim — add at least one BenefitAdvancesJob entry, or downgrade kanoCategory to PERFORMANCE/DELIGHTER.`,
681
+ severity: 'ERROR',
682
+ });
683
+ }
684
+ }
685
+
686
+ function detectEmptyBenefitDeliveredBy(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
687
+ // The schema enforces `.min(1)`; this detector remains as a defence
688
+ // in depth for callers that bypass parsing (legitimate scenario:
689
+ // tests building snapshots with type-asserted fixtures).
690
+ for (const [bIdx, benefit] of snapshot.benefits.entries()) {
691
+ if (benefit.deliveredByFeatureRefs.length === 0) {
692
+ issues.push({
693
+ kind: MarketSnapshotIssueKind.EMPTY_BENEFIT_DELIVERED_BY,
694
+ path: `benefits[${bIdx}].deliveredByFeatureRefs`,
695
+ message: `Benefit "${benefit.ref}" has empty deliveredByFeatureRefs[]. A benefit must be delivered by at least one feature.`,
696
+ severity: 'ERROR',
697
+ });
698
+ }
699
+ }
700
+ }
701
+
702
+ function detectIcpWithoutPersona(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
703
+ const personaParents = new Set<string>();
704
+ for (const persona of snapshot.personas) {
705
+ for (const ref of persona.belongsToIcpRefs) personaParents.add(ref);
706
+ }
707
+
708
+ for (const [iIdx, icp] of snapshot.icps.entries()) {
709
+ if (icp.priority === ICPPriority.ANTI_TARGET) continue;
710
+ if (personaParents.has(icp.ref)) continue;
711
+
712
+ const severity: MarketSnapshotIssueSeverity =
713
+ icp.archetype === ICPArchetype.LEGAL_ENTITY ? 'ERROR' : 'WARN';
714
+ issues.push({
715
+ kind: MarketSnapshotIssueKind.ICP_WITHOUT_PERSONA,
716
+ path: `icps[${iIdx}].ref`,
717
+ message: `ICP "${icp.ref}" (archetype ${icp.archetype}) has no persona pointing at it. ${severity === 'ERROR' ? 'Required' : 'Recommended'} for ${icp.archetype}.`,
718
+ severity,
719
+ });
720
+ }
721
+ }
722
+
723
+ function detectInfluenceCycles(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
724
+ // Self-loops first — always ERROR.
725
+ for (const [iIdx, icp] of snapshot.icps.entries()) {
726
+ icp.influences.forEach((edge, idx) => {
727
+ if (edge.icpRef === icp.ref) {
728
+ issues.push({
729
+ kind: MarketSnapshotIssueKind.INFLUENCE_CYCLE,
730
+ path: `icps[${iIdx}].influences[${idx}].icpRef`,
731
+ message: `ICP "${icp.ref}" has a self-loop in influences[]. Self-loops are not allowed.`,
732
+ severity: 'ERROR',
733
+ });
734
+ }
735
+ });
736
+ }
737
+
738
+ // Multi-node cycles — Tarjan-style SCC scan, report each cycle once.
739
+ const adjacency = new Map<string, string[]>();
740
+ for (const icp of snapshot.icps) {
741
+ adjacency.set(
742
+ icp.ref,
743
+ icp.influences.filter(e => e.icpRef !== icp.ref).map(e => e.icpRef),
744
+ );
745
+ }
746
+
747
+ const seenCycles = new Set<string>();
748
+ const visited = new Set<string>();
749
+
750
+ for (const startRef of adjacency.keys()) {
751
+ if (visited.has(startRef)) continue;
752
+ const stack: string[] = [];
753
+ const onStack = new Set<string>();
754
+
755
+ const dfs = (node: string): void => {
756
+ visited.add(node);
757
+ stack.push(node);
758
+ onStack.add(node);
759
+
760
+ for (const next of adjacency.get(node) ?? []) {
761
+ if (!adjacency.has(next)) continue;
762
+ if (!visited.has(next)) {
763
+ dfs(next);
764
+ } else if (onStack.has(next)) {
765
+ const cycleStart = stack.indexOf(next);
766
+ if (cycleStart >= 0) {
767
+ const cycle = stack.slice(cycleStart);
768
+ const key = [...cycle].sort().join('|');
769
+ if (!seenCycles.has(key)) {
770
+ seenCycles.add(key);
771
+ issues.push({
772
+ kind: MarketSnapshotIssueKind.INFLUENCE_CYCLE,
773
+ path: `icps[*].influences`,
774
+ message: `Influence cycle detected: ${cycle.join(' → ')} → ${next}. Cycles are accepted but emit a WARN.`,
775
+ severity: 'WARN',
776
+ });
777
+ }
778
+ }
779
+ }
780
+ }
781
+
782
+ stack.pop();
783
+ onStack.delete(node);
784
+ };
785
+
786
+ dfs(startRef);
787
+ }
788
+ }
789
+
790
+ function detectMissingPositioningForIcp(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
791
+ const positionedIcpRefs = new Set(snapshot.positionings.map(p => p.icpRef));
792
+
793
+ for (const [iIdx, icp] of snapshot.icps.entries()) {
794
+ if (icp.priority !== ICPPriority.CORE && icp.priority !== ICPPriority.EXPANSION) continue;
795
+ if (positionedIcpRefs.has(icp.ref)) continue;
796
+
797
+ issues.push({
798
+ kind: MarketSnapshotIssueKind.MISSING_POSITIONING_FOR_ICP,
799
+ path: `icps[${iIdx}].ref`,
800
+ message: `ICP "${icp.ref}" has priority ${icp.priority} but no MarketPositioning entry. CORE and EXPANSION ICPs must be positioned.`,
801
+ severity: 'ERROR',
802
+ });
803
+ }
804
+ }
805
+
806
+ const REVIEW_CADENCE_TO_DAYS: Record<ReviewCadence, number> = {
807
+ [ReviewCadence.WEEKLY]: 7,
808
+ [ReviewCadence.MONTHLY]: 31,
809
+ [ReviewCadence.QUARTERLY]: 92,
810
+ [ReviewCadence.YEARLY]: 366,
811
+ [ReviewCadence.AS_NEEDED]: Number.POSITIVE_INFINITY,
812
+ };
813
+
814
+ function detectStaleAuthored(
815
+ snapshot: MarketSnapshot,
816
+ now: Date,
817
+ issues: MarketSnapshotIssue[],
818
+ ): void {
819
+ const checkAuthored = (authored: MarketAuthoredMetadata | undefined, path: string, ref: string): void => {
820
+ if (authored?.reviewCadence === undefined) return;
821
+ const days = REVIEW_CADENCE_TO_DAYS[authored.reviewCadence];
822
+ if (!Number.isFinite(days)) return;
823
+ const lastAuthored = new Date(authored.lastAuthoredAt).getTime();
824
+ if (Number.isNaN(lastAuthored)) return;
825
+ const ageMs = now.getTime() - lastAuthored;
826
+ const ageDays = ageMs / (24 * 60 * 60 * 1000);
827
+ if (ageDays > days) {
828
+ issues.push({
829
+ kind: MarketSnapshotIssueKind.STALE_AUTHORED,
830
+ path,
831
+ message: `Authored content for "${ref}" is ${Math.floor(ageDays)} days old (cadence ${authored.reviewCadence} ⇒ ${days}d). Re-author or remove the cadence.`,
832
+ severity: 'WARN',
833
+ });
834
+ }
835
+ };
836
+
837
+ snapshot.icps.forEach((icp, idx) => checkAuthored(icp.authored, `icps[${idx}].authored`, icp.ref));
838
+ snapshot.personas.forEach((p, idx) => checkAuthored(p.authored, `personas[${idx}].authored`, p.ref));
839
+ snapshot.jobs.forEach((j, idx) => checkAuthored(j.authored, `jobs[${idx}].authored`, j.ref));
840
+ snapshot.pains.forEach((p, idx) => checkAuthored(p.authored, `pains[${idx}].authored`, p.ref));
841
+ snapshot.gains.forEach((g, idx) => checkAuthored(g.authored, `gains[${idx}].authored`, g.ref));
842
+ snapshot.tonesOfVoice.forEach((v, idx) => checkAuthored(v.authored, `tonesOfVoice[${idx}].authored`, v.ref));
843
+ snapshot.benefits.forEach((b, idx) => checkAuthored(b.authored, `benefits[${idx}].authored`, b.ref));
844
+ snapshot.positionings.forEach((p, idx) => checkAuthored(p.authored, `positionings[${idx}].authored`, p.ref));
845
+ snapshot.messageTemplates.forEach((t, idx) => checkAuthored(t.authored, `messageTemplates[${idx}].authored`, t.ref));
846
+ snapshot.channels.forEach((c, idx) => checkAuthored(c.authored, `channels[${idx}].authored`, c.ref));
847
+ snapshot.alternatives.forEach((a, idx) => checkAuthored(a.authored, `alternatives[${idx}].authored`, a.ref));
848
+ snapshot.triggers.forEach((t, idx) => checkAuthored(t.authored, `triggers[${idx}].authored`, t.ref));
849
+ snapshot.buyingJourneys.forEach((j, idx) => checkAuthored(j.authored, `buyingJourneys[${idx}].authored`, j.ref));
850
+ snapshot.proofs.forEach((p, idx) => checkAuthored(p.authored, `proofs[${idx}].authored`, p.ref));
851
+ snapshot.objections.forEach((o, idx) => checkAuthored(o.authored, `objections[${idx}].authored`, o.ref));
852
+ checkAuthored(snapshot.category.authored, 'category.authored', snapshot.category.ref);
853
+ }
854
+
855
+ /**
856
+ * Per-entity duplicate-edge detection.
857
+ *
858
+ * Scope (intentionally bounded — see `DUPLICATE_EDGE_PER_ENTITY` JSDoc
859
+ * on the enum for the canonical list):
860
+ * - ICP and persona `pains[].painRef` / `gains[].gainRef` /
861
+ * `jobs[].jobRef`. Duplicates here are typically the result of an
862
+ * `inheritFrom(parentIcp)` spread followed by a forgotten
863
+ * `.filter()` step on the persona.
864
+ * - Benefit `importanceByICP[].icpRef`. Duplicates make per-ICP
865
+ * weighting non-deterministic in the FIT scorer (the last one wins
866
+ * silently). We deliberately do NOT collapse the duplicates — we
867
+ * surface them so authors fix the source instead of relying on
868
+ * detector-side normalization.
869
+ *
870
+ * NOT covered (other detectors / schema constraints handle these):
871
+ * - benefit `relieves` / `creates` / `advances` weighted edges — the
872
+ * degree might legitimately differ across entries; future work.
873
+ * - ICP `buyingGroup[].personaRef` — deduplication is enforced by
874
+ * intent (a persona is in the group exactly once); future work.
875
+ */
876
+ function detectDuplicateEdgesPerEntity(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
877
+ const reportDuplicates = (
878
+ refs: string[],
879
+ basePath: string,
880
+ field: string,
881
+ ownerRef: string,
882
+ refSubpath: string = '',
883
+ hint: string = 'Likely an inheritFrom() spread that wasn\'t deduplicated.',
884
+ ): void => {
885
+ const seen = new Set<string>();
886
+ refs.forEach((ref, idx) => {
887
+ if (seen.has(ref)) {
888
+ issues.push({
889
+ kind: MarketSnapshotIssueKind.DUPLICATE_EDGE_PER_ENTITY,
890
+ path: `${basePath}.${field}[${idx}]${refSubpath}`,
891
+ message: `${field} ref "${ref}" appears more than once on "${ownerRef}". ${hint}`,
892
+ severity: 'WARN',
893
+ });
894
+ }
895
+ seen.add(ref);
896
+ });
897
+ };
898
+
899
+ for (const [iIdx, icp] of snapshot.icps.entries()) {
900
+ const basePath = `icps[${iIdx}]`;
901
+ reportDuplicates(icp.pains.map(e => e.painRef), basePath, 'pains', icp.ref, '.painRef');
902
+ reportDuplicates(icp.gains.map(e => e.gainRef), basePath, 'gains', icp.ref, '.gainRef');
903
+ reportDuplicates(icp.jobs.map(e => e.jobRef), basePath, 'jobs', icp.ref, '.jobRef');
904
+ }
905
+ for (const [pIdx, persona] of snapshot.personas.entries()) {
906
+ const basePath = `personas[${pIdx}]`;
907
+ reportDuplicates(persona.pains.map(e => e.painRef), basePath, 'pains', persona.ref, '.painRef');
908
+ reportDuplicates(persona.gains.map(e => e.gainRef), basePath, 'gains', persona.ref, '.gainRef');
909
+ reportDuplicates(persona.jobs.map(e => e.jobRef), basePath, 'jobs', persona.ref, '.jobRef');
910
+ }
911
+ for (const [bIdx, benefit] of snapshot.benefits.entries()) {
912
+ const basePath = `benefits[${bIdx}]`;
913
+ reportDuplicates(
914
+ benefit.importanceByICP.map(e => e.icpRef),
915
+ basePath,
916
+ 'importanceByICP',
917
+ benefit.ref,
918
+ '.icpRef',
919
+ 'Each (benefit, icp) pair must appear at most once — duplicates make per-ICP weighting non-deterministic.',
920
+ );
921
+ }
922
+ }
923
+
924
+ function detectInvalidAntiTargetPurposeMix(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
925
+ for (const [iIdx, icp] of snapshot.icps.entries()) {
926
+ if (icp.priority !== ICPPriority.ANTI_TARGET) continue;
927
+ const isZero = icp.purposeMix.adoption === 0 && icp.purposeMix.revenue === 0;
928
+ if (isZero) continue;
929
+ issues.push({
930
+ kind: MarketSnapshotIssueKind.INVALID_ANTI_TARGET_PURPOSE_MIX,
931
+ path: `icps[${iIdx}].purposeMix`,
932
+ message: `ICP "${icp.ref}" has priority ANTI_TARGET but purposeMix=${JSON.stringify(icp.purposeMix)}. ANTI_TARGET ICPs MUST carry { adoption: 0, revenue: 0 }.`,
933
+ severity: 'ERROR',
934
+ });
935
+ }
936
+ }
937
+
938
+ function detectBuyingGroupPersonasMissingDmuRole(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
939
+ for (const [pIdx, persona] of snapshot.personas.entries()) {
940
+ if (persona.personaScope !== PersonaScope.BUYING_GROUP_MEMBER) continue;
941
+ if (persona.dmuRole !== undefined) continue;
942
+ issues.push({
943
+ kind: MarketSnapshotIssueKind.BUYING_GROUP_PERSONA_MISSING_DMU_ROLE,
944
+ path: `personas[${pIdx}].dmuRole`,
945
+ message: `Persona "${persona.ref}" has personaScope BUYING_GROUP_MEMBER but no dmuRole. DMU role is required for buying-group members.`,
946
+ severity: 'ERROR',
947
+ });
948
+ }
949
+ }
950
+
951
+ /**
952
+ * The ICP→persona buying-group link MUST be symmetric: when an ICP
953
+ * lists a persona in `buyingGroup[].personaRef`, the persona's
954
+ * `belongsToIcpRefs[]` MUST contain the ICP. Asymmetric links cause
955
+ * downstream consumers (DMU rendering, persona-by-ICP indexing,
956
+ * market generation targeting) to silently drop the persona because
957
+ * the `belongsToIcpRefs[]` index is the canonical traversal path.
958
+ *
959
+ * ERROR severity — this is a structural integrity bug, not authoring
960
+ * polish: the snapshot will pass parse + intent but will silently
961
+ * misbehave at runtime.
962
+ *
963
+ * Reverse direction (persona declares an ICP that does NOT list the
964
+ * persona in its `buyingGroup[]`) is intentionally NOT reported here:
965
+ * personas of `INDIVIDUAL_SELF` / `INDIVIDUAL_INFLUENCER` scope are
966
+ * legitimately attached to ICPs that have no formal buying group.
967
+ * The detector only runs the ICP→persona direction.
968
+ */
969
+ function detectBuyingGroupBacklinkMissing(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
970
+ const personasByRef = new Map(snapshot.personas.map(p => [p.ref, p] as const));
971
+
972
+ for (const [iIdx, icp] of snapshot.icps.entries()) {
973
+ icp.buyingGroup.forEach((entry, idx) => {
974
+ const persona = personasByRef.get(entry.personaRef);
975
+ if (persona === undefined) return; // orphan caught elsewhere
976
+ if (persona.belongsToIcpRefs.includes(icp.ref)) return;
977
+ issues.push({
978
+ kind: MarketSnapshotIssueKind.BUYING_GROUP_BACKLINK_MISSING,
979
+ path: `icps[${iIdx}].buyingGroup[${idx}].personaRef`,
980
+ message: `ICP "${icp.ref}" lists persona "${persona.ref}" in buyingGroup[], but the persona's belongsToIcpRefs[] is ${JSON.stringify(persona.belongsToIcpRefs)} (does not include "${icp.ref}"). The link must be symmetric.`,
981
+ severity: 'ERROR',
982
+ });
983
+ });
984
+ }
985
+ }
986
+
987
+ /**
988
+ * Phase 3 — a `MarketProof` that supports neither a benefit nor an ICP
989
+ * has no place to land in generated copy. WARN, not ERROR — the proof
990
+ * may be in flight ("about to wire it up next") and should not block
991
+ * boot.
992
+ */
993
+ function detectProofsWithoutSupport(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
994
+ for (const [pIdx, proof] of snapshot.proofs.entries()) {
995
+ if (proof.supportsBenefitRefs.length > 0 || proof.supportsIcpRefs.length > 0) continue;
996
+ issues.push({
997
+ kind: MarketSnapshotIssueKind.PROOF_WITHOUT_SUPPORT,
998
+ path: `proofs[${pIdx}]`,
999
+ message: `Proof "${proof.ref}" supports neither a benefit nor an ICP. Add at least one supportsBenefitRefs[] or supportsIcpRefs[] entry, or remove the proof.`,
1000
+ severity: 'WARN',
1001
+ });
1002
+ }
1003
+ }
1004
+
1005
+ /**
1006
+ * Phase 3 — proofKind/payload coherence (WARN). The schema is
1007
+ * intentionally permissive (both `attribution` and `metric` are
1008
+ * optional on every kind) so that authors can mix proof shapes
1009
+ * without fighting the type system. This detector flags the two
1010
+ * mismatches that are unambiguously authoring drift:
1011
+ *
1012
+ * 1. `METRIC` proof without a `metric` block — the structured
1013
+ * `value + unit + period` payload is what distinguishes a
1014
+ * `METRIC` proof from a `QUOTE` that happens to carry a number.
1015
+ * Without it the rendering layer cannot format the proof as a
1016
+ * metric (no value to surface, no unit to localize). Authors
1017
+ * should either add the `metric` block or downgrade the kind to
1018
+ * `QUOTE` / `CASE_STUDY`.
1019
+ * 2. `LOGO` proof with a `metric` block — a logo carries no
1020
+ * quantitative payload by definition, so a `metric` block on a
1021
+ * `LOGO` is a category error. Either move the metric to a
1022
+ * sibling `METRIC` proof or change the kind.
1023
+ *
1024
+ * All other kind/payload combinations are deliberately accepted:
1025
+ * a `QUOTE` may carry a `metric` (a quote that quantifies an
1026
+ * outcome), an `AWARD` may carry an `attribution` (the awarding
1027
+ * body), etc. Adding more rules here trades flexibility for
1028
+ * marginal signal — keep this conservative.
1029
+ */
1030
+ function detectProofKindPayloadMismatch(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
1031
+ for (const [pIdx, proof] of snapshot.proofs.entries()) {
1032
+ if (proof.proofKind === ProofKind.METRIC && proof.metric === undefined) {
1033
+ issues.push({
1034
+ kind: MarketSnapshotIssueKind.PROOF_KIND_PAYLOAD_MISMATCH,
1035
+ path: `proofs[${pIdx}].metric`,
1036
+ message: `Proof "${proof.ref}" is METRIC but carries no structured \`metric\` block (value + unit). Add the metric block or downgrade proofKind to QUOTE/CASE_STUDY.`,
1037
+ severity: 'WARN',
1038
+ });
1039
+ }
1040
+ if (proof.proofKind === ProofKind.LOGO && proof.metric !== undefined) {
1041
+ issues.push({
1042
+ kind: MarketSnapshotIssueKind.PROOF_KIND_PAYLOAD_MISMATCH,
1043
+ path: `proofs[${pIdx}].metric`,
1044
+ message: `Proof "${proof.ref}" is LOGO but carries a \`metric\` block. A logo has no quantitative payload — move the metric to a sibling METRIC proof or change the proofKind.`,
1045
+ severity: 'WARN',
1046
+ });
1047
+ }
1048
+ }
1049
+ }
1050
+
1051
+ /**
1052
+ * A `MarketBuyingJourney` listing the same `BuyingJourneyStage` enum
1053
+ * value more than once is a structural authoring bug (which entry
1054
+ * wins for prompt enrichment? non-deterministic). ERROR.
1055
+ */
1056
+ function detectDuplicateJourneyStages(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
1057
+ for (const [jIdx, journey] of snapshot.buyingJourneys.entries()) {
1058
+ const seenStages = new Set<string>();
1059
+ journey.stages.forEach((entry, idx) => {
1060
+ if (seenStages.has(entry.stage)) {
1061
+ issues.push({
1062
+ kind: MarketSnapshotIssueKind.DUPLICATE_JOURNEY_STAGE,
1063
+ path: `buyingJourneys[${jIdx}].stages[${idx}].stage`,
1064
+ message: `Buying journey "${journey.ref}" lists stage ${entry.stage} more than once. Each BuyingJourneyStage may appear at most once per journey.`,
1065
+ severity: 'ERROR',
1066
+ });
1067
+ }
1068
+ seenStages.add(entry.stage);
1069
+ });
1070
+ }
1071
+ }
1072
+
1073
+ /**
1074
+ * Two `MarketBuyingJourney` entries pointing at the same `icpRef` is
1075
+ * a structural authoring bug — the model is "one journey per ICP" and
1076
+ * downstream consumers (prompt enrichment, journey-by-ICP indexing)
1077
+ * will silently pick the first match. ERROR.
1078
+ */
1079
+ function detectDuplicateBuyingJourneyForIcp(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
1080
+ const seenIcpRefs = new Map<string, number>();
1081
+ snapshot.buyingJourneys.forEach((journey, idx) => {
1082
+ const previousIdx = seenIcpRefs.get(journey.icpRef);
1083
+ if (previousIdx !== undefined) {
1084
+ issues.push({
1085
+ kind: MarketSnapshotIssueKind.DUPLICATE_BUYING_JOURNEY_FOR_ICP,
1086
+ path: `buyingJourneys[${idx}].icpRef`,
1087
+ message: `Buying journey "${journey.ref}" targets ICP "${journey.icpRef}" but buyingJourneys[${previousIdx}] already targets the same ICP. The model is one journey per ICP — merge or remove one.`,
1088
+ severity: 'ERROR',
1089
+ });
1090
+ return;
1091
+ }
1092
+ seenIcpRefs.set(journey.icpRef, idx);
1093
+ });
1094
+ }
1095
+
1096
+ /**
1097
+ * Semantic check: an objection citing `proofRefs[]` should point at
1098
+ * proofs whose support set actually intersects the objection's claim.
1099
+ *
1100
+ * Both sides of the intersection are unioned to be permissive without
1101
+ * being toothless:
1102
+ * - Proof support side: `proof.supportsBenefitRefs[]` ∪
1103
+ * `proof.supportsIcpRefs[]`. A proof that supports the ICP raising
1104
+ * the objection (e.g. a `LOGO` proof for that ICP) is considered
1105
+ * to back the objection even if it doesn't directly back a specific
1106
+ * benefit — logos and case studies are rarely benefit-scoped.
1107
+ * - Objection target side: `objection.relatedBenefitRefs[]` ∪
1108
+ * `objection.raisedByIcpRefs[]`.
1109
+ *
1110
+ * WARN (authoring drift, not catastrophic — the spec parses, but the
1111
+ * cited proofs will not render as supporting evidence in any of the
1112
+ * downstream prompt blocks). Orphan refs are caught separately by
1113
+ * `detectOrphanRefs`.
1114
+ *
1115
+ * Skipped for objections where either side of the intersection is
1116
+ * empty (no proofs cited OR neither related benefits nor raising ICPs
1117
+ * authored — the check has no signal then).
1118
+ */
1119
+ function detectObjectionProofBenefitMismatch(snapshot: MarketSnapshot, issues: MarketSnapshotIssue[]): void {
1120
+ const proofsByRef = new Map(snapshot.proofs.map(p => [p.ref, p] as const));
1121
+
1122
+ for (const [oIdx, objection] of snapshot.objections.entries()) {
1123
+ if (objection.proofRefs.length === 0) continue;
1124
+ const objectionTargets = new Set<string>([
1125
+ ...objection.relatedBenefitRefs,
1126
+ ...objection.raisedByIcpRefs,
1127
+ ]);
1128
+ if (objectionTargets.size === 0) continue;
1129
+
1130
+ const supported = new Set<string>();
1131
+ for (const proofRef of objection.proofRefs) {
1132
+ const proof = proofsByRef.get(proofRef);
1133
+ if (proof === undefined) continue; // orphan caught elsewhere
1134
+ for (const benefitRef of proof.supportsBenefitRefs) supported.add(benefitRef);
1135
+ for (const icpRef of proof.supportsIcpRefs) supported.add(icpRef);
1136
+ }
1137
+
1138
+ const intersects = [...objectionTargets].some(ref => supported.has(ref));
1139
+ if (intersects) continue;
1140
+
1141
+ issues.push({
1142
+ kind: MarketSnapshotIssueKind.OBJECTION_PROOF_BENEFIT_MISMATCH,
1143
+ path: `objections[${oIdx}].proofRefs`,
1144
+ message: `Objection "${objection.ref}" cites proofRefs ${JSON.stringify(objection.proofRefs)} but none of them supports any benefit in relatedBenefitRefs ${JSON.stringify(objection.relatedBenefitRefs)} nor any ICP in raisedByIcpRefs ${JSON.stringify(objection.raisedByIcpRefs)}. The cited proofs do not back the objection.`,
1145
+ severity: 'WARN',
1146
+ });
1147
+ }
1148
+ }
1149
+
1150
+ /**
1151
+ * Maps a `MarketMessageRequiredInput` enum value to the placeholder
1152
+ * shapes inside `promptTemplate` that consume it. Each input matches
1153
+ * either the bare `{{<value>}}` token or any dotted-property descent
1154
+ * `{{<entityName>.path}}` (e.g. `icpRef` is consumed by `{{icpRef}}`,
1155
+ * `{{icp.name}}`, `{{icp.profile.geographies}}`).
1156
+ *
1157
+ * The `entityName` form is the camelCase root WITHOUT the trailing
1158
+ * `Ref` suffix — i.e. `icpRef` → entity name `icp`, `benefitRef` →
1159
+ * `benefit`. This matches the conventional Mustache shape authors use
1160
+ * in templates ("ICP context surfaces under `icp.*`").
1161
+ */
1162
+ const REQUIRED_INPUT_PLACEHOLDER_PATTERNS: Record<MarketMessageRequiredInput, RegExp> = {
1163
+ [MarketMessageRequiredInput.ICP_REF]: /\{\{\s*(?:icpRef|icp(?:\.[A-Za-z0-9_]+)+)\s*\}\}/,
1164
+ [MarketMessageRequiredInput.BENEFIT_REF]: /\{\{\s*(?:benefitRef|benefit(?:\.[A-Za-z0-9_]+)+)\s*\}\}/,
1165
+ [MarketMessageRequiredInput.CHANNEL_REF]: /\{\{\s*(?:channelRef|channel(?:\.[A-Za-z0-9_]+)+)\s*\}\}/,
1166
+ [MarketMessageRequiredInput.OBJECTION_REF]: /\{\{\s*(?:objectionRef|objection(?:\.[A-Za-z0-9_]+)+)\s*\}\}/,
1167
+ };
1168
+
1169
+ /**
1170
+ * Inverse of `REQUIRED_INPUT_PLACEHOLDER_PATTERNS` — given a Mustache
1171
+ * placeholder name extracted from a template body, return the
1172
+ * `MarketMessageRequiredInput` it consumes (or `undefined` if the
1173
+ * leading token is the exempt `{{output_language}}` / an unknown
1174
+ * camelCase root).
1175
+ *
1176
+ * Keyed on the **leading entity name** in two distinct shapes:
1177
+ * - the dotted-root entity (`icp` → consumed by `{{icp.name}}`,
1178
+ * `{{icp.profile.…}}`);
1179
+ * - the explicit `<entity>Ref` token (`icpRef` → consumed by
1180
+ * `{{icpRef}}`).
1181
+ *
1182
+ * The bare-entity token `{{icp}}` (no dot, no `Ref` suffix) is
1183
+ * intentionally NOT a recognized form here: Direction-1 of the
1184
+ * validator (declared → used) rejects it (the regex requires
1185
+ * `\{\{icpRef\}\}` OR `\{\{icp\.<segment>\}\}`), so accepting it in
1186
+ * Direction-2 would create an asymmetric false-positive WARN. The
1187
+ * detector enforces this in `isRecognizedPlaceholderToken(...)`
1188
+ * before consulting the map.
1189
+ */
1190
+ const PLACEHOLDER_ENTITY_TO_REQUIRED_INPUT: Record<string, MarketMessageRequiredInput> = {
1191
+ icp: MarketMessageRequiredInput.ICP_REF,
1192
+ icpRef: MarketMessageRequiredInput.ICP_REF,
1193
+ benefit: MarketMessageRequiredInput.BENEFIT_REF,
1194
+ benefitRef: MarketMessageRequiredInput.BENEFIT_REF,
1195
+ channel: MarketMessageRequiredInput.CHANNEL_REF,
1196
+ channelRef: MarketMessageRequiredInput.CHANNEL_REF,
1197
+ objection: MarketMessageRequiredInput.OBJECTION_REF,
1198
+ objectionRef: MarketMessageRequiredInput.OBJECTION_REF,
1199
+ };
1200
+
1201
+ /**
1202
+ * Returns the `MarketMessageRequiredInput` consumed by a Mustache
1203
+ * placeholder body (everything between `{{` and `}}` with whitespace
1204
+ * stripped), or `undefined` when the token does not consume any
1205
+ * required input.
1206
+ *
1207
+ * Symmetric with `REQUIRED_INPUT_PLACEHOLDER_PATTERNS`:
1208
+ * - dotted access (`icp.name`, `icp.profile.geographies`) → consumes
1209
+ * the dotted root's required input;
1210
+ * - explicit `<entity>Ref` (`icpRef`) → consumes the matching
1211
+ * required input;
1212
+ * - bare entity (`icp`) → DOES NOT consume — same as Direction-1.
1213
+ */
1214
+ function lookupConsumedRequiredInput(
1215
+ innerExpression: string,
1216
+ ): MarketMessageRequiredInput | undefined {
1217
+ const dotIndex = innerExpression.indexOf('.');
1218
+ if (dotIndex >= 0) {
1219
+ const dottedRoot = innerExpression.slice(0, dotIndex).trim();
1220
+ return PLACEHOLDER_ENTITY_TO_REQUIRED_INPUT[dottedRoot];
1221
+ }
1222
+ // No dot — only the explicit `<entity>Ref` form is recognized.
1223
+ if (!innerExpression.endsWith('Ref')) return undefined;
1224
+ return PLACEHOLDER_ENTITY_TO_REQUIRED_INPUT[innerExpression];
1225
+ }
1226
+
1227
+ /**
1228
+ * Mustache token names that are CLI-injected at render time and are
1229
+ * therefore NOT expected to appear in `requiredInputs[]`. Today only
1230
+ * `output_language` is in this set (substituted from the
1231
+ * `--output-language` flag), but the set
1232
+ * is structured to grow with future CLI-side affordances.
1233
+ */
1234
+ const PLACEHOLDER_ENTITY_EXEMPT_FROM_REQUIRED_INPUTS: ReadonlySet<string> = new Set([
1235
+ 'output_language',
1236
+ ]);
1237
+
1238
+ /**
1239
+ * Match every Mustache placeholder inside a template body. Captures
1240
+ * the inner expression with surrounding whitespace stripped so callers
1241
+ * can split on `.` to extract the leading entity name.
1242
+ *
1243
+ * Permissive on identifier shape — accepts kebab-free dot paths
1244
+ * (`icp.name`, `icp.profile.geographies`) and bare identifiers
1245
+ * (`icpRef`, `output_language`). Mustache section tokens
1246
+ * (`{{#...}}` / `{{^...}}` / `{{/...}}` / `{{!...}}`) are filtered
1247
+ * via the leading sigil check below.
1248
+ */
1249
+ const MUSTACHE_PLACEHOLDER_REGEX = /\{\{\s*([^}]+?)\s*\}\}/g;
1250
+
1251
+ /**
1252
+ * Phase-4 (§10.3 of the plan) — declared/used coherence check on
1253
+ * `MarketMessageTemplate.promptTemplate` ↔ `requiredInputs[]`.
1254
+ *
1255
+ * The detector is symmetric: it surfaces both directions of drift
1256
+ * (declared but never substituted; used in the body but never
1257
+ * declared) under the same `MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH`
1258
+ * kind. The message text disambiguates the direction so authors can
1259
+ * fix it from the report alone.
1260
+ *
1261
+ * The exempt token set ({{output_language}} today) is filtered before
1262
+ * the "used but not declared" pass — see
1263
+ * `PLACEHOLDER_ENTITY_EXEMPT_FROM_REQUIRED_INPUTS`. Unknown camelCase
1264
+ * roots (e.g. `{{persona.name}}` if persona ever becomes a placeholder
1265
+ * shape) are silently ignored — this detector covers ONLY the inputs
1266
+ * declared in `MarketMessageRequiredInput`. Adding a new required-input
1267
+ * shape requires extending both `PLACEHOLDER_ENTITY_TO_REQUIRED_INPUT`
1268
+ * and `REQUIRED_INPUT_PLACEHOLDER_PATTERNS` together.
1269
+ */
1270
+ function detectMessageTemplatePlaceholderMismatch(
1271
+ snapshot: MarketSnapshot,
1272
+ issues: MarketSnapshotIssue[],
1273
+ ): void {
1274
+ for (const [tIdx, template] of snapshot.messageTemplates.entries()) {
1275
+ const declaredInputs = new Set<MarketMessageRequiredInput>(template.requiredInputs ?? []);
1276
+
1277
+ // Direction 1: declared but the body has no consuming placeholder.
1278
+ for (const declared of declaredInputs) {
1279
+ const pattern = REQUIRED_INPUT_PLACEHOLDER_PATTERNS[declared];
1280
+ if (pattern.test(template.promptTemplate)) continue;
1281
+ issues.push({
1282
+ kind: MarketSnapshotIssueKind.MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH,
1283
+ path: `messageTemplates[${tIdx}].requiredInputs`,
1284
+ message:
1285
+ `Message template "${template.ref}" declares requiredInput "${declared}" but no `
1286
+ + `\`{{${declared.replace(/Ref$/, '')}.*}}\` / \`{{${declared}}}\` placeholder exists in promptTemplate. `
1287
+ + `Add the placeholder or prune the requiredInput entry.`,
1288
+ severity: 'WARN',
1289
+ });
1290
+ }
1291
+
1292
+ // Direction 2: body references a known input shape that is not declared.
1293
+ const referencedInputs = new Set<MarketMessageRequiredInput>();
1294
+ MUSTACHE_PLACEHOLDER_REGEX.lastIndex = 0;
1295
+ let match: RegExpExecArray | null;
1296
+ while ((match = MUSTACHE_PLACEHOLDER_REGEX.exec(template.promptTemplate)) !== null) {
1297
+ const inner = match[1] ?? '';
1298
+ // Skip Mustache section / inverted / closing / comment tokens.
1299
+ const firstChar = inner[0];
1300
+ if (firstChar === '#' || firstChar === '^' || firstChar === '/' || firstChar === '!') continue;
1301
+
1302
+ const leadingEntity = inner.split('.')[0]?.trim() ?? '';
1303
+ if (leadingEntity.length === 0) continue;
1304
+ if (PLACEHOLDER_ENTITY_EXEMPT_FROM_REQUIRED_INPUTS.has(leadingEntity)) continue;
1305
+
1306
+ const consumedInput = lookupConsumedRequiredInput(inner);
1307
+ if (consumedInput === undefined) continue; // unknown entity root — out of scope for this detector
1308
+ referencedInputs.add(consumedInput);
1309
+ }
1310
+
1311
+ for (const referenced of referencedInputs) {
1312
+ if (declaredInputs.has(referenced)) continue;
1313
+ issues.push({
1314
+ kind: MarketSnapshotIssueKind.MESSAGE_TEMPLATE_PLACEHOLDER_MISMATCH,
1315
+ path: `messageTemplates[${tIdx}].promptTemplate`,
1316
+ message:
1317
+ `Message template "${template.ref}" references \`{{${referenced.replace(/Ref$/, '')}.*}}\` / `
1318
+ + `\`{{${referenced}}}\` placeholders but does not declare "${referenced}" in requiredInputs[]. `
1319
+ + `Add the requiredInput entry or remove the placeholder.`,
1320
+ severity: 'WARN',
1321
+ });
1322
+ }
1323
+ }
1324
+ }
1325
+ ```
1326
+
1327
+ ## Snapshot shape (source)
1328
+
1329
+ ## Import Origins
1330
+
1331
+ - `@wildo-ai/saas-specifications`
1332
+
1333
+ ## Source Excerpts
1334
+
1335
+ ### Origin Package: `@wildo-ai/saas-specifications`
1336
+
1337
+ ```typescript
1338
+ *
1339
+ * Versioning for the market-snapshot payload format itself.
1340
+ *
1341
+ * - `V0` — bootstrap surface (category + ICPs + personas +
1342
+ * jobs/pains/gains + tones of voice). Reserved as the historical
1343
+ * marker; no production snapshot should ship as V0.
1344
+ * - `V1` — adds `benefits`, `positionings`, and the
1345
+ * `messageTemplates` slot reservation.
1346
+ * - `V2` — current. Adds the six channel-family arrays
1347
+ * (`channels`, `alternatives`, `triggers`, `buyingJourneys`,
1348
+ * `proofs`, `objections`) as full configs.
1349
+ *
1350
+ * The shape grows additively across versions — older callers keep
1351
+ * parsing newer payloads via `default([])` semantics on the additive
1352
+ * arrays; the `version` field is the explicit marker for consumers
1353
+ * that need to branch on era.
1354
+ */
1355
+ export enum MarketSnapshotVersion {
1356
+ V0 = 'v0',
1357
+ V1 = 'v1',
1358
+ V2 = 'v2',
1359
+ }
1360
+ ```
1361
+
1362
+ ## Worked Example — bootstrap wiring + issue interpretation
1363
+
1364
+ The orchestrator contract: `ok === true` iff no ERROR; each issue
1365
+ carries `kind` + `path` + `severity`. The expected boot wiring
1366
+ throws `BusinessConfigError` on ERRORs and logs WARNs.
1367
+
1368
+
1369
+ ## Usage Example
1370
+
1371
+ ```typescript
1372
+ *
1373
+ * Canonical "validator contract" demonstration. `validateMarketSnapshot`
1374
+ * returns `{ ok, issues[] }`:
1375
+ *
1376
+ * - `ok === true` iff NO issue carries `severity: 'ERROR'`. WARN-only
1377
+ * results are still `ok === true`.
1378
+ * - Each issue carries `kind` (one of `MarketSnapshotIssueKind`),
1379
+ * `path` (dotted path inside the snapshot, e.g.
1380
+ * `'icps[0].pains[2].painRef'`), `message`, and `severity`.
1381
+ *
1382
+ * The expected wiring at app boot:
1383
+ *
1384
+ * ```ts
1385
+ * const result = validateMarketSnapshot(snapshot, {
1386
+ * availableFeatureRefs: featureRegistry.allRefs(),
1387
+ * });
1388
+ * if (!result.ok) {
1389
+ * throw new BusinessConfigError(
1390
+ * `Market snapshot has ${result.issues.filter(i => i.severity === 'ERROR').length} ERROR-severity issues`,
1391
+ * { issues: result.issues.filter(i => i.severity === 'ERROR') },
1392
+ * );
1393
+ * }
1394
+ * for (const warn of result.issues.filter(i => i.severity === 'WARN')) {
1395
+ * logger.warn({ kind: warn.kind, path: warn.path }, warn.message);
1396
+ * }
1397
+ * ```
1398
+ *
1399
+ * The validator never mutates the snapshot and never consults runtime
1400
+ * registries beyond the optional `availableFeatureRefs` /
1401
+ * `availableProductRefs` sets — keeping it a pure, typed graph walker.
1402
+ */
1403
+ it('returns ok=true with no issues on an empty snapshot', () => {
1404
+ const result = validateMarketSnapshot(makeSnapshot());
1405
+ expect(result.ok).toBe(true);
1406
+ expect(result.issues).toEqual([]);
1407
+ });
1408
+
1409
+ it('returns ok=false when ANY issue has severity ERROR', () => {
1410
+ const result = validateMarketSnapshot(
1411
+ makeSnapshot({
1412
+ icps: [makeIcp({ priority: ICPPriority.CORE })],
1413
+ personas: [makePersona({ belongsToIcpRefs: ['icp-team'] })],
1414
+ positionings: [],
1415
+ }),
1416
+ );
1417
+ expect(result.ok).toBe(false);
1418
+ expect(result.issues.some(i => i.severity === 'ERROR')).toBe(true);
1419
+ });
1420
+ ```
1421
+
1422
+ ## Worked Examples — additional issue kinds
1423
+
1424
+ ### `THRESHOLD_BENEFIT_WITHOUT_JOB` (ERROR)
1425
+
1426
+ A benefit that declares a `THRESHOLD` `importanceByICP` entry but
1427
+ has an empty `advances[]` — the cluster key `(icp, job)` cannot be
1428
+ formed, which structurally bypasses the `MULTIPLE_THRESHOLDS_PER_ICP_JOB`
1429
+ invariant. The validator emits an ERROR:
1430
+
1431
+
1432
+ ## Usage Example
1433
+
1434
+ ```typescript
1435
+ *
1436
+ * THRESHOLD is a per-(icp, job) classification. A benefit that
1437
+ * declares any THRESHOLD `importanceByICP` entry but has empty
1438
+ * `advances[]` has no job to anchor against — the
1439
+ * `MULTIPLE_THRESHOLDS_PER_ICP_JOB` invariant is structurally
1440
+ * bypassed and the FIT scorer cannot place the table-stakes claim.
1441
+ * ERROR.
1442
+ */
1443
+ it('flags a THRESHOLD benefit with empty advances[]', () => {
1444
+ const result = validateMarketSnapshot(
1445
+ makeSnapshot({
1446
+ icps: [makeIcp()],
1447
+ personas: [makePersona()],
1448
+ benefits: [
1449
+ {
1450
+ ref: 'benefit-threshold-no-job',
1451
+ claim: 'X',
1452
+ role: BenefitRole.PAIN_RELIEVER,
1453
+ deliveredByFeatureRefs: ['feature-x'],
1454
+ relieves: [],
1455
+ creates: [],
1456
+ advances: [],
1457
+ importanceByICP: [
1458
+ { icpRef: 'icp-team', weight: 9, kanoCategory: BenefitKanoCategory.THRESHOLD },
1459
+ ],
1460
+ proofRefs: [],
1461
+ addressesObjectionRefs: [],
1462
+ },
1463
+ ],
1464
+ }),
1465
+ );
1466
+ const issue = result.issues.find(
1467
+ i => i.kind === MarketSnapshotIssueKind.THRESHOLD_BENEFIT_WITHOUT_JOB,
1468
+ );
1469
+ expect(issue?.severity).toBe('ERROR');
1470
+ expect(issue?.path).toBe('benefits[0].advances');
1471
+ });
1472
+ ```
1473
+
1474
+ ### `PROOF_WITHOUT_SUPPORT` (WARN)
1475
+
1476
+ A proof with empty `supportsBenefitRefs` AND empty
1477
+ `supportsIcpRefs` — the validator emits a WARN, snapshot remains
1478
+ `ok`, but the proof is unreachable from AI routing:
1479
+
1480
+
1481
+ ## Usage Example
1482
+
1483
+ ```typescript
1484
+ *
1485
+ * Canonical PROOF_WITHOUT_SUPPORT case: a proof that supports
1486
+ * neither a benefit nor an ICP has nowhere to land in generated
1487
+ * copy. WARN, not ERROR — the proof may be in flight.
1488
+ */
1489
+ it('flags a proof with empty supportsBenefitRefs[] AND empty supportsIcpRefs[]', () => {
1490
+ const result = validateMarketSnapshot(
1491
+ makeSnapshot({
1492
+ proofs: [
1493
+ {
1494
+ ref: 'proof-orphan',
1495
+ proofKind: 'METRIC' as never,
1496
+ statement: 'x',
1497
+ supportsBenefitRefs: [],
1498
+ supportsIcpRefs: [],
1499
+ },
1500
+ ],
1501
+ }),
1502
+ );
1503
+ const issue = result.issues.find(
1504
+ i => i.kind === MarketSnapshotIssueKind.PROOF_WITHOUT_SUPPORT,
1505
+ );
1506
+ expect(issue?.severity).toBe('WARN');
1507
+ expect(result.ok).toBe(true); // WARN does not fail the snapshot
1508
+ });
1509
+ ```
1510
+
1511
+ ### `DUPLICATE_JOURNEY_STAGE` (ERROR)
1512
+
1513
+ A buying journey listing the same `BuyingJourneyStage` twice —
1514
+ the validator emits an ERROR (snapshot not safe to consume):
1515
+
1516
+
1517
+ ## Usage Example
1518
+
1519
+ ```typescript
1520
+ *
1521
+ * Canonical DUPLICATE_JOURNEY_STAGE case: the same stage enum
1522
+ * value listed twice in the same journey is a structural authoring
1523
+ * bug (which entry wins for prompt enrichment? non-deterministic).
1524
+ * ERROR, blocks the snapshot.
1525
+ */
1526
+ it('flags a journey listing the same stage twice', () => {
1527
+ const result = validateMarketSnapshot(
1528
+ makeSnapshot({
1529
+ icps: [makeIcp()],
1530
+ buyingJourneys: [
1531
+ {
1532
+ ref: 'journey-dup',
1533
+ icpRef: 'icp-team',
1534
+ stages: [
1535
+ { stage: 'AWARENESS' as never, description: 'a', keyQuestions: [], suggestedContent: [], blockers: [] },
1536
+ { stage: 'AWARENESS' as never, description: 'b', keyQuestions: [], suggestedContent: [], blockers: [] },
1537
+ ],
1538
+ notes: [],
1539
+ },
1540
+ ],
1541
+ }),
1542
+ );
1543
+ const issue = result.issues.find(
1544
+ i => i.kind === MarketSnapshotIssueKind.DUPLICATE_JOURNEY_STAGE,
1545
+ );
1546
+ expect(issue?.severity).toBe('ERROR');
1547
+ expect(result.ok).toBe(false);
1548
+ });
1549
+ ```
1550
+
1551
+ ### `OBJECTION_PROOF_BENEFIT_MISMATCH` (WARN)
1552
+
1553
+ An objection citing `proofRefs` whose combined
1554
+ `supportsBenefitRefs` do not intersect the objection's
1555
+ `relatedBenefitRefs` — the proofs do not back what the
1556
+ objection threatens:
1557
+
1558
+
1559
+ ## Usage Example
1560
+
1561
+ ```typescript
1562
+ *
1563
+ * Canonical OBJECTION_PROOF_BENEFIT_MISMATCH case: an objection
1564
+ * cites proof-X for `relatedBenefitRefs: [benefit-A]`, but proof-X
1565
+ * actually supports `benefit-B`. The cited proof does not back the
1566
+ * benefits the objection is about — likely authoring drift.
1567
+ */
1568
+ it('flags an objection whose cited proofs do not support any of its related benefits', () => {
1569
+ const result = validateMarketSnapshot(
1570
+ makeSnapshot({
1571
+ icps: [makeIcp()],
1572
+ benefits: [
1573
+ {
1574
+ ref: 'benefit-a',
1575
+ claim: 'A',
1576
+ role: 'PAIN_RELIEVER' as never,
1577
+ deliveredByFeatureRefs: ['feature-x'],
1578
+ relieves: [],
1579
+ creates: [],
1580
+ advances: [],
1581
+ importanceByICP: [],
1582
+ proofRefs: [],
1583
+ addressesObjectionRefs: [],
1584
+ },
1585
+ {
1586
+ ref: 'benefit-b',
1587
+ claim: 'B',
1588
+ role: 'GAIN_CREATOR' as never,
1589
+ deliveredByFeatureRefs: ['feature-y'],
1590
+ relieves: [],
1591
+ creates: [],
1592
+ advances: [],
1593
+ importanceByICP: [],
1594
+ proofRefs: [],
1595
+ addressesObjectionRefs: [],
1596
+ },
1597
+ ],
1598
+ proofs: [
1599
+ {
1600
+ ref: 'proof-supports-b',
1601
+ proofKind: 'METRIC' as never,
1602
+ statement: 'x',
1603
+ supportsBenefitRefs: ['benefit-b'],
1604
+ supportsIcpRefs: [],
1605
+ },
1606
+ ],
1607
+ objections: [
1608
+ {
1609
+ ref: 'obj-mismatch',
1610
+ objectionKind: 'PRICING' as never,
1611
+ statement: 's',
1612
+ response: 'r',
1613
+ raisedByIcpRefs: ['icp-team'],
1614
+ raisedByPersonaRefs: [],
1615
+ proofRefs: ['proof-supports-b'],
1616
+ relatedBenefitRefs: ['benefit-a'],
1617
+ },
1618
+ ],
1619
+ }),
1620
+ );
1621
+ const issue = result.issues.find(
1622
+ i => i.kind === MarketSnapshotIssueKind.OBJECTION_PROOF_BENEFIT_MISMATCH,
1623
+ );
1624
+ expect(issue?.severity).toBe('WARN');
1625
+ // Note: result.ok depends on unrelated rules (this snapshot has a
1626
+ // CORE ICP without positioning → MISSING_POSITIONING_FOR_ICP fires
1627
+ // ERROR). The OBJECTION_PROOF_BENEFIT_MISMATCH itself is WARN.
1628
+ });
1629
+ ```
1630
+
1631
+ ## Verification
1632
+
1633
+ - [ ] App bootstrap calls `validateMarketSnapshot` before any
1634
+ consumer touches the snapshot
1635
+ - [ ] App bootstrap throws on `result.ok === false` (never silently
1636
+ swallows ERROR-severity issues)
1637
+ - [ ] App bootstrap logs WARN-severity issues (never throws on them)
1638
+ - [ ] `availableFeatureRefs` and `availableProductRefs` are passed
1639
+ in production wiring (omit only in unit tests)
1640
+ - [ ] No call site mutates the snapshot inside the validator
1641
+ callback or the issues list
1642
+ - [ ] Tests override `now` for `STALE_AUTHORED` checks (deterministic
1643
+ results regardless of clock)
1644
+
1645
+ ### Grep invariants
1646
+
1647
+ | Invariant | Command |
1648
+ |--------------------------------------------------------------------|--------------------------------------------------------------------------|
1649
+ | Bootstrap calls the validator | `rg -n "validateMarketSnapshot\(" --type ts` |
1650
+ | Bootstrap throws BusinessConfigError on ERROR | `rg -n "validateMarketSnapshot" -A 6 --type ts \| rg "BusinessConfigError"` |
1651
+ | Bootstrap passes cross-family ref sets | `rg -n "validateMarketSnapshot" -A 4 --type ts \| rg "availableFeatureRefs\|availableProductRefs"` |
1652
+ | No consumer reaches into `result.issues` to mutate | `rg -n "result\.issues\." --type ts \| rg -v "filter\|forEach\|map\|find"` |
1653
+
1654
+ ## Common Rationalizations
1655
+
1656
+ | Rationalization | Reality |
1657
+ |-----------------|---------|
1658
+ | "WARNs are noise — let's silence them." | WARNs name real authoring drift (`STALE_AUTHORED`, duplicate edges from sloppy `inheritFrom`, multi-node influence cycles). Log them; do not silence. |
1659
+ | "Skip `availableFeatureRefs` — it's an extra registry call." | Without it, `FeatureBenefit.deliveredByFeatureRefs[]` orphans are NOT detected. The cost is one set construction at boot; the benefit is catching dangling refs before they break runtime. |
1660
+ | "Let's relax MULTIPLE_THRESHOLDS_PER_ICP_JOB to a WARN — easier to author." | THRESHOLD means "without it the ICP rejects the offer". Two THRESHOLDs on the same `(icp, job)` is a contradiction. The ERROR severity is what makes the abstraction usable — relax it and the THRESHOLD signal collapses to noise. |
1661
+ | "Mutate the snapshot inside the validator to auto-fix issues." | The validator is pure by contract. Auto-fixers belong in a separate codemod, not inside the safety check. |
1662
+
1663
+ ## Red Flags
1664
+
1665
+ - App bootstrap that calls `validateMarketSnapshot` but does not
1666
+ throw on ERROR (effectively disabled validation)
1667
+ - App bootstrap that throws on WARN-severity issues (over-strict;
1668
+ WARN exists precisely because not every drift is fatal)
1669
+ - Production code that omits `availableFeatureRefs` /
1670
+ `availableProductRefs` (silently skips cross-family orphan checks)
1671
+ - Tests that rely on `new Date()` instead of overriding `now` (flaky
1672
+ on `STALE_AUTHORED` over time)
1673
+ - A consumer that swallows the issues list and only inspects `ok`
1674
+ (loses the `kind` / `path` context needed to fix the snapshot)
1675
+
1676
+ ## References
1677
+
1678
+ - `references/framework-snapshot-validation-api.md` —
1679
+ `validateMarketSnapshot` + `MarketSnapshotIssueKind` enum +
1680
+ options shape; the locked rule table (D16) with severity rules.
1681
+
1682
+ ## Related Skills
1683
+
1684
+ - `market-authoring-overview` — assembles the `MarketSnapshot` the
1685
+ validator consumes
1686
+ - `market-add-feature-benefit` — owns the `THRESHOLD` invariant
1687
+ (`MULTIPLE_THRESHOLDS_PER_ICP_JOB`,
1688
+ `THRESHOLD_BENEFIT_WITHOUT_JOB`) and `EMPTY_BENEFIT_DELIVERED_BY`
1689
+ rule
1690
+ - `market-positioning-authoring` — owns the
1691
+ `MISSING_POSITIONING_FOR_ICP` rule
1692
+ - `market-persona` — owns the `BUYING_GROUP_PERSONA_MISSING_DMU_ROLE`
1693
+ rule
1694
+ - `market-icp` — owns the `INVALID_ANTI_TARGET_PURPOSE_MIX` and
1695
+ `INFLUENCE_CYCLE` rules
1696
+ - `market-scoring-interpretation` — consumer that trusts a validated
1697
+ snapshot
1698
+ - `market-proof-and-objection` — owns the
1699
+ `PROOF_WITHOUT_SUPPORT` and
1700
+ `OBJECTION_PROOF_BENEFIT_MISMATCH` rules
1701
+ - `market-triggers-and-journey` — owns the
1702
+ `DUPLICATE_JOURNEY_STAGE` rule
1703
+ - `market-channels` — referenced from
1704
+ `MarketTrigger.recommendedChannelRefs` (orphan-checked)
1705
+ - `market-alternatives` — referenced from
1706
+ `MarketPositioning.alternativesContrasted` (orphan-checked)