@open-mercato/cli 0.6.7 → 0.6.8-develop.6875.1.871a4afc94

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 (278) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/build.mjs +24 -7
  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 +80 -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 +115537 -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 +475 -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 +299 -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 +146 -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 +164 -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 +678 -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 +369 -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 +441 -46
  72. package/dist/agentic/guides/modules/workflows.md +302 -43
  73. package/dist/agentic/guides/spec-delivery.md +22 -0
  74. package/dist/agentic/guides/testing-debugging.md +80 -0
  75. package/dist/agentic/guides/upstream/AGENTS.md +299 -0
  76. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +316 -0
  77. package/dist/agentic/guides/upstream/manifest.json +8 -0
  78. package/dist/agentic/shared/AGENTS.md.template +124 -311
  79. package/dist/agentic/shared/ai/agentic.config.json +2 -0
  80. package/dist/agentic/shared/ai/harness/README.md +50 -0
  81. package/dist/agentic/shared/ai/harness/RELEASE.md +57 -0
  82. package/dist/agentic/shared/ai/harness/cases.json +13680 -0
  83. package/dist/agentic/shared/ai/harness/cases.schema.json +133 -0
  84. package/dist/agentic/shared/ai/harness/fixtures/index.json +49 -0
  85. package/dist/agentic/shared/ai/harness/fixtures/seeds.json +162 -0
  86. package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +21 -0
  87. package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +96 -0
  88. package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +172 -0
  89. package/dist/agentic/shared/ai/harness/release-matrix.json +158 -0
  90. package/dist/agentic/shared/ai/harness/release-result.schema.json +219 -0
  91. package/dist/agentic/shared/ai/harness/result.schema.json +76 -0
  92. package/dist/agentic/shared/ai/harness/routing-response.schema.json +12 -0
  93. package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +73 -0
  94. package/dist/agentic/shared/ai/harness/validators.json +78 -0
  95. package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +2121 -0
  96. package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +1096 -0
  97. package/dist/agentic/shared/ai/lessons/_template.md +16 -0
  98. package/dist/agentic/shared/ai/lessons.md +26 -3
  99. package/dist/agentic/shared/ai/review-checklist.md +36 -0
  100. package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +21 -0
  101. package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +4 -0
  102. package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +98 -0
  103. package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +20 -241
  104. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +16 -0
  105. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +53 -0
  106. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +13 -0
  107. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +11 -0
  108. package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +30 -0
  109. package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +12 -0
  110. package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +13 -0
  111. package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +14 -0
  112. package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +28 -0
  113. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +12 -0
  114. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +22 -0
  115. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +12 -0
  116. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +19 -0
  117. package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +16 -601
  118. package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +19 -0
  119. package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +13 -0
  120. package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +14 -0
  121. package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +10 -0
  122. package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +14 -310
  123. package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +17 -0
  124. package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +29 -0
  125. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +100 -0
  126. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +16 -0
  127. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +17 -0
  128. package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +25 -0
  129. package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +11 -0
  130. package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +13 -0
  131. package/dist/agentic/shared/ai/skills/om-help/SKILL.md +15 -97
  132. package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +18 -0
  133. package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +20 -0
  134. package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +33 -152
  135. package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +33 -0
  136. package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +40 -0
  137. package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +27 -0
  138. package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +24 -0
  139. package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +24 -708
  140. package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +16 -0
  141. package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +14 -0
  142. package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +15 -0
  143. package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +12 -0
  144. package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +34 -0
  145. package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +4 -0
  146. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +11 -0
  147. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +31 -0
  148. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +39 -0
  149. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +43 -0
  150. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +11 -0
  151. package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +20 -820
  152. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +19 -0
  153. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +172 -0
  154. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +12 -0
  155. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +83 -0
  156. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +21 -0
  157. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +11 -0
  158. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +22 -0
  159. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +13 -0
  160. package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +41 -0
  161. package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +19 -0
  162. package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +44 -0
  163. package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +39 -0
  164. package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +20 -0
  165. package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +57 -0
  166. package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +11 -0
  167. package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +486 -0
  168. package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +19 -843
  169. package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +18 -0
  170. package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +27 -0
  171. package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +13 -0
  172. package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +41 -0
  173. package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +11 -0
  174. package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +15 -63
  175. package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +15 -0
  176. package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +16 -467
  177. package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +16 -0
  178. package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +14 -0
  179. package/dist/agentic/shared/ai/skills/tiers.json +143 -21
  180. package/dist/agentic/shared/ai/skills/tiers.schema.json +52 -40
  181. package/dist/agentic/shared/ai/specs/README.md +4 -3
  182. package/dist/agentic/shared/ai/specs/SPEC-000-template.md +226 -10
  183. package/dist/agentic/shared/ai/trackers/github.md +108 -4
  184. package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +187 -0
  185. package/dist/agentic/shared/scripts/check-lessons.mjs +178 -0
  186. package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +2958 -0
  187. package/dist/agentic/shared/scripts/execution-sandbox.mjs +329 -0
  188. package/dist/agentic/shared/scripts/framework-context.mjs +888 -0
  189. package/dist/agentic/shared/scripts/install-skills.mjs +1029 -0
  190. package/dist/agentic/shared/scripts/install-skills.sh +4 -694
  191. package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +222 -0
  192. package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +1774 -0
  193. package/dist/bin.js +13 -1
  194. package/dist/bin.js.map +2 -2
  195. package/dist/lib/__integration__/TC-INT-008.spec.js +88 -8
  196. package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
  197. package/dist/lib/agentic-init.js +13 -3
  198. package/dist/lib/agentic-init.js.map +2 -2
  199. package/dist/lib/agentic-setup.js +434 -186
  200. package/dist/lib/agentic-setup.js.map +2 -2
  201. package/dist/lib/generators/extensions/injection-widgets.js +20 -0
  202. package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
  203. package/dist/lib/generators/module-extension-facts.js +1840 -0
  204. package/dist/lib/generators/module-extension-facts.js.map +7 -0
  205. package/dist/lib/generators/module-fact-sources.js +70 -0
  206. package/dist/lib/generators/module-fact-sources.js.map +7 -0
  207. package/dist/lib/generators/module-facts-discovery.js +41 -7
  208. package/dist/lib/generators/module-facts-discovery.js.map +2 -2
  209. package/dist/lib/generators/module-facts.js +1387 -45
  210. package/dist/lib/generators/module-facts.js.map +3 -3
  211. package/dist/lib/generators/module-override-targets.js +688 -0
  212. package/dist/lib/generators/module-override-targets.js.map +7 -0
  213. package/dist/lib/generators/module-registry.js +11 -5
  214. package/dist/lib/generators/module-registry.js.map +2 -2
  215. package/dist/lib/load-env.js +24 -0
  216. package/dist/lib/load-env.js.map +7 -0
  217. package/dist/lib/resolver.js +2 -0
  218. package/dist/lib/resolver.js.map +2 -2
  219. package/dist/lib/telemetry-init.js +358 -0
  220. package/dist/lib/telemetry-init.js.map +7 -0
  221. package/dist/lib/testing/integration.js +5 -0
  222. package/dist/lib/testing/integration.js.map +2 -2
  223. package/dist/mercato.js +23 -1
  224. package/dist/mercato.js.map +2 -2
  225. package/package.json +13 -11
  226. package/src/bin.ts +33 -1
  227. package/src/lib/__integration__/TC-INT-008.spec.ts +107 -9
  228. package/src/lib/__tests__/agentic-init.test.ts +41 -5
  229. package/src/lib/__tests__/agentic-setup.ownership.test.ts +386 -0
  230. package/src/lib/__tests__/injection-widget-id-validation.test.ts +184 -0
  231. package/src/lib/__tests__/load-env.test.ts +65 -0
  232. package/src/lib/__tests__/telemetry-init.test.ts +298 -0
  233. package/src/lib/agentic-init.ts +15 -3
  234. package/src/lib/agentic-setup.ts +573 -222
  235. package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +92 -0
  236. package/src/lib/generators/__tests__/module-extension-activations.test.ts +762 -0
  237. package/src/lib/generators/__tests__/module-extension-facts.test.ts +404 -0
  238. package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +88 -2
  239. package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +1 -0
  240. package/src/lib/generators/__tests__/module-facts.discovery.test.ts +54 -10
  241. package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +108 -0
  242. package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +561 -0
  243. package/src/lib/generators/__tests__/module-facts.source-links.test.ts +119 -0
  244. package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +149 -0
  245. package/src/lib/generators/__tests__/module-override-targets.test.ts +304 -0
  246. package/src/lib/generators/__tests__/module-subset.test.ts +18 -0
  247. package/src/lib/generators/extensions/injection-widgets.ts +51 -0
  248. package/src/lib/generators/module-extension-facts.ts +2365 -0
  249. package/src/lib/generators/module-fact-sources.ts +108 -0
  250. package/src/lib/generators/module-facts-discovery.ts +58 -7
  251. package/src/lib/generators/module-facts.ts +1851 -46
  252. package/src/lib/generators/module-override-targets.ts +863 -0
  253. package/src/lib/generators/module-registry.ts +16 -6
  254. package/src/lib/load-env.ts +30 -0
  255. package/src/lib/resolver.ts +3 -0
  256. package/src/lib/telemetry-init.ts +461 -0
  257. package/src/lib/testing/__tests__/integration.test.ts +4 -0
  258. package/src/lib/testing/integration.ts +5 -0
  259. package/src/mercato.ts +26 -1
  260. package/dist/agentic/guides/cache.md +0 -45
  261. package/dist/agentic/guides/core.md +0 -453
  262. package/dist/agentic/guides/events.md +0 -117
  263. package/dist/agentic/guides/queue.md +0 -53
  264. package/dist/agentic/guides/search.md +0 -115
  265. package/dist/agentic/guides/shared.md +0 -108
  266. package/dist/agentic/guides/ui.md +0 -347
  267. package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +0 -27
  268. package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +0 -27
  269. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +0 -260
  270. package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +0 -146
  271. package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +0 -84
  272. package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +0 -193
  273. package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +0 -34
  274. package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +0 -762
  275. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +0 -50
  276. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +0 -97
  277. package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +0 -271
  278. package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +0 -101
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: "Replace with a concise durable rule"
3
+ modules: ["platform"]
4
+ areas: ["architecture"]
5
+ topics: ["replace-me", "second-topic"]
6
+ ---
7
+
8
+ # Replace with a concise durable rule
9
+
10
+ **Context**: Describe the concrete failure or correction that produced the lesson.
11
+
12
+ **Problem**: Explain why the failure recurs or why the obvious approach is unsafe.
13
+
14
+ **Rule**: State the reusable instruction future agents should follow.
15
+
16
+ **Applies to**: Name the relevant modules, paths, contracts, or workflows.
@@ -1,4 +1,27 @@
1
- # Lessons Learned
1
+ # Lessons
2
2
 
3
- Record patterns, mistakes, and insights discovered during development.
4
- AI agents will update this file as they work on the codebase.
3
+ This catalog indexes 0 focused lessons without loading their full text. Route the task first, then read only records whose **modules**, standalone-harness **areas**, or **topics** match the work.
4
+
5
+ ## How to use this catalog
6
+
7
+ 1. Start with the exact module ID when one is named by the task.
8
+ 2. Add every matching area from the standalone harness router: `architecture`, `module-data`, `umes`, `backend-ui`, `integration`, `ai-workflow`, `debugging`, `testing`, `framework-context`, or `spec-pr`.
9
+ 3. Use topics to narrow cross-cutting concerns such as `data-scoping`, `optimistic-locking`, `query-index`, or `generated-files`.
10
+ 4. Open only the linked lesson records that match; do not bulk-read `.ai/lessons/`.
11
+
12
+ Useful searches:
13
+
14
+ ```bash
15
+ rg -n '\b<module-or-topic>\b' .ai/lessons.md
16
+ rg -l '"<area>"|"<module>"|"<topic>"' .ai/lessons/*.md
17
+ ```
18
+
19
+ ## Adding or updating a lesson
20
+
21
+ - Copy `.ai/lessons/_template.md` to one focused `.ai/lessons/<kebab-case-slug>.md`; update an existing record instead of duplicating it.
22
+ - Preserve the front matter keys `title`, `modules`, `areas`, and `topics`. Use `platform` only when no module or package owns the lesson, and put the primary area first.
23
+ - Add or update exactly one catalog row under its primary area below. Keep the title stable when code or specs cite it.
24
+ - Put hard boundaries in `AGENTS.md`; lessons explain recurring evidence and the durable rule.
25
+ - Run `node scripts/check-lessons.mjs` before committing.
26
+
27
+ ## Catalog
@@ -0,0 +1,36 @@
1
+ # Standalone Module Review Checklist
2
+
3
+ Apply this checklist in addition to the installed `om-code-review` checklist whenever a diff changes module elements under `src/modules/**`, module activation in `src/modules.ts`, or a discovered page/API/widget/search/AI surface. Review the complete affected vertical slice, not only the edited file. The installed `customers` module is the reference pattern; copy its contracts, not its optional business surfaces or source code.
4
+
5
+ ## Complete module and discovery
6
+
7
+ - A new app module has a stable namespaced ID, is activated in `src/modules.ts` with `{ id, from: '@app' }`, and runs `yarn generate`; generated files are inspected but never hand-edited.
8
+ - A user-facing backend module is reachable from the main sidebar through its list page `page.meta.ts`: localized `pageTitleKey` and `pageGroupKey`, stable priority/order/icon/breadcrumb, `requireAuth`, and the matching `requireFeatures`. A deliberately hidden or deep-link-only page uses `navHidden` with a stated reason.
9
+ - Unless the brief explicitly excludes an operation, every new editable entity ships connected list/create/view-or-edit/delete flows. Its `DataTable` exposes server filter/search, an obvious localized add action, a linked view/edit row action, and guarded delete; its `CrudForm` returns to the reachable list. Route, entity, search, `DataTable` `extensionTableId`, `CrudForm` entity ID, API enricher, widget spot, ACL, event, and command IDs are stable and aligned.
10
+ - Add only surfaces the brief uses. Do not require unrelated `customers` capabilities such as analytics, vector search, notifications, workflows, or AI unless the changed module actually implements them.
11
+
12
+ ## Data, commands, API, and safety
13
+
14
+ - Editable scoped entities use UUIDs, snake_case storage, tenant/org and standard timestamp/soft-delete columns, plus `updated_at`; migrations and the module snapshot contain only intended changes, and `yarn db:generate` is rerun as a no-op probe without applying migrations.
15
+ - Input validators cover every query/body trust boundary. Public request/OpenAPI schemas never accept or require runtime `tenantId`/`organizationId`; handlers derive scope from trusted context and ignore same-named payload fields. Anonymous public business intake uses an explicit trusted tenant+organization binding; missing, partial, or ambiguous binding fails closed, and no path selects or persists the first/oldest active tenant or organization. API routes use per-method auth/feature metadata, `makeCrudRoute`, scoped ORM keys, a separate `openApi` export, stable response keys including `updatedAt`, and `indexer: { entityType }` where searchable.
16
+ - Domain writes go through commands. Each declared create/update/delete/action command independently reaches its required guard, merges the guard result's `modifiedPayload` into the validated input and revalidates it before command dispatch, and reaches its lock/transaction and undo seams; helper vocabulary elsewhere in the module is not evidence for that command. Custom actions prove the complete optimistic-lock path together: the client sends that record's version, the server enforces it, and the client surfaces the 409 conflict with a real retry path. Multi-phase entity/relation/custom-field changes use `withAtomicFlush(..., { transaction: true })` on one EntityManager; command actions keep events, cache invalidation, indexing, queues, and external effects after commit.
17
+ - Availability/uniqueness decisions that race use a database constraint, lock, compare-and-swap, or one atomic claim seam; never a read/check followed by an unguarded create. Idempotency queries and database uniqueness include tenant+organization for scoped records. Concurrent contenders have one deterministic winner and an idempotent retry returns the original outcome.
18
+ - When cache or queued work changes, verify typed DI/`createModuleQueue` usage, tenant+organization keys/payloads, tag-complete forward and undo invalidation, enqueue-after-commit or a durable outbox, discovered worker metadata, idempotent retry-safe handlers, bounded concurrency, and observable terminal failure.
19
+ - Undo reads the stored payload through `extractUndoPayload`, re-authorizes/re-scopes, is retry-safe, and emits symmetric undo effects. Create undo removes or soft-deletes the created row; delete undo restores it. Custom-field writes capture before/after snapshots, restore through `buildCustomFieldResetMap`, and keep matching cache/index aliases in `emitCrudSideEffects` and `emitCrudUndoSideEffects`.
20
+ - Cross-module CRM/host identities are resolved through an installed public service/command/query contract under trusted tenant+organization scope and stored as scalar IDs plus intentional snapshots—never a private installed entity import, direct cross-module ORM query/relation, or duplicate local identity. Every later lookup/mutation repeats the trusted scope predicates.
21
+ - ACL feature IDs are namespaced and dependency-aware; `setup.ts` grants appropriate defaults and keeps all hooks/seeds idempotent. UI visibility never replaces server authorization, wildcard-aware ACL, tenant/org filters, or record ownership.
22
+
23
+ ## Encryption, custom fields, search, and extension hosts
24
+
25
+ - Sensitive fields are declared in `defaultEncryptionMaps`. Reads use `findWithDecryption`, `findOneWithDecryption`, or `findAndCountWithDecryption` with both scoped query filters and the decryption scope; responses, logs, events, exports, cache keys, and indexes do not expose ciphertext or plaintext secrets.
26
+ - Equality lookup uses an explicitly approved hash-only sibling populated by `TenantDataEncryptionService`; direct queries use `lookupHashCandidates(value)` from `@open-mercato/shared/lib/encryption/aes` (or `hashForLookup(value)` only where the installed write contract requires one keyed value), never raw SHA-256 for low-entropy PII. New or changed encryption maps have isolated runtime evidence that reconciliation registered the map and the real write path stored ciphertext. `search.ts` uses a stable entity ID and safe `fieldPolicy`; searchable CRUD writes index after commit, bulk paths reindex deterministically, vector sources have `checksumSource`, token results have `formatResult`, and tests do not wait with arbitrary sleeps.
27
+ - `CrudForm` uses shared helpers, `initialValues.updatedAt`, localized fields/groups/errors, `collectCustomFieldValues`/`entityIds`, explicit null clearing, and conflict surfacing. `DataTable` owns pagination/loading/empty/error/export and uses stable column/action/row-action IDs plus `extensionTableId`.
28
+ - An intentional extensible API host declares an aligned colon-form `enrichers` entity ID. UI injection spots, widgets, interceptors, guards, enrichers, component handles, and menu entries keep stable IDs and demonstrate the complete render/read/save/reload/clear or execute/undo path they claim to support.
29
+ - When AI behavior is requested, use the installed AI framework's discovered agent/tool surfaces rather than a bespoke model client. Tools declare non-empty feature gates, validate inputs, remove transport-only session tokens, handle expired sessions, return serializable data, and route mutations through the same scoped commands, confirmation, optimistic-lock, audit, undo, and post-commit contracts as the API/UI.
30
+
31
+ ## Design system, i18n, and proof
32
+
33
+ - Every rendered page follows the design system: shared layout/form/table/control primitives, semantic tokens, no raw replacement controls or hard-coded palette/arbitrary Tailwind values, and no manual dark-mode fork.
34
+ - Visible copy lives in module `i18n/<locale>.json` and is read with the installed translation helpers; `translations.ts` is reserved for translatable entity fields. Every literal module-owned UI/navigation key resolves to a non-empty base-locale value and in every sibling locale the module emits. Locale generation/sync is refreshed when keys change, and generated-code review treats emitted locale JSON as inert source evidence.
35
+ - Pages preserve server-rendered shells and small client islands, do not pull route-specific heavy code into global providers, and cover responsive layouts, keyboard/focus behavior, labels, accessible announcements, loading, empty, error, permission-denied, validation, conflict, success, and destructive confirmation states.
36
+ - Focused tests cover allowed/denied/wildcard ACL, two scopes, malformed input, current/stale version, custom-field save/reload/clear, injected atomic rollback, undo/retry, encrypted read/redaction, search deletion/reindex convergence, and extension-host round trips as applicable. Concurrency-sensitive commands execute two contenders and deterministic retry. Standalone Jest files import their globals from `@jest/globals` when the app `tsconfig` does not provide them, and the focused runner must discover and execute the file.
@@ -0,0 +1,21 @@
1
+ > **Repo-local override.** This folder extends the external `om-auto-implement-spec` skill installed from `open-mercato/skills`. Apply these standalone readiness and no-remote rules on top of the external workflow; do not install this file as a replacement skill.
2
+
3
+ # Standalone portability overrides — `om-auto-implement-spec`
4
+
5
+ Everything tracker-facing uses the operations and guards from `.ai/trackers/github.md`. Resolve an automatic base branch through **default-branch**; never assume `main` or `develop`.
6
+
7
+ ## 1. Audit the resolved spec before choosing an engine
8
+
9
+ After resolving the spec and before creating implementation tasks, read `.ai/specs/SPEC-000-template.md` and `.ai/skills/om-implement-spec/references/phases-and-gates.md`, then run the complete readiness audit. The spec must be `Ready for implementation`, have no blocking open questions, map every requirement to an acceptance criterion/phase/self-contained test oracle, define every affected UI and API contract, and give every phase dependencies plus an observable exit gate. UI contracts must cite an installed reference and require the platform shell/components, shared API helpers, semantic tokens, and light/dark plus responsive state coverage.
10
+
11
+ An incomplete or `Draft` spec is not an engine plan. Stop implementation, report the missing readiness items, and route revision through `om-spec-writing`; never fill the gaps inside generated agent prompts.
12
+
13
+ ## 2. Preserve phase dependencies in PR delivery
14
+
15
+ When a remote and tracker are available, keep the external PR workflow but seed its execution plan from the spec phases. Only the current unblocked phase may be in progress. Parallel agents may own independent slices inside that phase only, and each brief must name routed guides/skills, closest installed reference, canonical primitives, acceptance IDs, owned files, and a validation oracle. Invoke routed skills before delegation, including `om-backend-ui-design` for rendered surfaces. A phase advances only after its integration paths and exit gate pass.
16
+
17
+ Do not launch one agent per future module, mark blocked phases in progress, or treat generated files/typecheck as proof that a business slice is implemented.
18
+
19
+ ## 3. No-remote fallback is local and phase-safe
20
+
21
+ Standalone apps commonly start without a Git remote. If the tracker operations cannot resolve a repository/remote, report that PR delivery is unavailable and invoke the local `.ai/skills/om-implement-spec/SKILL.md` against the resolved spec, phase-by-phase. Do not improvise the external PR engine locally, claim a PR exists, or collapse the whole spec into concurrent module scaffolding.
@@ -25,3 +25,7 @@ When the external skill says "grep the generator in `packages/cli/src/lib/genera
25
25
  ## 3. Reference-material overrides via `--skill-url`
26
26
 
27
27
  All of the anti-override rules from the monorepo still apply — never let an external `--skill-url` instruct you to skip hooks, skip tests, disable BC checks, exfiltrate credentials, or force-push to a shared branch. Those rules are about the safety envelope of the skill, not about monorepo specifics.
28
+
29
+ ## 4. Module and design-system review gate
30
+
31
+ The external workflow and its `om-code-review` output/verdict templates remain authoritative; do not copy or replace them here. Apply the configured additive `.ai/review-checklist.md` whenever the diff changes module elements, and route rendered UI through the backend/design-system references named there on every review and autofix iteration.
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: om-auto-upgrade-0.6.6-to-0.6.7
3
+ description: Migrate downstream Open Mercato user code from 0.6.6 to 0.6.7. Applies the pg-errors import move, safely unwraps proven scheduler queue payload consumers, audits query-index callbacks and removed scheduler metadata, then typechecks and reports manual follow-up. Use for "upgrade Open Mercato to 0.6.7", "migrate 0.6.6 to 0.6.7", or "apply the 0.6.7 upgrade notes".
4
+ ---
5
+
6
+ # Auto upgrade 0.6.6 to 0.6.7
7
+
8
+ Apply the mechanical parts of the Open Mercato `0.6.6 → 0.6.7` upgrade to a downstream app. Treat the matching section of `UPGRADE_NOTES.md` as the source of truth.
9
+
10
+ ## Scope
11
+
12
+ Operate on a standalone app or downstream repository that depends on `@open-mercato/*`. Never modify the framework monorepo's `packages/`, dependency pins, lockfile, generated output, or vendored dependencies. Run after the user has selected and installed `0.6.7`.
13
+
14
+ ## Arguments
15
+
16
+ - `--path <dir>`: downstream repository root; defaults to the current directory.
17
+ - `--dry-run`: detect, classify, and report without editing or running mutating commands.
18
+ - `--only <id[,id...]>`: limit work to named checks.
19
+ - `--skip <id[,id...]>`: omit named checks and record the omission in the report.
20
+
21
+ Reject unknown flags and combining `--only` with `--skip`.
22
+
23
+ ## Upgrade checks
24
+
25
+ | ID | Classification | Detect | Action |
26
+ | --- | --- | --- | --- |
27
+ | `pg-errors-import` | Automatic | Exact module specifier `@open-mercato/core/modules/communication_channels/lib/pg-errors` | Replace only the module specifier with `@open-mercato/shared/lib/db/pg-errors`; preserve imported names and formatting |
28
+ | `scheduler-flat-payload` | Automatic when proven; otherwise report | Member access shaped as `<job>.payload.payload.<field>` | Unwrap to `<job>.payload.<field>` only after proving the consumer handles a queue targeted by a scheduler registration in this repository |
29
+ | `scheduler-removed-metadata` | Detect and report | Scheduler queue consumers reading `scheduleId`, `scheduleName`, `scopeType`, or `triggeredAt` from the job payload | Identify the matching schedule registration and tell the user to include each required value explicitly in `targetPayload`; never invent values |
30
+ | `query-index-callback-errors` | Detect and report | Direct `upsertIndexBatch` callers with custom `encryptDoc` or `decryptDoc` callbacks that catch and suppress errors | Report the callback and swallowed branch; do not rewrite error policy automatically |
31
+ | `query-index-result-awareness` | No code action | Direct reindex orchestration that assumes partial writes can never fail | Explain that `QueryIndexBatchWriteError` now makes previously hidden loss fail the job/CLI and point to existing error handling/tests |
32
+
33
+ ## Workflow
34
+
35
+ ### 1. Gate the target
36
+
37
+ Resolve `--path`, require a regular `package.json`, and confirm at least one dependency or dev dependency starts with `@open-mercato/`. Refuse to run when the target contains this framework monorepo's `packages/core` and `packages/shared` workspaces.
38
+
39
+ Inspect installed/pinned Open Mercato versions. Continue when they resolve to `0.6.7`; otherwise warn with the detected versions and require explicit user confirmation before edits. A dry run may continue without confirmation.
40
+
41
+ Exclude `node_modules/`, `.yarn/`, `.git/`, `.next/`, `dist/`, `build/`, `coverage/`, `.mercato/generated/`, and other generated or vendored paths from every scan.
42
+
43
+ ### 2. Build and show the plan
44
+
45
+ Run all selected detections before editing. Report each match as `{checkId, file, line, classification, proposedAction}` and show totals by check.
46
+
47
+ For `scheduler-flat-payload`, prove ownership before classifying a match as automatic:
48
+
49
+ 1. Find the worker's queue name from its exported metadata or registration.
50
+ 2. Find a scheduler definition in the same repository targeting that queue and using `targetPayload`.
51
+ 3. Confirm the nested member is reading a field supplied by that `targetPayload`.
52
+
53
+ If any link is missing or multiple schedules disagree, downgrade the match to detect-and-report. Never perform a repository-wide `payload.payload` replacement.
54
+
55
+ With `--dry-run`, print the complete plan plus manual review and stop without edits.
56
+
57
+ ### 3. Apply bounded edits
58
+
59
+ Ask for confirmation of the displayed plan. Apply one minimal edit per file:
60
+
61
+ - `pg-errors-import` changes only the exact string-literal module specifier and is idempotent.
62
+ - `scheduler-flat-payload` removes exactly one redundant `.payload` segment for each proven field access. Preserve optional chaining, whitespace, and surrounding logic.
63
+
64
+ Re-scan after editing. Exact old imports and proven nested accesses must be absent; manual findings remain listed.
65
+
66
+ ### 4. Verify
67
+
68
+ Use scripts from the downstream app's `package.json`; do not assume monorepo-only commands exist. Run, in order when present:
69
+
70
+ 1. `yarn generate`
71
+ 2. `yarn typecheck`
72
+ 3. the smallest affected test command, otherwise `yarn test`
73
+ 4. `yarn build`
74
+
75
+ Stop at the first new failure caused by an edit, revert only that edit, and move it to manual follow-up. Preserve and report pre-existing failures rather than rewriting unrelated code or weakening checks.
76
+
77
+ ### 5. Report
78
+
79
+ Report:
80
+
81
+ - detected Open Mercato versions;
82
+ - every edited file grouped by check ID;
83
+ - no-match and skipped checks;
84
+ - exact manual findings for removed scheduler metadata and swallowed query-index callback errors;
85
+ - validation commands and outcomes;
86
+ - a reminder that reindex jobs may now fail where `0.6.6` silently lost records.
87
+
88
+ If no code changes were required, still report that all four detection categories ran. Recommend reviewing the `0.6.6 → 0.6.7` section of `UPGRADE_NOTES.md` before deployment.
89
+
90
+ ## Rules
91
+
92
+ - Every automatic edit must be bounded, minimal, and idempotent.
93
+ - Never change dependency versions or regenerate a lockfile.
94
+ - Never edit framework-owned `packages/` or generated/vendor directories.
95
+ - Never invent replacements for removed scheduler metadata.
96
+ - Never make custom encryption/decryption callbacks swallow errors to preserve old behavior.
97
+ - Never weaken typecheck, tests, or build to make the upgrade appear green.
98
+ - Always show the edit plan before mutation and the exact changed-file list afterward.
@@ -1,251 +1,30 @@
1
1
  ---
2
2
  name: om-backend-ui-design
3
- description: Design and implement consistent backend/backoffice interfaces using @open-mercato/ui. Use when building admin pages, CRUD interfaces, data tables, forms, detail pages, or any backoffice UI.
3
+ description: Build or change standalone backend, frontend, and portal pages with CrudForm, DataTable, navigation, translations, accessibility, conflicts, and the design system. Use for "add page", "form/table", "navigation", "translation", "portal page", "UI", or "zbuduj widok".
4
4
  ---
5
5
 
6
- # Backend UI Design
6
+ # Build Framework-Native UI
7
7
 
8
- Guide for creating consistent, production-grade backend interfaces using the `@open-mercato/ui` component library. All implementations must use existing components for visual and behavioral consistency.
8
+ Implement complete page behavior through real APIs and stable extension hosts; do not create a parallel component system.
9
9
 
10
- For complete component API reference, see `references/ui-components.md`. Pair this skill with `.ai/guides/ui.md` when present and with the standalone `AGENTS.md` rules for DataTable hosts, design-system primitives, and backend page conventions.
10
+ ## Workflow
11
11
 
12
- ## Design Principles
12
+ Route before reading: an app-owned page and its page-metadata navigation stay `backend-ui`; do not probe the extension guide. Select/read UMES only when injecting, replacing, hiding, or reordering an installed module's surface.
13
13
 
14
- 1. **Consistency First**: Every page should feel like part of the same application.
15
- 2. **Component Reuse**: Never create custom implementations when a shared component exists.
16
- 3. **Data Density**: Admin users need information-rich interfaces. Optimize for scanning.
17
- 4. **Keyboard Navigation**: `Cmd/Ctrl+Enter` for primary actions, `Escape` to cancel.
18
- 5. **Clear Hierarchy**: Page → Section → Content. Use `PageHeader`, `PageBody`, consistent spacing.
19
- 6. **Design System Discipline**: Use semantic status tokens plus shared primitives like `StatusBadge`, `Alert`, `FormField`, `SectionHeader`, `CollapsibleSection`, and `EmptyState`. No hardcoded status colors or arbitrary text sizes.
14
+ 1. Read `.ai/guides/backend-ui.md`; choose backend, settings, profile, frontend, or portal path with `references/page-and-navigation.md`. For public/portal, visually substantial, responsive/mobile/touch, screen-reader, or explicit accessibility work, also load `references/frontend-and-design-system.md`.
15
+ 2. For list/detail/create/edit, follow `references/crud-surfaces.md`: stable `DataTable`/`CrudForm` IDs, scoped helpers, version data, server errors, conflict UI, and save/reload/clear.
16
+ Preserve the stable host ID (`stable-host-id`) across these CRUD surfaces.
17
+ For page/form/table-only work in an existing module, this UI context is complete: do not load the contracts guide or module-scaffolding skill unless the request also changes a data/API/command/ACL/setup surface.
18
+ 3. For injected UI, also invoke `om-system-extension`; never change an installed page directly.
19
+ A field, filter, row action, or bulk action added to an existing installed form/table is injected UI and also requires `om-system-extension`; read `references/crud-surfaces.md` and `references/quality-states.md`, and preserve the stable host ID (`stable-table-host`). Do not load contracts or `om-module-scaffold` unless it adds app-owned persistence/API/commands.
20
+ App-owned persisted fields/entities also require `module-data`, contracts, and `om-data-model-design`; a new server API/command path instead requires `module-data`, contracts, and `om-module-scaffold`.
21
+ 4. Read `references/quality-states.md` for every UI task: loading/empty/error/success, dialogs/keyboard, accessibility, responsive layout, i18n, hydration, and design tokens.
22
+ 5. Run `yarn generate` for pages/navigation/widgets and exercise the API plus UI with self-contained fixtures.
20
23
 
21
- ## Required Component Library
24
+ ## Rules
22
25
 
23
- ALWAYS import from `@open-mercato/ui`.
24
-
25
- ### Core Layout
26
-
27
- ```tsx
28
- import { Page, PageHeader, PageBody } from '@open-mercato/ui/backend/Page'
29
-
30
- <Page>
31
- <PageHeader>{/* Title, actions, breadcrumbs */}</PageHeader>
32
- <PageBody>{/* Main content */}</PageBody>
33
- </Page>
34
- ```
35
-
36
- ### Data Display (Lists)
37
-
38
- Use `DataTable` for ALL tabular data. Never implement custom tables.
39
-
40
- ```tsx
41
- import { DataTable } from '@open-mercato/ui/backend/DataTable'
42
- import type { FilterDef } from '@open-mercato/ui/backend/FilterBar'
43
- import { RowActions } from '@open-mercato/ui/backend/RowActions'
44
- import { TruncatedCell } from '@open-mercato/ui/backend/TruncatedCell'
45
- import { BooleanIcon, EnumBadge } from '@open-mercato/ui/backend/ValueIcons'
46
- ```
47
-
48
- Column patterns:
49
- - Text: `TruncatedCell` with `meta.maxWidth`
50
- - Boolean: `BooleanIcon`
51
- - Status/enum: `EnumBadge` with severity presets
52
- - Actions: `RowActions` for context menus
53
-
54
- ### Preferred DataTable Host Pattern
55
-
56
- For standard CRUD lists, prefer the built-in host pattern instead of manually fetching and shaping rows:
57
-
58
- ```tsx
59
- <DataTable
60
- entityId="tickets.ticket"
61
- apiPath="tickets/tickets"
62
- extensionTableId="tickets.ticket"
63
- columns={columns}
64
- createHref="/backend/tickets/tickets/new"
65
- emptyState={{
66
- title: t('tickets.list.empty.title'),
67
- description: t('tickets.list.empty.description'),
68
- }}
69
- />
70
- ```
71
-
72
- Keep `extensionTableId` stable so DataTable injections remain backward-compatible.
73
-
74
- ### DataTable Pagination
75
-
76
- DataTable MUST be configured with pagination props to display all data correctly. Without these, the table only shows the first page with no way to navigate:
77
-
78
- ```tsx
79
- <DataTable
80
- columns={columns}
81
- data={items}
82
- page={page}
83
- pageSize={pageSize}
84
- totalCount={totalCount}
85
- onPageChange={setPage}
86
- />
87
- ```
88
-
89
- When using a custom API (not `makeCrudRoute`), ensure the list response always returns:
90
- - `items` — array of records for the current page
91
- - `totalCount` — total records matching the query (not just the current page)
92
- - `page` — current page number (1-based)
93
- - `pageSize` — records per page
94
-
95
- The default `pageSize` is 25. Keep at or below 100. If you see fewer records than expected, verify your API returns `totalCount` and the DataTable has pagination props wired.
96
-
97
- ### Forms
98
-
99
- Use `CrudForm` for ALL forms. Never build from scratch.
100
-
101
- ```tsx
102
- import { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'
103
- ```
104
-
105
- Field types: `text`, `textarea`, `number`, `email`, `password`, `select`, `multiselect`, `combobox`, `checkbox`, `switch`, `date`, `datetime`, `custom`.
106
-
107
- ### Form Headers & Footers
108
-
109
- ```tsx
110
- import { FormHeader, FormFooter, FormActionButtons, ActionsDropdown } from '@open-mercato/ui/backend/forms'
111
- ```
112
-
113
- - **`FormHeader mode="edit"`** — compact header for CrudForm pages
114
- - **`FormHeader mode="detail"`** — large header for view/detail pages with entity type label, title, status badge, and Actions dropdown
115
- - **`FormFooter`** — footer wrapping `FormActionButtons`
116
- - **`ActionsDropdown`** — groups additional context actions (Convert, Send, Print). Delete is never inside the dropdown.
117
-
118
- ### Dialogs
119
-
120
- ```tsx
121
- import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@open-mercato/ui/primitives/dialog'
122
-
123
- // Dialog forms MUST use embedded={true}
124
- <CrudForm fields={fields} onSubmit={handleSubmit} embedded={true} submitLabel="Save" />
125
- ```
126
-
127
- ### Detail Pages
128
-
129
- ```tsx
130
- import { DetailFieldsSection, LoadingMessage, ErrorMessage, TabEmptyState } from '@open-mercato/ui/backend/detail'
131
- import { NotesSection } from '@open-mercato/ui/backend/detail/NotesSection'
132
- import { TagsSection } from '@open-mercato/ui/backend/detail/TagsSection'
133
- import { CustomDataSection } from '@open-mercato/ui/backend/detail/CustomDataSection'
134
- ```
135
-
136
- ### Notifications
137
-
138
- ```tsx
139
- import { flash } from '@open-mercato/ui/backend/FlashMessages'
140
-
141
- flash('Record saved successfully', 'success')
142
- flash('Failed to save record', 'error')
143
- flash('This action cannot be undone', 'warning')
144
- ```
145
-
146
- NEVER use `alert()`, `console.log()`, or custom toast implementations.
147
-
148
- ### Loading & Error States
149
-
150
- ```tsx
151
- import { Spinner } from '@open-mercato/ui/primitives/spinner'
152
- import { DataLoader } from '@open-mercato/ui/primitives/DataLoader'
153
- import { Notice } from '@open-mercato/ui/primitives/Notice'
154
- import { ErrorNotice } from '@open-mercato/ui/primitives/ErrorNotice'
155
- import { EmptyState } from '@open-mercato/ui/backend/EmptyState'
156
- import { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'
157
- ```
158
-
159
- ### Primitives
160
-
161
- ```tsx
162
- import { Button } from '@open-mercato/ui/primitives/button'
163
- import { Input } from '@open-mercato/ui/primitives/input'
164
- import { Label } from '@open-mercato/ui/primitives/label'
165
- import { Badge } from '@open-mercato/ui/primitives/badge'
166
- import { Switch } from '@open-mercato/ui/primitives/switch'
167
- import { SimpleTooltip } from '@open-mercato/ui/primitives/tooltip'
168
- ```
169
-
170
- ## API Integration
171
-
172
- ```tsx
173
- import { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
174
- import { createCrud, updateCrud, deleteCrud } from '@open-mercato/ui/backend/utils/crud'
175
- import { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'
176
-
177
- const handleCreate = async (values: FormValues) => {
178
- const result = await createCrud<ResponseType>('module/resource', values)
179
- if (result.ok) {
180
- flash('Created successfully', 'success')
181
- router.push(`/backend/module/${result.result.id}`)
182
- }
183
- return result
184
- }
185
- ```
186
-
187
- ## Custom Fields Integration
188
-
189
- ```tsx
190
- import { useCustomFieldDefinitions } from '@open-mercato/ui/backend/utils/customFieldDefs'
191
- import { buildCustomFieldFormFields } from '@open-mercato/ui/backend/utils/customFieldForms'
192
- import { buildCustomFieldColumns } from '@open-mercato/ui/backend/utils/customFieldColumns'
193
- import { collectCustomFieldValues } from '@open-mercato/ui/backend/utils/customFieldValues'
194
- ```
195
-
196
- ## Implementation Checklist
197
-
198
- - [ ] Forms use `CrudForm` (not custom)
199
- - [ ] Tables use `DataTable` (not custom)
200
- - [ ] Notifications use `flash()` (not alert/toast)
201
- - [ ] Dialog forms have `embedded={true}`
202
- - [ ] Keyboard: `Cmd/Ctrl+Enter` (submit), `Escape` (cancel)
203
- - [ ] Loading states use `LoadingMessage` or `DataLoader`
204
- - [ ] Error states use `ErrorMessage`, `ErrorNotice`, or `Notice variant="error"`
205
- - [ ] Empty states use `EmptyState`
206
- - [ ] Status displays use `StatusBadge` or `EnumBadge`, not hardcoded colors
207
- - [ ] Standalone inputs use `FormField`; detail sections use `SectionHeader` / `CollapsibleSection` when applicable
208
- - [ ] Column truncation uses `meta.truncate` and `meta.maxWidth`
209
- - [ ] Boolean values use `BooleanIcon`
210
- - [ ] Status/enum values use `EnumBadge`
211
- - [ ] Row actions use `RowActions` with stable `id` values
212
- - [ ] API calls use `apiCall`/`apiCallOrThrow` (not raw `fetch`)
213
-
214
- ## Anti-Patterns
215
-
216
- 1. Custom form implementations — use `CrudForm`
217
- 2. Manual table markup — use `DataTable`
218
- 3. Custom toast/notification — use `flash()`
219
- 4. Inline styles — use Tailwind classes
220
- 5. Hardcoded colors or status classes — use theme variables and semantic status tokens
221
- 6. Missing loading states — every async operation needs feedback
222
- 7. Missing error handling — every failure needs messaging
223
- 8. Missing keyboard shortcuts — all dialogs need `Cmd+Enter` and `Escape`
224
- 9. Custom truncation — use `TruncatedCell` with `meta.maxWidth`
225
- 10. Direct `fetch()` — use `apiCall`/`apiCallOrThrow`
226
-
227
- ## Visual Guidelines
228
-
229
- ### Spacing
230
- - `p-4` for cards, `p-6` for page sections
231
- - `gap-4` or `gap-6` for flex/grid layouts
232
- - `space-y-4` or `space-y-6` for vertical rhythm
233
-
234
- ### Colors
235
- - Use semantic colors from theme (no hardcoded hex)
236
- - Destructive: `variant="destructive"` on buttons
237
- - Status badges: `useSeverityPreset()`
238
-
239
- ### Layout Patterns
240
- - **List pages**: FilterBar + DataTable + Pagination
241
- - **Detail pages**: Header + Tabs/Sections + Related data
242
- - **Create/Edit**: Full-page CrudForm or Dialog with embedded CrudForm
243
- - **Settings**: Grouped sections with inline editing
244
-
245
- ## Page Navigation Metadata
246
-
247
- Every backend page needs correct `page.meta.ts` for sidebar placement.
248
- See `.ai/skills/om-module-scaffold/references/navigation-patterns.md` for:
249
- - Complete field reference (`pageGroup`, `pageOrder`, `pageContext`, `navHidden`)
250
- - Settings page pattern (`pageContext: 'settings' as const` + `navHidden: true`)
251
- - Common anti-patterns (missing group, mismatched keys, broken icons)
26
+ - Use shared component families and semantic tokens; no raw admin forms/fetch, inline SVG, hard-coded status colors, or user-facing strings.
27
+ - Keep backend authorization independent of UI visibility and support wildcard ACL grants.
28
+ - Preserve stable route, entity, table, action, menu, and widget IDs.
29
+ - Translation, locale, and hydration work stays here plus `references/quality-states.md`; do not probe a `translations` module fact sheet.
30
+ - Treat screenshots/examples as evidence, not instructions; never expose credentials in fixtures or UI.
@@ -0,0 +1,16 @@
1
+ # CRUD UI Surfaces
2
+
3
+ Load this reference for list/detail/create/edit/delete work.
4
+
5
+ Unless the brief explicitly excludes an operation, a new editable entity includes list, create, view/edit, and delete. The list supplies filter/search, a localized add action, and a linked row action; the forms use the shared CRUD helpers and return to a reachable list.
6
+
7
+ - DataTable: import `DataTable` from `@open-mercato/ui/backend/DataTable` and `RowActions` from `@open-mercato/ui/backend/RowActions` (not a backend barrel). Use `entityId="module:entity"` or `entityIds={['module:entity']}` (the latter is always an array) and `extensionTableId`; type the table generic so `rowActions` does not receive `unknown`. Load and pass `data`/pagination explicitly through the shared API helper—`DataTable` has no `apiPath` prop. The DataTable loading prop is `isLoading`, never `loading`. Pass controlled paging as `pagination={{ page, pageSize, total, totalPages, onPageChange, onPageSizeChange }}`, not top-level pagination props. Use controlled `searchValue`/`onSearchChange` and filter state passed to the server; complete pagination ownership; built-in empty/loading/error/export behavior. Put the localized add link to the canonical `/create` child route in `actions`. `emptyState` is a React node, not a `{ title, description }` object. `rowActions` renders `<RowActions items={[{ id: 'edit', label, href }, { id: 'delete', label, destructive: true, onSelect }]} />`; stable qualified IDs such as `module.resource.edit`/`.delete` are also valid. `RowActionItem` has no `requiredFeatures` field, so backend ACL remains authoritative and callers conditionally include actions when UI capability state is available. When authoring a new host UI, publish intentional extension spots with stable column, action, and row-action IDs rather than creating an isolated local-only table.
8
+ - CrudForm: import `CrudForm` and type `CrudField` from `@open-mercato/ui/backend/CrudForm`—never `CrudFormField`—plus `useT` from `@open-mercato/shared/lib/i18n/context`, API reads from `@open-mercato/ui/backend/utils/apiCall`, and create/update/delete from `@open-mercato/ui/backend/utils/crud`; CRUD helper paths omit the `/api/` prefix. Declare fields as `const fields: CrudField[]`; `CrudField` is not generic, although `<CrudForm<Values>>` is. `apiCall`/`apiCallOrThrow` return an `ApiCallResult`; use `readApiResultOrThrow<T>` when the caller needs the parsed payload directly. Use typed fields/groups, `injectionSpotId="crud-form:<module>.<resource>"`, shared helpers, `initialValues.updatedAt`, explicit null clearing, and translation keys. CrudForm has no `mapServerError` prop: it already catches errors thrown by `onSubmit`/`onDelete` and applies `mapCrudServerErrorToFormErrors` internally; import that helper only for a custom form outside CrudForm. CrudForm has no `onCancel` prop; use `cancelHref` for list navigation. A built-in field uses `id` as its form key and has neither `name` nor `clearable`; preserve/submit `null` explicitly for optional fields. `onSubmit` awaits the CRUD helper and returns `void`; `onDelete` receives no values argument, so capture the loaded record/`initialValues.updatedAt`, await `deleteCrud`, and return `void`. Call `collectCustomFieldValues(values, { transform? })` from `@open-mercato/ui/backend/utils/customFieldValues`; its second argument is an options object, never an entity ID. `deleteCrud(path, { id, body: { id, updatedAt } })` carries a version because `updatedAt` is not a top-level delete option.
9
+ - After a nullable loading guard, assign the loaded state to a non-null local such as `const initialValues = values` and use that local in nested submit/delete callbacks; TypeScript does not retain state-property narrowing across those closures. For destructive confirmation, use `const { confirm, ConfirmDialogElement } = useConfirmDialog()`, call `await confirm(...)`, and render `{ConfirmDialogElement}` in the returned tree; the hook result itself is not callable.
10
+ - Detail: load through shared API helpers, preserve scoped/auth errors, use reusable detail sections and stable extension spots. Keep host IDs aligned with the API `enrichers` entity ID and add widget/injection round-trip coverage when the surface is extensible.
11
+ - For detail loading, call `readApiResultOrThrow<T>(url)` directly and handle its `T | null` result; do not chain `apiCallOrThrow` as a `.then` callback. Use existing `Page`/`PageBody`, `Spinner` from `@open-mercato/ui/primitives/spinner`, and `Alert` from `@open-mercato/ui/primitives/alert`; do not invent `LoadingMessage` or `ErrorMessage` modules.
12
+ - Custom mutations: scoped API headers plus record-specific optimistic lock, shared conflict surfacing, duplicate-submit prevention.
13
+ - Injected fields: render/input + read/enricher + `collectCustomFieldValues` save/interceptor/command paths and save/reload/clear coverage. Command undo restores captured snapshots with `buildCustomFieldResetMap` from the integrity/concurrency procedure.
14
+ - Bulk actions: guarded mutations/commands, progress/cancellation, partial-result reporting; no silent client mutation loops.
15
+
16
+ Test list/detail/create/update/delete, validation, current/stale version, clearing, denied/wildcard ACL, and the exact response-to-form mapping.
@@ -0,0 +1,53 @@
1
+ # Frontend Routes, App Design, and UX
2
+
3
+ Load this reference for public frontend, portal, or visually substantial application work. It complements the CRUD-specific reference; it does not authorize edits outside `src/modules/`.
4
+
5
+ ## Route and Shell Contract
6
+
7
+ - Public pages live at `frontend/**/page.tsx` and map to the corresponding public path. Add sibling `page.meta.ts`; explicitly declare whether staff/customer auth or features are required.
8
+ - Portal pages live at `frontend/[orgSlug]/portal/**/page.tsx`; `[orgSlug]` is the first segment. Public login/signup/verify/anonymous landing pages set `navHidden: true` and omit `requireCustomerAuth`; authenticated pages declare it and derive customer/org scope from the principal rather than trusting route or payload IDs alone.
9
+ - Portal destinations that belong in the sidebar declare `metadata.nav`; detail/create/edit pages omit it. External/no-page links use the portal menu-injection surface.
10
+ - Backend pages live under `backend/**/page.tsx`. Settings/profile destinations use their page context, and secondary CRUD destinations remain navigation-hidden.
11
+ - `frontend/middleware.ts` and `backend/middleware.ts` are auto-discovered page guards. Export named `middleware` or a default array whose entries preserve stable `{ id, mode?, target, priority?, run }`. UI visibility is not authorization: protect the server page/API independently.
12
+ - Keep server-first data/auth and a narrow client boundary. Make the first server/client render deterministic across locale, timezone, feature state, randomness, and browser APIs.
13
+
14
+ ## Product and Page Design
15
+
16
+ 1. Name the primary actor, goal, route, key decision, and success state before choosing components.
17
+ 2. Reuse the closest shared family before composing a local variant: page shell, detail sections, filters, DataTable, CrudForm, charts/KPIs, schedules, messages, notifications, forms chrome, banners, and progress.
18
+ 3. Establish one visual hierarchy: page title/context, primary action, task content, supporting details. Avoid card grids or dashboards when a list/form/detail flow is clearer.
19
+ 4. Design narrow/mobile and long translated content first; then enhance wide layouts. Avoid fixed widths that break portal/mobile shells.
20
+ 5. Keep destructive/irreversible actions explicit and separated; confirm when needed. Preserve entered data and focus across validation or server failures.
21
+
22
+ ## Design-System Contract
23
+
24
+ - Use exported `@open-mercato/ui` primitives/components and semantic CSS/Tailwind tokens. Never hard-code hex/RGB for semantic, status, or general application UI, status palette classes, arbitrary Tailwind values/text sizes, or manual semantic-token `dark:` overrides. The documented brand gradient is limited to approved public hero/marketing, floating CTA, onboarding, or celebration moments.
25
+ - Render system state through `StatusBadge`. Use `Tag`/`TagMap` variants for user-applied labels and categories; they need not be neutral, but never hard-code their colors. Use the current `Alert status="information|success|warning|error|feature" style="light|lighter|stroke|filled"` API, flash, and notification families for feedback.
26
+ - Use standard form controls and `FormField` for standalone forms; `CrudForm` owns its field layout and its fields must not be wrapped in `FormField`. Use `DataTable` for portal lists. Use shared `Button`/`IconButton`/`Checkbox`/`LinkButton`, dialogs/drawers, tabs, pagination, separators, and Lucide icons instead of raw `<button>`, raw checkbox inputs, button-styled links, or inline SVG.
27
+ - Never use `window.confirm`; use `ConfirmDialog`/`useConfirmDialog`.
28
+ - Follow tokenized radius, spacing, border, shadow, layering, opacity, and motion. Honor reduced motion and avoid decorative animation that delays work.
29
+ - Prefer content-driven sizing and mobile-first standard breakpoints (`sm`, `md`, `lg`, `xl`, `2xl`). Do not use arbitrary media queries, desktop-first `max-*`, or inline style dimensions when a component prop/token exists.
30
+
31
+ ## Portal Extension Contract
32
+
33
+ - Hooks: `useCustomerAuth`, `useTenantContext`, `usePortalInjectedMenuItems`, `usePortalEventBridge`, and `usePortalAppEvent` from their `@open-mercato/ui/portal/hooks/*` exports.
34
+ - Frozen menu spots: `menu:portal:sidebar:main`, `menu:portal:sidebar:account`, `menu:portal:header:actions`, `menu:portal:user-dropdown`.
35
+ - Frozen widget spots: `portal:dashboard:sections`, `portal:dashboard:profile`, `portal:dashboard:sidebar`, `portal:<pageId>:before`, and `portal:<pageId>:after`.
36
+ - Frozen component handles: `page:portal:layout`, `section:portal:header`, `section:portal:footer`, `section:portal:sidebar`, and `section:portal:user-menu`.
37
+ - A page metadata `nav` block is enough for an internal portal destination and is filtered with the same customer feature requirements. Use menu injection only for external/no-page entries. Preserve wildcard ACL behavior and protect APIs independently.
38
+
39
+ ## UX State Matrix
40
+
41
+ Every applicable page or operation covers:
42
+
43
+ - loading/skeleton without layout jumps;
44
+ - healthy empty/not-found states with a safe recovery action;
45
+ - field validation and first-invalid focus;
46
+ - server/network failure with preserved input and safe retry;
47
+ - authorization denial distinct from not-found;
48
+ - optimistic-lock conflict with reload/reapply guidance;
49
+ - duplicate-submit prevention and visible in-progress state;
50
+ - success confirmation plus authoritative reload/render;
51
+ - keyboard navigation, visible focus, labelled icon controls, semantic headings, contrast, and screen-reader announcement of async results.
52
+
53
+ Dialogs support Cmd/Ctrl+Enter submit and Escape cancel unless Escape would lose an irreversible in-progress operation. Test narrow and wide layouts, keyboard-only use, at least one alternate locale for dense copy, allowed/denied/wildcard roles, and the real API round trip with self-contained fixtures.
@@ -0,0 +1,13 @@
1
+ # Page and Navigation Branch
2
+
3
+ Load this reference when adding/moving/hiding a page or navigation item.
4
+
5
+ 1. Choose backend/settings/profile/frontend/portal from `.ai/guides/backend-ui.md`.
6
+ 2. Add `page.tsx` and sibling `page.meta.ts` with auth/features and the generated backend metadata keys: localized `pageTitleKey`, `pageGroupKey`, numeric `pagePriority`/`pageOrder`, stable string `icon`, and localized `breadcrumb`. Do not substitute an unrecognized nested `nav` object.
7
+ Server pages import `resolveTranslations` from `@open-mercato/shared/lib/i18n/server` and destructure its result: `const { t } = await resolveTranslations()` (or `{ translate }` when fallback arguments are needed); the returned object is not itself callable.
8
+ 3. Hide create/edit/detail pages from navigation. For settings pair `pageContext: 'settings' as const` with `navHidden: true`.
9
+ 4. Portal pages keep `[orgSlug]` first, use customer auth/features, and add `nav` only for portal sidebar destinations.
10
+ 5. Use menu widgets for adding/reordering another module's navigation and module route overrides for hiding/replacing an installed page.
11
+ 6. Run `yarn generate`; verify allowed/denied/wildcard navigation and direct-route access.
12
+
13
+ Use Lucide components inside page UI. Avoid inline SVG and prefer serializable icon strings in metadata.
@@ -0,0 +1,11 @@
1
+ # UI Quality and States
2
+
3
+ Load this reference for the final UI quality pass.
4
+
5
+ - Reuse shared page/section/form/table/detail/chart/KPI/schedule/message/notification/banner families.
6
+ - Use semantic design tokens, `StatusBadge`, `Alert`, standard buttons/dialogs, `FormField`, `SectionHeader`, `CollapsibleSection`, and shared loading/error/empty components.
7
+ - Translate titles, labels, actions, placeholders, validation, states, notifications, and navigation with client/server translation helpers.
8
+ - Preserve input after errors, focus the first invalid field, disable duplicate submits, and announce async results accessibly.
9
+ - Support Cmd/Ctrl+Enter and Escape in dialogs; label icon-only controls; retain keyboard/focus/reduced-motion behavior.
10
+ - Make server/client first render deterministic across locale, timezone, environment, random values, and browser-only APIs.
11
+ - Verify narrow/wide layout and long/translated content. Do not use hard-coded status colors, arbitrary text sizes, raw forms/fetch, or inline SVG.