@open-mercato/cli 0.6.7 → 0.6.8-canary.319.1.5b4be4bc52

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 (287) hide show
  1. package/.turbo/turbo-build.log +77 -4
  2. package/build.mjs +68 -11
  3. package/dist/agentic/claude-code/hooks/entity-migration-check.ts +32 -88
  4. package/dist/agentic/codex/enforcement-rules.md +2 -16
  5. package/dist/agentic/cursor/hooks/entity-migration-check.mjs +19 -50
  6. package/dist/agentic/cursor/rules/entity-guard.mdc +9 -21
  7. package/dist/agentic/cursor/rules/generated-guard.mdc +3 -5
  8. package/dist/agentic/cursor/rules/open-mercato.mdc +3 -29
  9. package/dist/agentic/guides/ai-workflows.md +76 -0
  10. package/dist/agentic/guides/architecture.md +107 -0
  11. package/dist/agentic/guides/backend-ui.md +84 -0
  12. package/dist/agentic/guides/contracts.md +92 -0
  13. package/dist/agentic/guides/extensions.md +121 -0
  14. package/dist/agentic/guides/framework-extension-points.md +36 -0
  15. package/dist/agentic/guides/integrations.md +81 -0
  16. package/dist/agentic/guides/module-facts.json +116757 -3951
  17. package/dist/agentic/guides/module-system.md +12 -127
  18. package/dist/agentic/guides/modules/ai_assistant.md +227 -28
  19. package/dist/agentic/guides/modules/api_docs.md +58 -2
  20. package/dist/agentic/guides/modules/api_keys.md +92 -7
  21. package/dist/agentic/guides/modules/attachments.md +119 -14
  22. package/dist/agentic/guides/modules/audit_logs.md +131 -10
  23. package/dist/agentic/guides/modules/auth.md +276 -33
  24. package/dist/agentic/guides/modules/business_rules.md +149 -14
  25. package/dist/agentic/guides/modules/catalog.md +482 -43
  26. package/dist/agentic/guides/modules/channel_gmail.md +82 -3
  27. package/dist/agentic/guides/modules/channel_imap.md +82 -3
  28. package/dist/agentic/guides/modules/checkout.md +305 -27
  29. package/dist/agentic/guides/modules/communication_channels.md +315 -33
  30. package/dist/agentic/guides/modules/configs.md +104 -8
  31. package/dist/agentic/guides/modules/content.md +57 -2
  32. package/dist/agentic/guides/modules/currencies.md +152 -17
  33. package/dist/agentic/guides/modules/customer_accounts.md +387 -45
  34. package/dist/agentic/guides/modules/customers.md +746 -85
  35. package/dist/agentic/guides/modules/dashboards.md +155 -10
  36. package/dist/agentic/guides/modules/data_sync.md +149 -16
  37. package/dist/agentic/guides/modules/design_system.md +102 -0
  38. package/dist/agentic/guides/modules/dictionaries.md +107 -12
  39. package/dist/agentic/guides/modules/directory.md +148 -15
  40. package/dist/agentic/guides/modules/entities.md +145 -13
  41. package/dist/agentic/guides/modules/events.md +59 -2
  42. package/dist/agentic/guides/modules/feature_toggles.md +119 -9
  43. package/dist/agentic/guides/modules/gateway_stripe.md +92 -4
  44. package/dist/agentic/guides/modules/generators.md +45 -2
  45. package/dist/agentic/guides/modules/inbox_ops.md +207 -27
  46. package/dist/agentic/guides/modules/integrations.md +149 -16
  47. package/dist/agentic/guides/modules/messages.md +223 -24
  48. package/dist/agentic/guides/modules/notifications.md +96 -8
  49. package/dist/agentic/guides/modules/onboarding.md +77 -6
  50. package/dist/agentic/guides/modules/payment_gateways.md +168 -21
  51. package/dist/agentic/guides/modules/perspectives.md +77 -7
  52. package/dist/agentic/guides/modules/planner.md +136 -18
  53. package/dist/agentic/guides/modules/portal.md +93 -2
  54. package/dist/agentic/guides/modules/progress.md +104 -14
  55. package/dist/agentic/guides/modules/query_index.md +154 -15
  56. package/dist/agentic/guides/modules/record_locks.md +206 -21
  57. package/dist/agentic/guides/modules/resources.md +197 -30
  58. package/dist/agentic/guides/modules/sales.md +687 -84
  59. package/dist/agentic/guides/modules/scheduler.md +133 -14
  60. package/dist/agentic/guides/modules/search.md +170 -6
  61. package/dist/agentic/guides/modules/security.md +294 -35
  62. package/dist/agentic/guides/modules/shipping_carriers.md +134 -18
  63. package/dist/agentic/guides/modules/sso.md +151 -26
  64. package/dist/agentic/guides/modules/staff.md +372 -57
  65. package/dist/agentic/guides/modules/storage_s3.md +95 -5
  66. package/dist/agentic/guides/modules/sync_akeneo.md +85 -3
  67. package/dist/agentic/guides/modules/sync_excel.md +75 -6
  68. package/dist/agentic/guides/modules/system_status_overlays.md +60 -2
  69. package/dist/agentic/guides/modules/translations.md +104 -10
  70. package/dist/agentic/guides/modules/webhooks.md +203 -24
  71. package/dist/agentic/guides/modules/wms.md +469 -47
  72. package/dist/agentic/guides/modules/workflows.md +302 -43
  73. package/dist/agentic/guides/reference-module-facts.json +6370 -0
  74. package/dist/agentic/guides/reference-modules/example.md +451 -0
  75. package/dist/agentic/guides/spec-delivery.md +42 -0
  76. package/dist/agentic/guides/testing-debugging.md +80 -0
  77. package/dist/agentic/guides/upstream/AGENTS.md +299 -0
  78. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +316 -0
  79. package/dist/agentic/guides/upstream/manifest.json +8 -0
  80. package/dist/agentic/shared/AGENTS.md.template +120 -311
  81. package/dist/agentic/shared/ai/agentic.config.json +2 -0
  82. package/dist/agentic/shared/ai/harness/README.md +50 -0
  83. package/dist/agentic/shared/ai/harness/RELEASE.md +57 -0
  84. package/dist/agentic/shared/ai/harness/cases.json +15050 -0
  85. package/dist/agentic/shared/ai/harness/cases.schema.json +188 -0
  86. package/dist/agentic/shared/ai/harness/fixtures/index.json +51 -0
  87. package/dist/agentic/shared/ai/harness/fixtures/seeds.json +166 -0
  88. package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +21 -0
  89. package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +96 -0
  90. package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +172 -0
  91. package/dist/agentic/shared/ai/harness/knowledge-change.schema.json +228 -0
  92. package/dist/agentic/shared/ai/harness/release-matrix.json +163 -0
  93. package/dist/agentic/shared/ai/harness/release-result.schema.json +219 -0
  94. package/dist/agentic/shared/ai/harness/result.schema.json +109 -0
  95. package/dist/agentic/shared/ai/harness/routing-response.schema.json +22 -0
  96. package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +73 -0
  97. package/dist/agentic/shared/ai/harness/validators.json +82 -0
  98. package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +2121 -0
  99. package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +1096 -0
  100. package/dist/agentic/shared/ai/harness/writable-spec-oracles.mjs +412 -0
  101. package/dist/agentic/shared/ai/lessons/_template.md +16 -0
  102. package/dist/agentic/shared/ai/lessons.md +26 -3
  103. package/dist/agentic/shared/ai/review-checklist.md +36 -0
  104. package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +21 -0
  105. package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +4 -0
  106. package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +98 -0
  107. package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +21 -241
  108. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +31 -0
  109. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +53 -0
  110. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +15 -0
  111. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +11 -0
  112. package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +30 -0
  113. package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +12 -0
  114. package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +13 -0
  115. package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +14 -0
  116. package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +28 -0
  117. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +12 -0
  118. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +22 -0
  119. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +12 -0
  120. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +19 -0
  121. package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +17 -601
  122. package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +21 -0
  123. package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +15 -0
  124. package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +16 -0
  125. package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +10 -0
  126. package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +15 -310
  127. package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +19 -0
  128. package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +31 -0
  129. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +100 -0
  130. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +16 -0
  131. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/knowledge-change.md +115 -0
  132. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +17 -0
  133. package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +25 -0
  134. package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +11 -0
  135. package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +13 -0
  136. package/dist/agentic/shared/ai/skills/om-help/SKILL.md +15 -97
  137. package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +18 -0
  138. package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +20 -0
  139. package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +33 -152
  140. package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +33 -0
  141. package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +40 -0
  142. package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +27 -0
  143. package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +24 -0
  144. package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +25 -708
  145. package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +16 -0
  146. package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +25 -0
  147. package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +15 -0
  148. package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +12 -0
  149. package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +34 -0
  150. package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +4 -0
  151. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +11 -0
  152. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +31 -0
  153. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +39 -0
  154. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +43 -0
  155. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +11 -0
  156. package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +20 -820
  157. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +32 -0
  158. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +172 -0
  159. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +14 -0
  160. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +83 -0
  161. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +40 -0
  162. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +11 -0
  163. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +22 -0
  164. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +13 -0
  165. package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +41 -0
  166. package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +19 -0
  167. package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +44 -0
  168. package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +39 -0
  169. package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +20 -0
  170. package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +57 -0
  171. package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +11 -0
  172. package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +486 -0
  173. package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +20 -843
  174. package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +42 -0
  175. package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +27 -0
  176. package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +13 -0
  177. package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +43 -0
  178. package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +11 -0
  179. package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +15 -63
  180. package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +15 -0
  181. package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +17 -467
  182. package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +29 -0
  183. package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +14 -0
  184. package/dist/agentic/shared/ai/skills/tiers.json +143 -21
  185. package/dist/agentic/shared/ai/skills/tiers.schema.json +52 -40
  186. package/dist/agentic/shared/ai/specs/README.md +4 -3
  187. package/dist/agentic/shared/ai/specs/SPEC-000-template.md +226 -10
  188. package/dist/agentic/shared/ai/trackers/github.md +108 -4
  189. package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +224 -0
  190. package/dist/agentic/shared/scripts/check-lessons.mjs +178 -0
  191. package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +3585 -0
  192. package/dist/agentic/shared/scripts/execution-sandbox.mjs +329 -0
  193. package/dist/agentic/shared/scripts/framework-context.mjs +888 -0
  194. package/dist/agentic/shared/scripts/install-skills.mjs +1029 -0
  195. package/dist/agentic/shared/scripts/install-skills.sh +4 -694
  196. package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +222 -0
  197. package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +1774 -0
  198. package/dist/agentic/shared/scripts/validate-knowledge-change.mjs +911 -0
  199. package/dist/bin.js +13 -1
  200. package/dist/bin.js.map +2 -2
  201. package/dist/lib/__integration__/TC-INT-008.spec.js +88 -8
  202. package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
  203. package/dist/lib/agentic-init.js +13 -3
  204. package/dist/lib/agentic-init.js.map +2 -2
  205. package/dist/lib/agentic-setup.js +434 -186
  206. package/dist/lib/agentic-setup.js.map +2 -2
  207. package/dist/lib/generators/extensions/injection-widgets.js +20 -0
  208. package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
  209. package/dist/lib/generators/module-extension-facts.js +1872 -0
  210. package/dist/lib/generators/module-extension-facts.js.map +7 -0
  211. package/dist/lib/generators/module-fact-sources.js +70 -0
  212. package/dist/lib/generators/module-fact-sources.js.map +7 -0
  213. package/dist/lib/generators/module-facts-discovery.js +64 -7
  214. package/dist/lib/generators/module-facts-discovery.js.map +2 -2
  215. package/dist/lib/generators/module-facts.js +1629 -52
  216. package/dist/lib/generators/module-facts.js.map +3 -3
  217. package/dist/lib/generators/module-override-targets.js +688 -0
  218. package/dist/lib/generators/module-override-targets.js.map +7 -0
  219. package/dist/lib/generators/module-registry.js +11 -5
  220. package/dist/lib/generators/module-registry.js.map +2 -2
  221. package/dist/lib/load-env.js +24 -0
  222. package/dist/lib/load-env.js.map +7 -0
  223. package/dist/lib/resolver.js +2 -0
  224. package/dist/lib/resolver.js.map +2 -2
  225. package/dist/lib/telemetry-init.js +358 -0
  226. package/dist/lib/telemetry-init.js.map +7 -0
  227. package/dist/lib/testing/integration.js +5 -2
  228. package/dist/lib/testing/integration.js.map +2 -2
  229. package/dist/mercato.js +23 -1
  230. package/dist/mercato.js.map +2 -2
  231. package/package.json +13 -11
  232. package/src/bin.ts +33 -1
  233. package/src/lib/__integration__/TC-INT-008.spec.ts +107 -9
  234. package/src/lib/__tests__/agentic-init.test.ts +41 -5
  235. package/src/lib/__tests__/agentic-setup.ownership.test.ts +386 -0
  236. package/src/lib/__tests__/injection-widget-id-validation.test.ts +184 -0
  237. package/src/lib/__tests__/load-env.test.ts +65 -0
  238. package/src/lib/__tests__/telemetry-init.test.ts +298 -0
  239. package/src/lib/agentic-init.ts +15 -3
  240. package/src/lib/agentic-setup.ts +573 -222
  241. package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +92 -0
  242. package/src/lib/generators/__tests__/module-extension-activations.test.ts +762 -0
  243. package/src/lib/generators/__tests__/module-extension-facts.test.ts +603 -0
  244. package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +139 -2
  245. package/src/lib/generators/__tests__/module-facts.computed-di-token.test.ts +88 -0
  246. package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +1 -0
  247. package/src/lib/generators/__tests__/module-facts.discovery.test.ts +54 -10
  248. package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +108 -0
  249. package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +391 -0
  250. package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +561 -0
  251. package/src/lib/generators/__tests__/module-facts.search-entity-id.test.ts +151 -0
  252. package/src/lib/generators/__tests__/module-facts.source-links.test.ts +160 -0
  253. package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +149 -0
  254. package/src/lib/generators/__tests__/module-override-targets.test.ts +328 -0
  255. package/src/lib/generators/__tests__/module-subset.test.ts +18 -0
  256. package/src/lib/generators/extensions/injection-widgets.ts +51 -0
  257. package/src/lib/generators/module-extension-facts.ts +2433 -0
  258. package/src/lib/generators/module-fact-sources.ts +108 -0
  259. package/src/lib/generators/module-facts-discovery.ts +104 -7
  260. package/src/lib/generators/module-facts.ts +2387 -138
  261. package/src/lib/generators/module-override-targets.ts +863 -0
  262. package/src/lib/generators/module-registry.ts +16 -6
  263. package/src/lib/load-env.ts +30 -0
  264. package/src/lib/resolver.ts +3 -0
  265. package/src/lib/telemetry-init.ts +461 -0
  266. package/src/lib/testing/__tests__/integration.test.ts +4 -0
  267. package/src/lib/testing/integration.ts +5 -2
  268. package/src/mercato.ts +26 -1
  269. package/dist/agentic/guides/cache.md +0 -45
  270. package/dist/agentic/guides/core.md +0 -453
  271. package/dist/agentic/guides/events.md +0 -117
  272. package/dist/agentic/guides/queue.md +0 -53
  273. package/dist/agentic/guides/search.md +0 -115
  274. package/dist/agentic/guides/shared.md +0 -108
  275. package/dist/agentic/guides/ui.md +0 -347
  276. package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +0 -27
  277. package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +0 -27
  278. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +0 -260
  279. package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +0 -146
  280. package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +0 -84
  281. package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +0 -193
  282. package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +0 -34
  283. package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +0 -762
  284. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +0 -50
  285. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +0 -97
  286. package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +0 -271
  287. package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +0 -101
@@ -3,30 +3,146 @@
3
3
  "default": ["core"],
4
4
  "external": {
5
5
  "source": "open-mercato/skills",
6
- "description": "Skills installed from the shared open-mercato/skills collection via `npx skills add` (see scripts/install-skills.sh). Only the subset this standalone app ships is installed. A folder under .ai/skills/ matching one of these names is a repo-local override read by the external skill, never symlinked into the harness directories.",
6
+ "ref": "c6103c034571f3610323a1b53d97c81abe110b58",
7
+ "description": "Tier-selected delivery workflows installed at an exact tested collection commit. Same-name folders under .ai/skills are repo-local overrides and never replace these copies.",
8
+ "tiers": {
9
+ "core": {
10
+ "description": "Smallest dependency-closed set for daily standalone delivery.",
11
+ "skills": [
12
+ "om-spec-writing",
13
+ "om-code-review",
14
+ "om-integration-tests",
15
+ "om-prepare-test-env",
16
+ "om-auto-create-pr",
17
+ "om-auto-continue-pr",
18
+ "om-auto-review-pr",
19
+ "om-auto-implement-spec",
20
+ "om-auto-qa-pr",
21
+ "om-auto-fix-issue",
22
+ "om-verify-in-repo",
23
+ "om-root-cause",
24
+ "om-fix",
25
+ "om-open-pr",
26
+ "om-setup-agent-pipeline"
27
+ ]
28
+ },
29
+ "automation": {
30
+ "description": "Opt-in loop engines, issue authoring, and release-upgrade maintenance.",
31
+ "skills": [
32
+ "om-apply-upgrade-notes",
33
+ "om-auto-create-pr-loop",
34
+ "om-auto-continue-pr-loop",
35
+ "om-auto-write-spec",
36
+ "om-prepare-issue"
37
+ ]
38
+ }
39
+ },
7
40
  "skills": [
41
+ "om-spec-writing",
42
+ "om-code-review",
43
+ "om-integration-tests",
44
+ "om-prepare-test-env",
8
45
  "om-apply-upgrade-notes",
9
- "om-auto-continue-pr",
10
- "om-auto-continue-pr-loop",
11
46
  "om-auto-create-pr",
47
+ "om-auto-continue-pr",
12
48
  "om-auto-create-pr-loop",
13
- "om-auto-fix-issue",
49
+ "om-auto-continue-pr-loop",
14
50
  "om-auto-review-pr",
15
- "om-code-review",
16
- "om-fix",
17
- "om-integration-tests",
18
- "om-open-pr",
51
+ "om-auto-implement-spec",
52
+ "om-auto-write-spec",
53
+ "om-auto-qa-pr",
54
+ "om-auto-fix-issue",
19
55
  "om-prepare-issue",
20
- "om-prepare-test-env",
56
+ "om-verify-in-repo",
21
57
  "om-root-cause",
22
- "om-setup-agent-pipeline",
23
- "om-spec-writing",
24
- "om-verify-in-repo"
25
- ]
58
+ "om-fix",
59
+ "om-open-pr",
60
+ "om-setup-agent-pipeline"
61
+ ],
62
+ "dependencies": {
63
+ "om-spec-writing": [],
64
+ "om-code-review": ["om-setup-agent-pipeline"],
65
+ "om-integration-tests": ["om-prepare-test-env"],
66
+ "om-prepare-test-env": [],
67
+ "om-apply-upgrade-notes": ["om-setup-agent-pipeline"],
68
+ "om-auto-create-pr": ["om-auto-review-pr", "om-setup-agent-pipeline"],
69
+ "om-auto-continue-pr": ["om-auto-review-pr", "om-setup-agent-pipeline"],
70
+ "om-auto-create-pr-loop": [
71
+ "om-auto-continue-pr-loop",
72
+ "om-auto-review-pr",
73
+ "om-integration-tests",
74
+ "om-setup-agent-pipeline"
75
+ ],
76
+ "om-auto-continue-pr-loop": [
77
+ "om-auto-review-pr",
78
+ "om-integration-tests",
79
+ "om-open-pr",
80
+ "om-setup-agent-pipeline"
81
+ ],
82
+ "om-auto-review-pr": ["om-code-review", "om-setup-agent-pipeline"],
83
+ "om-auto-implement-spec": [
84
+ "om-auto-create-pr",
85
+ "om-auto-continue-pr",
86
+ "om-auto-review-pr",
87
+ "om-auto-qa-pr",
88
+ "om-setup-agent-pipeline"
89
+ ],
90
+ "om-auto-qa-pr": [
91
+ "om-auto-review-pr",
92
+ "om-integration-tests",
93
+ "om-prepare-test-env",
94
+ "om-setup-agent-pipeline"
95
+ ],
96
+ "om-auto-write-spec": ["om-spec-writing", "om-open-pr", "om-setup-agent-pipeline"],
97
+ "om-auto-fix-issue": [
98
+ "om-auto-implement-spec",
99
+ "om-auto-qa-pr",
100
+ "om-auto-review-pr",
101
+ "om-verify-in-repo",
102
+ "om-root-cause",
103
+ "om-fix",
104
+ "om-open-pr",
105
+ "om-setup-agent-pipeline"
106
+ ],
107
+ "om-prepare-issue": [
108
+ "om-auto-write-spec",
109
+ "om-auto-fix-issue",
110
+ "om-auto-implement-spec",
111
+ "om-spec-writing",
112
+ "om-setup-agent-pipeline"
113
+ ],
114
+ "om-verify-in-repo": ["om-setup-agent-pipeline"],
115
+ "om-root-cause": ["om-setup-agent-pipeline"],
116
+ "om-fix": ["om-setup-agent-pipeline"],
117
+ "om-open-pr": ["om-setup-agent-pipeline"],
118
+ "om-setup-agent-pipeline": []
119
+ },
120
+ "contentHashes": {
121
+ "om-spec-writing": "sha256:80d5def47ff844748b1c7407cae8b8ee8588ccdfaee54022e15de885d59fa398",
122
+ "om-code-review": "sha256:f4503da210e6e5eb7d79a0972d3922a2888d8aed93e98a1bb73091c0dc2a750e",
123
+ "om-integration-tests": "sha256:a1385dbb9fe11fe8c7a16dbe8576e44b9e03f34254e5575955d5a6ea862ee741",
124
+ "om-prepare-test-env": "sha256:ccfeb9accfffeaf35423576aacc08c9a6e3d3b07ecf8f72da694878fb3a571ab",
125
+ "om-apply-upgrade-notes": "sha256:15d4166a9229ebe15365ad3ef50919443478ef5f4c1f2e7cccbf1b8a61482d0d",
126
+ "om-auto-create-pr": "sha256:fe5a8ff632234c74cd1b948dfa2f69bf79683df067d3b8bc116d7a954d017138",
127
+ "om-auto-continue-pr": "sha256:ced195e0e571672188b34322a9c215df225a9a1822e1db27f6b864b01624e66e",
128
+ "om-auto-create-pr-loop": "sha256:0e7c015705a89e623c4f6865901121404feb1f443e0e096facb2a337ad9d33a5",
129
+ "om-auto-continue-pr-loop": "sha256:2997eb7cbf131e1b88abf05ad930e793675c3cd1db1fece18438ec21b327c6ef",
130
+ "om-auto-review-pr": "sha256:c05b3f45de9563faa0561a3a12129f4fda8bb1780f60d1cdcce7383e75e2d1c5",
131
+ "om-auto-implement-spec": "sha256:f5408771aa3765c9c8f2709f5d17247d9b8fef19fd2461c2fedf25c90bb8cda7",
132
+ "om-auto-write-spec": "sha256:b0d79e189fef7f5c03540becda01d933f5153e39276988f58f9c1dd81e9887f7",
133
+ "om-auto-qa-pr": "sha256:bff71bf4020a1e92b56a17f35f9c63c5f8f942e95048d5bbdf5589443c2cbda9",
134
+ "om-auto-fix-issue": "sha256:8ca990752fc1e73f2a70902d567b94da6c74b15f4e409410aa27ba09b1506521",
135
+ "om-prepare-issue": "sha256:07dd578b00902e65abb408e233688675cc92d6783af1a43257ebfd2d5be34663",
136
+ "om-verify-in-repo": "sha256:2fcf67187b129261aeb59b53c8058e95eb91c1f3c0314756ff5f432a34c43a62",
137
+ "om-root-cause": "sha256:7c14fd6388ff72c8bb058de905264899b7ee9797bb4985b1891ec2da0ec1c815",
138
+ "om-fix": "sha256:c9eb58f7834026c13f2533ae6fc4987d32a0e3cec1fd7b220b47d7154ee6e804",
139
+ "om-open-pr": "sha256:18ef43308dd3e5aff2099b38779cb7447ae26b754d31e18a0f49f857bafdcba7",
140
+ "om-setup-agent-pipeline": "sha256:6f906df68194af5ef4d40ccaf6f4335d44f45ddcffa6e1f36331291ac90377c8"
141
+ }
26
142
  },
27
143
  "tiers": {
28
144
  "core": {
29
- "description": "Daily-driver standalone skills installed by default.",
145
+ "description": "Daily standalone architecture, implementation, extension, debugging, and harness-maintenance skills.",
30
146
  "skills": [
31
147
  "om-help",
32
148
  "om-implement-spec",
@@ -34,21 +150,27 @@
34
150
  "om-module-scaffold",
35
151
  "om-data-model-design",
36
152
  "om-system-extension",
153
+ "om-integration-builder",
154
+ "om-create-ai-agent",
155
+ "om-build-workflow",
37
156
  "om-troubleshooter",
157
+ "om-framework-context",
158
+ "om-evolve-harness",
159
+ "om-judge-agent-session",
160
+ "om-share-this-session",
38
161
  "om-eject-and-customize"
39
162
  ]
40
163
  },
41
164
  "automation": {
42
- "description": "Module-management helpers. Opt-in.",
165
+ "description": "Optional advanced delivery workflows and module-footprint maintenance.",
43
166
  "skills": ["om-trim-unused-modules"]
44
167
  },
45
- "infra": {
46
- "description": "Rare, special-case skills.",
47
- "skills": ["om-integration-builder"]
48
- },
49
168
  "migration": {
50
- "description": "One-shot, version-pinned migrations. Install only when needed.",
51
- "skills": ["om-auto-upgrade-0.4.10-to-0.5.0"]
169
+ "description": "One-shot, version-pinned migrations. Install only for the named upgrade.",
170
+ "skills": [
171
+ "om-auto-upgrade-0.4.10-to-0.5.0",
172
+ "om-auto-upgrade-0.6.6-to-0.6.7"
173
+ ]
52
174
  }
53
175
  }
54
176
  }
@@ -1,88 +1,100 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://open-mercato.dev/schemas/skills/tiers.schema.json",
4
- "title": "Open Mercato skills tier manifest",
5
- "description": "Manifest mapping skill folders under .ai/skills/ to install tiers consumed by scripts/install-skills.sh.",
4
+ "title": "Standalone Open Mercato skill manifest",
6
5
  "type": "object",
7
6
  "additionalProperties": false,
8
- "required": ["default", "tiers"],
7
+ "required": ["default", "external", "tiers"],
9
8
  "properties": {
10
- "$schema": {
11
- "type": "string"
12
- },
9
+ "$schema": { "type": "string" },
13
10
  "default": {
14
11
  "type": "array",
15
12
  "minItems": 1,
16
- "items": {
17
- "type": "string",
18
- "minLength": 1
19
- },
20
- "description": "Tier names installed when install-skills.sh is invoked with no flags."
13
+ "uniqueItems": true,
14
+ "items": { "$ref": "#/$defs/tierName" }
21
15
  },
22
16
  "agents": {
23
17
  "type": "object",
24
18
  "additionalProperties": false,
25
- "description": "Agent harness settings for install-skills.sh. Skills always install into the canonical .agents/skills/ directory; per-agent symlinks are created only for agents that cannot read it.",
26
19
  "properties": {
27
20
  "ignore": {
28
21
  "type": "array",
29
- "description": "Agents whose directories install-skills.sh must never write. Overridden by --ignore-agents.",
30
- "items": {
31
- "type": "string",
32
- "enum": ["claude-code", "codex", "cursor"]
33
- }
22
+ "uniqueItems": true,
23
+ "items": { "enum": ["claude-code", "codex", "cursor"] }
34
24
  }
35
25
  }
36
26
  },
37
27
  "external": {
38
28
  "type": "object",
39
29
  "additionalProperties": false,
40
- "required": ["source", "skills"],
41
- "description": "Skills owned by an external collection and installed via `npx skills add` instead of local symlinks. Folders under .ai/skills/ matching these names are repo-local overrides, not installable skills.",
30
+ "required": ["source", "ref", "tiers", "skills", "dependencies", "contentHashes"],
42
31
  "properties": {
43
- "source": {
44
- "type": "string",
45
- "minLength": 1,
46
- "description": "The skills package source, e.g. a GitHub owner/repo."
47
- },
48
- "description": {
49
- "type": "string"
32
+ "source": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$" },
33
+ "ref": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
34
+ "description": { "type": "string" },
35
+ "tiers": {
36
+ "type": "object",
37
+ "minProperties": 1,
38
+ "propertyNames": { "$ref": "#/$defs/tierName" },
39
+ "additionalProperties": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["description", "skills"],
43
+ "properties": {
44
+ "description": { "type": "string", "minLength": 1 },
45
+ "skills": {
46
+ "type": "array",
47
+ "minItems": 1,
48
+ "uniqueItems": true,
49
+ "items": { "$ref": "#/$defs/skillName" }
50
+ }
51
+ }
52
+ }
50
53
  },
51
54
  "skills": {
52
55
  "type": "array",
53
56
  "minItems": 1,
54
- "items": {
55
- "type": "string",
56
- "pattern": "^[a-z0-9][a-z0-9._-]*$"
57
+ "uniqueItems": true,
58
+ "items": { "$ref": "#/$defs/skillName" }
59
+ },
60
+ "dependencies": {
61
+ "type": "object",
62
+ "propertyNames": { "pattern": "^[a-z0-9][a-z0-9._-]*$" },
63
+ "additionalProperties": {
64
+ "type": "array",
65
+ "uniqueItems": true,
66
+ "items": { "$ref": "#/$defs/skillName" }
57
67
  }
68
+ },
69
+ "contentHashes": {
70
+ "type": "object",
71
+ "propertyNames": { "pattern": "^[a-z0-9][a-z0-9._-]*$" },
72
+ "additionalProperties": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
58
73
  }
59
74
  }
60
75
  },
61
76
  "tiers": {
62
77
  "type": "object",
63
78
  "minProperties": 1,
64
- "propertyNames": {
65
- "pattern": "^[a-z][a-z0-9-]*$"
66
- },
79
+ "propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
67
80
  "additionalProperties": {
68
81
  "type": "object",
69
82
  "additionalProperties": false,
70
83
  "required": ["description", "skills"],
71
84
  "properties": {
72
- "description": {
73
- "type": "string",
74
- "minLength": 1
75
- },
85
+ "description": { "type": "string", "minLength": 1 },
76
86
  "skills": {
77
87
  "type": "array",
78
88
  "minItems": 1,
79
- "items": {
80
- "type": "string",
81
- "pattern": "^[a-z0-9][a-z0-9._-]*$"
82
- }
89
+ "uniqueItems": true,
90
+ "items": { "$ref": "#/$defs/skillName" }
83
91
  }
84
92
  }
85
93
  }
86
94
  }
95
+ },
96
+ "$defs": {
97
+ "skillName": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
98
+ "tierName": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }
87
99
  }
88
100
  }
@@ -21,6 +21,7 @@ Example: 2026-03-01-inventory-module.md
21
21
 
22
22
  ## Workflow
23
23
 
24
- 1. Before coding any significant feature, check for an existing spec
25
- 2. If none: create from SPEC-000-template.md, review with team, then code
26
- 3. After implementation: update the spec's Changelog and Acceptance Criteria
24
+ 1. Route every new application, multi-module feature, or non-trivial business slice through `om-spec-writing` and `.ai/guides/spec-delivery.md`.
25
+ 2. After invoking the skill, create the skeleton from `SPEC-000-template.md`; keep it `Draft` while blocking questions or incomplete contracts remain.
26
+ 3. Set `Ready for implementation` only after the final compliance report and requirement traceability pass and the user approves implementation.
27
+ 4. Implement through `om-implement-spec` (interactive local) or `om-auto-implement-spec` (whole-spec PR), one dependency-ordered phase at a time; update the Changelog, acceptance evidence, and phase state as work lands. Local delivery confirms its phase-derived plan before coding and ends with the stable `Spec:` reference without implying PR automation.
@@ -3,33 +3,249 @@
3
3
  **Date**: {YYYY-MM-DD}
4
4
  **Status**: Draft
5
5
 
6
+ > Use `om-spec-writing` for every new application, multi-module feature, or other non-trivial business slice. Keep every section below; write `N/A — {reason}` when a section does not apply. Change the status to `Ready for implementation` only after every blocking open question is resolved and the traceability table covers every requirement.
7
+
6
8
  ## TLDR
7
9
 
8
- {2-3 sentence summary}
10
+ {What is being built, who benefits, which existing Open Mercato capabilities are reused, and the smallest coherent outcome.}
9
11
 
10
12
  ## Problem Statement
11
13
 
12
- {What problem this feature solves}
14
+ {Current workflow, concrete pain, evidence, affected users, and why existing behavior is insufficient.}
15
+
16
+ ## Overview and Success Measures
17
+
18
+ - **Primary outcome:** {Measurable business result and target.}
19
+ - **Leading indicators:** {Signals available before the final outcome.}
20
+ - **Baseline:** {Current measurable state or `unknown — measurement plan`.}
21
+ - **Market / product reference:** {Comparable product or workflow studied; what is adopted, rejected, and why.}
22
+
23
+ ## Goals
24
+
25
+ - **REQ-001** — {Observable business outcome.}
26
+ - **REQ-002** — {Observable business outcome.}
27
+
28
+ ## Non-goals
29
+
30
+ - {Explicitly excluded behavior, module, integration, or migration.}
13
31
 
14
32
  ## Proposed Solution
15
33
 
16
- {High-level approach}
34
+ {Describe the product and technical approach, how it closes each stated problem, and why it is the smallest platform-native solution that can deliver the goals.}
35
+
36
+ ### Design Decisions and Alternatives
37
+
38
+ | Decision | Rationale | Alternative considered | Why rejected / deferred |
39
+ |---|---|---|---|
40
+ | {choice} | {why it fits the requirements and platform} | {alternative} | {tradeoff} |
41
+
42
+ ## Domain Vocabulary and Business Rules
43
+
44
+ | Term / invariant | Precise meaning or rule | Source of truth | Failure behavior |
45
+ |---|---|---|---|
46
+ | {term} | {one unambiguous meaning, formula, lifecycle, or constraint} | {module/entity/provider} | {reject/degrade/retry/audit} |
47
+
48
+ Define fields, states, transitions, calculations, ownership, and invariants precisely enough that implementation does not need to invent domain behavior.
49
+
50
+ ## Users, Permissions, and Scope
51
+
52
+ | Actor | Allowed outcomes | Scope rule | Required feature IDs |
53
+ |---|---|---|---|
54
+ | {actor} | {view/create/update/etc.} | {own/team/organization/system} | `{module}.view`, `{module}.manage` |
55
+
56
+ Document how trusted `tenantId` and `organizationId` are derived. Describe any legitimate system-scope operation and the installed contract that authorizes it.
57
+
58
+ ## Reuse and Ownership Map
59
+
60
+ | Capability | Reuse / extend / app-own | Existing module or new module | Integration seam | Why |
61
+ |---|---|---|---|---|
62
+ | {capability} | {reuse/UMES/app-owned} | `{module}` | {ID/snapshot/event/enricher/extension/optional DI} | {decision} |
63
+
64
+ Name the installed records that remain the source of truth. Do not duplicate CRM, auth, directory, notification, workflow, or other installed capabilities in app-owned entities.
65
+
66
+ ## Architecture and Data Flow
67
+
68
+ ```text
69
+ {actor/surface} -> {API/command} -> {owning entity}
70
+ -> {event/subscriber/integration}
71
+ ```
72
+
73
+ - **Module boundaries:** {Why each new module owns a distinct invariant; merge modules that must remain transactionally consistent.}
74
+ - **Extension points:** {Installed page/menu/widget/enricher/interceptor/event seams used instead of modifying installed code.}
75
+ - **Alternatives considered:** {Simpler platform-native alternative and why it was not selected.}
76
+ - **Compatibility:** {Existing API/data/UI behavior that must remain stable.}
77
+
78
+ ## User Journeys
79
+
80
+ ### Journey J-001 — {Name}
81
+
82
+ 1. {Actor starts from a named page or API.}
83
+ 2. {Primary action and system response.}
84
+ 3. {Success state and downstream side effects.}
85
+ 4. {Recoverable failure, permission denial, conflict, and retry behavior.}
86
+
87
+ ## UI and Interaction Contracts
88
+
89
+ List every new or changed page before implementation. Inspect the closest existing Open Mercato page and `.ai/guides/backend-ui.md`; record that reference below. Tabular admin data uses `DataTable`, CRUD create/edit surfaces use `CrudForm`, and backend reads use the shared API helpers. Any custom page or component exception needs an explicit rationale and approval in this section.
90
+
91
+ | Surface / route | Purpose and primary actions | Data source / mutations | Closest installed reference | Canonical shell / components | Required states | Requirement IDs |
92
+ |---|---|---|---|---|---|---|
93
+ | `/backend/{route}` | {list/create/edit/etc.} | `{API paths / command IDs}` | `{module/path or component family}` | `Page`, `PageBody`, `DataTable`, `CrudForm`, {others} | loading, empty, error, conflict, success, permission denied | REQ-001 |
94
+
95
+ ### UI architecture
96
+
97
+ | Role | Navigation groups in order | Dashboard / injected widgets | Login-to-primary-task flow |
98
+ |---|---|---|---|
99
+ | {role} | {group → item} | {widget, host, click-through} | {page → action → result; target ≤3 clicks} |
100
+
101
+ | Surface / widget | Empty state guidance and action | Responsive behavior | Keyboard / focus behavior |
102
+ |---|---|---|---|
103
+ | {surface} | {localized explanation + next action} | {narrow/mobile layout} | {focus order, submit/cancel, announcements} |
104
+
105
+ ### `/backend/{route}` — {Page name}
106
+
107
+ ```text
108
+ ┌────────────────────────────────────────────────────────────┐
109
+ │ {Page title} [{Primary action}]│
110
+ │ {Filters / summary / navigation} │
111
+ ├────────────────────────────────────────────────────────────┤
112
+ │ {DataTable, CrudForm groups, calendar, or detail sections} │
113
+ ├────────────────────────────────────────────────────────────┤
114
+ │ {Pagination / save-delete actions / status feedback} │
115
+ └────────────────────────────────────────────────────────────┘
116
+ ```
117
+
118
+ - **Behavior:** {sorting/filtering/pagination, validation, keyboard behavior, navigation, destructive confirmation, optimistic-lock conflict recovery.}
119
+ - **Responsive and accessibility:** {focus order, labels, screen-reader status, small-screen behavior.}
120
+ - **Localization:** {translation namespaces and dynamic values.}
121
+ - **Design-system and theming:** {semantic tokens and shared primitives; verify light and dark mode, contrast, reduced motion, and no hard-coded palette/status colors.}
122
+
123
+ For backend UI, implementation must invoke `om-backend-ui-design` and follow `.ai/guides/backend-ui.md`. Raw `<table>`, raw admin `<form>`, raw `fetch`, copied component families, arbitrary Tailwind values, hard-coded light-only colors, and manual `dark:` patches fail readiness unless the approved contract explains why the platform primitive cannot support the interaction. A custom calendar, board, or clinical workspace may be justified, but its surrounding shell, controls, status treatment, dialogs, states, and tokens remain platform-native.
17
124
 
18
125
  ## Data Models
19
126
 
20
- {Entity definitions, relationships}
127
+ ### `{Entity}`
128
+
129
+ | Field | Type / nullability | Scope / index | Sensitive / encrypted | Lifecycle and validation |
130
+ |---|---|---|---|---|
131
+ | `id` | UUID, required | primary key | no | immutable |
132
+ | `tenant_id` / `organization_id` | UUID, required | composite scope indexes | no | trusted context only |
133
+ | `updated_at` | timestamp, required | optimistic-lock version | no | updated on every edit |
134
+
135
+ Document entity ownership, soft-delete or append-only rules, cross-module IDs/snapshots, uniqueness, transactions, encryption maps, retention, migrations, and compatibility impact.
136
+
137
+ ## API, Command, and Error Contracts
138
+
139
+ | Method / command | Path / ID | Auth and feature gate | Input | Success response / event | Errors and concurrency | Requirement IDs |
140
+ |---|---|---|---|---|---|---|
141
+ | `GET` | `/api/{path}` | auth + `{module}.view` | {query schema} | `{ items, totalCount }` | 400/401/403 | REQ-001 |
142
+ | `POST` | `/api/{path}` | auth + `{module}.manage` | {body schema} | 201 + `{module}.{entity}.created` | 400/403/409 | REQ-002 |
143
+
144
+ State whether each route uses `makeCrudRoute` or a custom guarded command route. Include per-method `metadata`, OpenAPI schemas, scope derivation, idempotency, optimistic locking, and stable public-contract implications.
145
+
146
+ ## Events, Jobs, Notifications, and Cross-Module Flows
147
+
148
+ | Trigger | Producer | Consumer | Side effect | Retry / idempotency / audit behavior |
149
+ |---|---|---|---|---|
150
+ | `{module}.{entity}.{action}` | `{module}` | `{subscriber}` | {result} | {contract} |
151
+
152
+ Describe scheduled work, progress, cache invalidation, failure recovery, and optional-module behavior where applicable.
153
+
154
+ ## Security, Privacy, and Compliance
155
+
156
+ - **Authorization:** {feature gates and record-level scope; never role-name checks.}
157
+ - **Tenant isolation:** {read/write filters and fail-closed behavior.}
158
+ - **Sensitive data:** {encryption map, safe reads, redaction, retention, audit policy.}
159
+ - **Abuse and failure modes:** {enumeration, injection, replay, concurrency, destructive action, secret exposure.}
160
+
161
+ ## Integration Coverage
162
+
163
+ Tests must be self-contained and map to real API and UI paths.
164
+
165
+ | Test ID | Level | Setup / fixture | Actions | Assertions | Requirement IDs |
166
+ |---|---|---|---|---|---|
167
+ | TEST-001 | integration | {tenant/org/users/records} | {API or browser flow} | {success + persisted state + event} | REQ-001 |
168
+ | TEST-002 | security | {second tenant / insufficient feature} | {forbidden read/write} | {fail closed; no data leak} | REQ-001 |
169
+ | TEST-003 | UI | {records and permissions} | {loading/empty/error/conflict/keyboard flow} | {observable result} | REQ-002 |
170
+
171
+ ## Implementation Phases
172
+
173
+ Phases are dependency ordered. Only the current phase may enter implementation; parallel work is limited to independent slices inside that phase. Each phase must leave a working app and close with its own evidence before the next phase starts.
21
174
 
22
- ## API Contracts
175
+ ### Phase 1 — {Foundation or first complete vertical slice}
23
176
 
24
- {Endpoints, request/response schemas}
177
+ - **Depends on:** none
178
+ - **Outcome:** {user-visible or independently verifiable result}
179
+ - **Why this order / value delivered:** {dependency and measurable business value available at phase completion}
180
+ - **Deliverables:** {specific entities, commands, routes, pages, subscribers, migrations}
181
+ - **Independent slices / estimated commits:** {bounded work that may run in parallel inside this phase only}
182
+ - **Requirements closed:** REQ-001
183
+ - **Tests:** TEST-001, TEST-002
184
+ - **Validation:** `yarn generate`, {focused typecheck/tests/integration paths}
185
+ - **Exit gate:** {observable criteria proving this phase works end to end, including affected UI in light/dark and narrow-width states}
186
+
187
+ ### Phase 2 — {Next complete vertical slice}
188
+
189
+ - **Depends on:** Phase 1 exit gate
190
+ - **Outcome:** {result}
191
+ - **Why this order / value delivered:** {dependency and measurable business value}
192
+ - **Deliverables:** {specific files/seams}
193
+ - **Independent slices / estimated commits:** {bounded work inside this phase}
194
+ - **Requirements closed:** REQ-002
195
+ - **Tests:** TEST-003
196
+ - **Validation:** {focused commands}
197
+ - **Exit gate:** {observable criteria}
198
+
199
+ ## Requirement Traceability
200
+
201
+ | Requirement | Journey / surface | Data/API/event contracts | Phase | Tests | Acceptance criterion |
202
+ |---|---|---|---|---|---|
203
+ | REQ-001 | J-001, `/backend/{route}` | `{entity}`, `GET /api/{path}` | Phase 1 | TEST-001, TEST-002 | AC-001 |
204
+
205
+ Every requirement must map to a phase, at least one test oracle, and a measurable acceptance criterion. No phase may be a catch-all “integration and polish” bucket for behavior required by earlier slices.
206
+
207
+ ## Rollout, Migration, and Rollback
208
+
209
+ {Migration generation/application boundary, seed/setup work, feature flags, compatibility bridge, observability, rollout order, and reversible rollback steps.}
210
+
211
+ ## Risks and Tradeoffs
212
+
213
+ | Risk / tradeoff | Impact | Mitigation / detection | Residual risk |
214
+ |---|---|---|---|
215
+ | {risk} | {impact} | {test/metric/guard} | {accepted remainder} |
216
+
217
+ Cover data integrity and concurrency, cascading/event failures, tenant isolation and privacy, migration/rollback, external-service degradation, scale/storage, and operational detection. Do not use “standard risks” as a substitute for concrete failure scenarios.
25
218
 
26
219
  ## Acceptance Criteria
27
220
 
28
- - [ ] {Criterion 1}
29
- - [ ] {Criterion 2}
221
+ - [ ] **AC-001** — {Measurable end-to-end result, including actor and scope.}
222
+ - [ ] **AC-002** — {Measurable failure/safety result.}
223
+ - [ ] Every listed backend surface matches its recorded Open Mercato reference and uses the canonical shell/components, shared API helpers, semantic tokens, and complete loading, empty, error, conflict, keyboard, accessibility, responsive, light-mode, and dark-mode states.
224
+ - [ ] Every affected API and UI path has self-contained integration coverage and the configured validation gate passes.
225
+
226
+ ## Final Compliance Report
227
+
228
+ | Check | Status | Evidence / resolution |
229
+ |---|---|---|
230
+ | Applicable `AGENTS.md` files and routed guides/skills reviewed | pass/fail | {paths} |
231
+ | Data models, APIs, events, UI, and tests are internally consistent | pass/fail | {traceability rows} |
232
+ | Every workflow completes end to end without a catch-all integration phase | pass/fail | {journeys/phases} |
233
+ | Platform-native reuse and extension points were chosen before custom code | pass/fail | {reuse decisions} |
234
+ | UI contracts identify references, canonical components, and theme/state coverage | pass/fail | {surfaces} |
235
+ | Every phase has dependencies, bounded slices, tests, value, and an observable exit gate | pass/fail | {phases} |
236
+
237
+ Verdict must be exactly `Ready for implementation` or `Blocked — {unresolved items}`. The document status may change to ready only when every row passes.
238
+
239
+ ## Open Questions
240
+
241
+ Blocking questions must be resolved before setting `Status: Ready for implementation`.
242
+
243
+ | ID | Question | Owner | Blocking? | Resolution / decision date |
244
+ |---|---|---|---|---|
245
+ | Q-001 | {question} | {owner} | yes/no | {pending or decision} |
30
246
 
31
247
  ## Changelog
32
248
 
33
249
  | Date | Change |
34
- |------|--------|
35
- | {date} | Initial spec |
250
+ |---|---|
251
+ | {date} | Initial draft |