@open-mercato/cli 0.11.1-develop.8593.1.50784dae35 โ†’ 0.11.1-develop.8687.1.adb16f62b3

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 (327) hide show
  1. package/.turbo/turbo-build.log +6 -2
  2. package/AGENTS.md +2 -0
  3. package/dist/agentic/guides/architecture.md +2 -2
  4. package/dist/agentic/guides/extensions.md +7 -2
  5. package/dist/agentic/guides/framework-extension-points.md +1 -0
  6. package/dist/agentic/guides/infrastructure-providers.md +20 -0
  7. package/dist/agentic/guides/integrations.md +2 -2
  8. package/dist/agentic/guides/module-facts.json +11067 -7122
  9. package/dist/agentic/guides/module-facts.v2.json +11055 -7094
  10. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  11. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  12. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  13. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  14. package/dist/agentic/guides/modules/assisted_selling/acl-features.md +16 -0
  15. package/dist/agentic/guides/modules/assisted_selling/contribution-resolutions.md +21 -0
  16. package/dist/agentic/guides/modules/assisted_selling/domain-commands.md +11 -0
  17. package/dist/agentic/guides/modules/assisted_selling/entities.md +11 -0
  18. package/dist/agentic/guides/modules/assisted_selling/events.md +22 -0
  19. package/dist/agentic/guides/modules/assisted_selling/exact-override-targets.md +17 -0
  20. package/dist/agentic/guides/modules/assisted_selling/index.md +21 -0
  21. package/dist/agentic/guides/modules/assisted_selling/owned-contract-module-metadata.md +11 -0
  22. package/dist/agentic/guides/modules/assisted_selling/setup.md +11 -0
  23. package/dist/agentic/guides/modules/assisted_selling/umes-contributions.md +21 -0
  24. package/dist/agentic/guides/modules/assisted_selling/umes-hosts.md +23 -0
  25. package/dist/agentic/guides/modules/attachments/exact-override-targets.md +1 -1
  26. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  27. package/dist/agentic/guides/modules/attachments/workers.md +1 -1
  28. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  29. package/dist/agentic/guides/modules/auth/index.md +1 -1
  30. package/dist/agentic/guides/modules/availability/index.md +1 -1
  31. package/dist/agentic/guides/modules/backups/di-registrations-rich.md +11 -0
  32. package/dist/agentic/guides/modules/backups/di-service-tokens.md +11 -0
  33. package/dist/agentic/guides/modules/backups/exact-override-targets.md +11 -0
  34. package/dist/agentic/guides/modules/backups/index.md +5 -2
  35. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  36. package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
  37. package/dist/agentic/guides/modules/cart/index.md +1 -1
  38. package/dist/agentic/guides/modules/catalog/acl-features.md +2 -1
  39. package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +2 -0
  40. package/dist/agentic/guides/modules/catalog/backend-pages.md +1 -0
  41. package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +5 -0
  42. package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +8 -7
  43. package/dist/agentic/guides/modules/catalog/di-service-tokens.md +5 -4
  44. package/dist/agentic/guides/modules/catalog/domain-commands.md +2 -0
  45. package/dist/agentic/guides/modules/catalog/entities.md +1 -0
  46. package/dist/agentic/guides/modules/catalog/events.md +4 -1
  47. package/dist/agentic/guides/modules/catalog/exact-override-targets.md +13 -7
  48. package/dist/agentic/guides/modules/catalog/index.md +9 -9
  49. package/dist/agentic/guides/modules/catalog/umes-contributions.md +5 -0
  50. package/dist/agentic/guides/modules/catalog/umes-hosts.md +4 -0
  51. package/dist/agentic/guides/modules/catalog/workers.md +1 -0
  52. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  53. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  54. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  55. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  56. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  57. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  58. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  59. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  60. package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
  61. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  62. package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +1 -1
  63. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  64. package/dist/agentic/guides/modules/communication_channels/workers.md +1 -1
  65. package/dist/agentic/guides/modules/configs/index.md +1 -1
  66. package/dist/agentic/guides/modules/content/index.md +1 -1
  67. package/dist/agentic/guides/modules/currencies/active-extension-bindings.md +11 -0
  68. package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +1 -1
  69. package/dist/agentic/guides/modules/currencies/di-service-tokens.md +1 -1
  70. package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -1
  71. package/dist/agentic/guides/modules/currencies/index.md +3 -2
  72. package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -1
  73. package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +2 -0
  74. package/dist/agentic/guides/modules/customer_accounts/index.md +2 -2
  75. package/dist/agentic/guides/modules/customer_accounts/workers.md +2 -0
  76. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  77. package/dist/agentic/guides/modules/customers/active-extension-bindings.md +2 -1
  78. package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +1 -0
  79. package/dist/agentic/guides/modules/customers/index.md +3 -3
  80. package/dist/agentic/guides/modules/customers/umes-hosts.md +1 -0
  81. package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +0 -1
  82. package/dist/agentic/guides/modules/dashboards/cli-commands.md +1 -0
  83. package/dist/agentic/guides/modules/dashboards/exact-override-targets.md +1 -0
  84. package/dist/agentic/guides/modules/dashboards/index.md +2 -3
  85. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  86. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  87. package/dist/agentic/guides/modules/devices/index.md +1 -1
  88. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  89. package/dist/agentic/guides/modules/directory/index.md +1 -1
  90. package/dist/agentic/guides/modules/documents/index.md +1 -1
  91. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  92. package/dist/agentic/guides/modules/entities/index.md +1 -1
  93. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  94. package/dist/agentic/guides/modules/events/index.md +1 -1
  95. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  96. package/dist/agentic/guides/modules/forms/index.md +1 -1
  97. package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
  98. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  99. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  100. package/dist/agentic/guides/modules/generators/index.md +1 -1
  101. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  102. package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +8 -8
  103. package/dist/agentic/guides/modules/integrations/di-service-tokens.md +4 -4
  104. package/dist/agentic/guides/modules/integrations/exact-override-targets.md +14 -12
  105. package/dist/agentic/guides/modules/integrations/index.md +2 -2
  106. package/dist/agentic/guides/modules/integrations/setup.md +1 -1
  107. package/dist/agentic/guides/modules/integrations/workers.md +3 -1
  108. package/dist/agentic/guides/modules/ledger/acl-features.md +16 -0
  109. package/dist/agentic/guides/modules/ledger/active-extension-bindings.md +11 -0
  110. package/dist/agentic/guides/modules/ledger/backend-pages.md +21 -0
  111. package/dist/agentic/guides/modules/ledger/domain-commands.md +22 -0
  112. package/dist/agentic/guides/modules/ledger/encryption.md +11 -0
  113. package/dist/agentic/guides/modules/ledger/entities.md +17 -0
  114. package/dist/agentic/guides/modules/ledger/events.md +19 -0
  115. package/dist/agentic/guides/modules/ledger/exact-override-targets.md +30 -0
  116. package/dist/agentic/guides/modules/ledger/index.md +22 -0
  117. package/dist/agentic/guides/modules/ledger/owned-contract-module-metadata.md +11 -0
  118. package/dist/agentic/guides/modules/ledger/setup.md +11 -0
  119. package/dist/agentic/guides/modules/ledger/umes-hosts.md +26 -0
  120. package/dist/agentic/guides/modules/messages/index.md +1 -1
  121. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  122. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  123. package/dist/agentic/guides/modules/payment_gateways/active-extension-bindings.md +1 -1
  124. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  125. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  126. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  127. package/dist/agentic/guides/modules/planner/index.md +1 -1
  128. package/dist/agentic/guides/modules/portal/index.md +1 -1
  129. package/dist/agentic/guides/modules/progress/index.md +1 -1
  130. package/dist/agentic/guides/modules/promotions/index.md +1 -1
  131. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  132. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  133. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  134. package/dist/agentic/guides/modules/resources/exact-override-targets.md +3 -3
  135. package/dist/agentic/guides/modules/resources/index.md +1 -1
  136. package/dist/agentic/guides/modules/resources/owned-contract-module-metadata.md +1 -1
  137. package/dist/agentic/guides/modules/resources/setup.md +1 -1
  138. package/dist/agentic/guides/modules/sales/contribution-resolutions.md +1 -0
  139. package/dist/agentic/guides/modules/sales/exact-override-targets.md +1 -0
  140. package/dist/agentic/guides/modules/sales/index.md +3 -3
  141. package/dist/agentic/guides/modules/sales/umes-contributions.md +1 -0
  142. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  143. package/dist/agentic/guides/modules/search/index.md +1 -1
  144. package/dist/agentic/guides/modules/security/index.md +1 -1
  145. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  146. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  147. package/dist/agentic/guides/modules/sso/index.md +1 -1
  148. package/dist/agentic/guides/modules/staff/contribution-resolutions.md +1 -1
  149. package/dist/agentic/guides/modules/staff/exact-override-targets.md +1 -1
  150. package/dist/agentic/guides/modules/staff/index.md +1 -1
  151. package/dist/agentic/guides/modules/staff/workers.md +1 -1
  152. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  153. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  154. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  155. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  156. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  157. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  158. package/dist/agentic/guides/modules/translations/index.md +1 -1
  159. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  160. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  161. package/dist/agentic/guides/modules/wms/index.md +1 -1
  162. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  163. package/dist/agentic/guides/reference-module-facts.json +811 -21
  164. package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +1 -0
  165. package/dist/agentic/guides/reference-modules/example/backend-pages.md +2 -0
  166. package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +3 -1
  167. package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -3
  168. package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
  169. package/dist/agentic/guides/reference-modules/example/entities.md +2 -0
  170. package/dist/agentic/guides/reference-modules/example/events.md +2 -1
  171. package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +25 -8
  172. package/dist/agentic/guides/reference-modules/example/index.md +7 -7
  173. package/dist/agentic/guides/reference-modules/example/notifications.md +1 -0
  174. package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
  175. package/dist/agentic/guides/reference-modules/example/umes-contributions.md +3 -1
  176. package/dist/agentic/guides/reference-modules/example/umes-hosts.md +4 -0
  177. package/dist/agentic/guides/upstream/AGENTS.md +5 -4
  178. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +37 -20
  179. package/dist/agentic/guides/upstream/manifest.json +3 -3
  180. package/dist/agentic/shared/AGENTS.md.template +12 -16
  181. package/dist/agentic/shared/ai/harness/README.md +4 -2
  182. package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
  183. package/dist/agentic/shared/ai/harness/cases.json +1420 -41
  184. package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
  185. package/dist/agentic/shared/ai/harness/design-system-inventory.json +640 -142
  186. package/dist/agentic/shared/ai/harness/source-link-inventory.json +223 -16
  187. package/dist/agentic/shared/ai/harness/validators.json +1 -1
  188. package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +1 -1
  189. package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +25 -0
  190. package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +1 -0
  191. package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +2 -0
  192. package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +21 -1
  193. package/dist/lib/cache-provider-manifest.js +9 -0
  194. package/dist/lib/cache-provider-manifest.js.map +7 -0
  195. package/dist/lib/generate-watch-plan.js +4 -0
  196. package/dist/lib/generate-watch-plan.js.map +2 -2
  197. package/dist/lib/generate-watch-runner.js +1 -0
  198. package/dist/lib/generate-watch-runner.js.map +2 -2
  199. package/dist/lib/generate-watch-structure.js +2 -0
  200. package/dist/lib/generate-watch-structure.js.map +2 -2
  201. package/dist/lib/generators/ast/writers.js +5 -1
  202. package/dist/lib/generators/ast/writers.js.map +2 -2
  203. package/dist/lib/generators/cache-providers.js +80 -0
  204. package/dist/lib/generators/cache-providers.js.map +7 -0
  205. package/dist/lib/generators/form-section-ast.js +156 -0
  206. package/dist/lib/generators/form-section-ast.js.map +7 -0
  207. package/dist/lib/generators/form-section-extension-compiler.js +568 -0
  208. package/dist/lib/generators/form-section-extension-compiler.js.map +7 -0
  209. package/dist/lib/generators/form-section-extension-source.js +245 -0
  210. package/dist/lib/generators/form-section-extension-source.js.map +7 -0
  211. package/dist/lib/generators/form-section-runtime-revisions.js +184 -0
  212. package/dist/lib/generators/form-section-runtime-revisions.js.map +7 -0
  213. package/dist/lib/generators/form-sections.js +773 -0
  214. package/dist/lib/generators/form-sections.js.map +7 -0
  215. package/dist/lib/generators/index.js +2 -0
  216. package/dist/lib/generators/index.js.map +2 -2
  217. package/dist/lib/generators/module-entities.js +21 -2
  218. package/dist/lib/generators/module-entities.js.map +2 -2
  219. package/dist/lib/generators/module-extension-facts.js +2 -1
  220. package/dist/lib/generators/module-extension-facts.js.map +2 -2
  221. package/dist/lib/generators/module-facts.js +30 -1
  222. package/dist/lib/generators/module-facts.js.map +2 -2
  223. package/dist/lib/generators/module-override-targets.js +24 -2
  224. package/dist/lib/generators/module-override-targets.js.map +2 -2
  225. package/dist/lib/generators/module-registry.js +75 -3
  226. package/dist/lib/generators/module-registry.js.map +2 -2
  227. package/dist/lib/generators/openapi.js +27 -17
  228. package/dist/lib/generators/openapi.js.map +2 -2
  229. package/dist/lib/post-generate-invalidation.js +20 -1
  230. package/dist/lib/post-generate-invalidation.js.map +2 -2
  231. package/dist/lib/resolver.js +195 -1
  232. package/dist/lib/resolver.js.map +3 -3
  233. package/dist/lib/scaffold/field-dsl.js +393 -0
  234. package/dist/lib/scaffold/field-dsl.js.map +7 -0
  235. package/dist/lib/scaffold/index.js +412 -0
  236. package/dist/lib/scaffold/index.js.map +7 -0
  237. package/dist/lib/scaffold/targets.js +42 -0
  238. package/dist/lib/scaffold/targets.js.map +7 -0
  239. package/dist/lib/scaffold/templates/create-page.js +52 -0
  240. package/dist/lib/scaffold/templates/create-page.js.map +7 -0
  241. package/dist/lib/scaffold/templates/detail-page.js +186 -0
  242. package/dist/lib/scaffold/templates/detail-page.js.map +7 -0
  243. package/dist/lib/scaffold/templates/form-config.js +42 -0
  244. package/dist/lib/scaffold/templates/form-config.js.map +7 -0
  245. package/dist/lib/scaffold/templates/index.js +27 -0
  246. package/dist/lib/scaffold/templates/index.js.map +7 -0
  247. package/dist/lib/scaffold/templates/list-page.js +190 -0
  248. package/dist/lib/scaffold/templates/list-page.js.map +7 -0
  249. package/dist/lib/scaffold/templates/metas.js +47 -0
  250. package/dist/lib/scaffold/templates/metas.js.map +7 -0
  251. package/dist/lib/scaffold/templates/module-files.js +85 -0
  252. package/dist/lib/scaffold/templates/module-files.js.map +7 -0
  253. package/dist/lib/single-instance-strategy-guard.js +26 -3
  254. package/dist/lib/single-instance-strategy-guard.js.map +2 -2
  255. package/dist/lib/testing/integration-discovery.js +32 -3
  256. package/dist/lib/testing/integration-discovery.js.map +2 -2
  257. package/dist/lib/testing/integration.js +232 -8
  258. package/dist/lib/testing/integration.js.map +2 -2
  259. package/dist/mercato.js +40 -7
  260. package/dist/mercato.js.map +2 -2
  261. package/jest.config.cjs +2 -0
  262. package/package.json +7 -7
  263. package/src/__tests__/mercato.test.ts +18 -0
  264. package/src/__tests__/rotation-json-output.test.ts +52 -0
  265. package/src/lib/__tests__/agentic-workflows-ownership.test.ts +79 -0
  266. package/src/lib/__tests__/cache-provider-manifest.test.ts +76 -0
  267. package/src/lib/__tests__/generate-watch-plan.test.ts +3 -2
  268. package/src/lib/__tests__/generate-watch-runner.test.ts +13 -1
  269. package/src/lib/__tests__/generate-watch-structure.test.ts +34 -0
  270. package/src/lib/__tests__/post-generate-invalidation.test.ts +108 -0
  271. package/src/lib/__tests__/resolver.form-section-gates.test.ts +82 -0
  272. package/src/lib/__tests__/single-instance-strategy-guard.test.ts +129 -0
  273. package/src/lib/cache-provider-manifest.ts +8 -0
  274. package/src/lib/generate-watch-plan.ts +6 -3
  275. package/src/lib/generate-watch-runner.ts +1 -0
  276. package/src/lib/generate-watch-structure.ts +5 -1
  277. package/src/lib/generators/__tests__/cache-providers.test.ts +102 -0
  278. package/src/lib/generators/__tests__/derived-crud-route-collisions.test.ts +85 -0
  279. package/src/lib/generators/__tests__/form-section-outbox.test.ts +53 -0
  280. package/src/lib/generators/__tests__/form-sections.test.ts +896 -0
  281. package/src/lib/generators/__tests__/module-extension-facts.test.ts +1 -0
  282. package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +8 -6
  283. package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +37 -13
  284. package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +13 -0
  285. package/src/lib/generators/__tests__/module-override-targets.test.ts +2 -3
  286. package/src/lib/generators/__tests__/module-subset.test.ts +1 -1
  287. package/src/lib/generators/__tests__/openapi.test.ts +60 -13
  288. package/src/lib/generators/__tests__/structural-contracts.test.ts +2 -2
  289. package/src/lib/generators/ast/writers.ts +6 -1
  290. package/src/lib/generators/cache-providers.ts +111 -0
  291. package/src/lib/generators/form-section-ast.ts +166 -0
  292. package/src/lib/generators/form-section-extension-compiler.ts +632 -0
  293. package/src/lib/generators/form-section-extension-source.ts +308 -0
  294. package/src/lib/generators/form-section-runtime-revisions.ts +211 -0
  295. package/src/lib/generators/form-sections.ts +896 -0
  296. package/src/lib/generators/index.ts +1 -0
  297. package/src/lib/generators/module-entities.ts +22 -4
  298. package/src/lib/generators/module-extension-facts.ts +1 -0
  299. package/src/lib/generators/module-facts.ts +40 -0
  300. package/src/lib/generators/module-override-targets.ts +19 -0
  301. package/src/lib/generators/module-registry.ts +80 -4
  302. package/src/lib/generators/openapi.ts +31 -20
  303. package/src/lib/post-generate-invalidation.ts +28 -1
  304. package/src/lib/resolver.ts +218 -0
  305. package/src/lib/scaffold/__tests__/__snapshots__/scaffold-golden.test.ts.snap +1742 -0
  306. package/src/lib/scaffold/__tests__/helpers.ts +75 -0
  307. package/src/lib/scaffold/__tests__/scaffold-ds-contract.test.ts +248 -0
  308. package/src/lib/scaffold/__tests__/scaffold-golden.test.ts +267 -0
  309. package/src/lib/scaffold/__tests__/scaffold-runtime.test.tsx +193 -0
  310. package/src/lib/scaffold/field-dsl.ts +491 -0
  311. package/src/lib/scaffold/index.ts +531 -0
  312. package/src/lib/scaffold/targets.ts +68 -0
  313. package/src/lib/scaffold/templates/create-page.ts +52 -0
  314. package/src/lib/scaffold/templates/detail-page.ts +190 -0
  315. package/src/lib/scaffold/templates/form-config.ts +42 -0
  316. package/src/lib/scaffold/templates/index.ts +27 -0
  317. package/src/lib/scaffold/templates/list-page.ts +190 -0
  318. package/src/lib/scaffold/templates/metas.ts +48 -0
  319. package/src/lib/scaffold/templates/module-files.ts +87 -0
  320. package/src/lib/single-instance-strategy-guard.ts +51 -1
  321. package/src/lib/testing/__tests__/integration-app-only-playwright.test.ts +225 -0
  322. package/src/lib/testing/__tests__/integration-app-only.test.ts +320 -0
  323. package/src/lib/testing/__tests__/integration-discovery.test.ts +45 -1
  324. package/src/lib/testing/integration-discovery.ts +32 -2
  325. package/src/lib/testing/integration.ts +293 -11
  326. package/src/mercato.ts +39 -5
  327. package/dist/agentic/guides/modules/dashboards/incoming-installed-contributions.md +0 -11
@@ -2,7 +2,8 @@ import type { ChildProcess, StdioOptions } from 'node:child_process'
2
2
  import { spawnSync } from 'node:child_process'
3
3
  import { createServer } from 'node:net'
4
4
  import { existsSync, readFileSync } from 'node:fs'
5
- import { mkdir, readdir, readFile, rm, stat, writeFile } from 'node:fs/promises'
5
+ import { mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from 'node:fs/promises'
6
+ import os from 'node:os'
6
7
  import { createHash, randomBytes } from 'node:crypto'
7
8
  import path from 'node:path'
8
9
  import { createInterface, type Interface } from 'node:readline/promises'
@@ -13,7 +14,13 @@ import { isUnsafeJwtSecret } from '@open-mercato/shared/lib/auth/jwt'
13
14
  import { resolveEnvironment } from '../resolver'
14
15
  import { resolveInitSuperadminCredentials } from '../init-secrets'
15
16
  import { resolveSpawnCommand } from '../spawn'
16
- import { discoverIntegrationSpecFiles as discoverIntegrationSpecFilesShared } from './integration-discovery'
17
+ import {
18
+ APP_ONLY_INTEGRATION_ENV_VAR,
19
+ SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR,
20
+ DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR,
21
+ discoverIntegrationSpecFiles as discoverIntegrationSpecFilesShared,
22
+ isAppOwnedIntegrationSpecPath,
23
+ } from './integration-discovery'
17
24
  import { resolveDockerHostFromContext, runCommandAndCapture } from './runtime-utils'
18
25
 
19
26
  type EphemeralRuntimeOptions = {
@@ -47,7 +54,37 @@ type IntegrationOptions = {
47
54
  verbose: boolean
48
55
  forceRebuild: boolean
49
56
  reuseExisting: boolean
50
- }
57
+ appOnly: boolean
58
+ help: boolean
59
+ }
60
+
61
+ type IntegrationSuiteOptions = IntegrationOptions & {
62
+ appOnlySpecPaths: string[] | null
63
+ }
64
+
65
+ export const NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE = 'No app-owned integration specs found'
66
+ export const UNREPORTED_APP_OWNED_INTEGRATION_SPECS_MESSAGE =
67
+ 'the Playwright config does not report its spec files through discoverIntegrationSpecFiles, so app-owned specs are resolved after the environment starts'
68
+ export const NO_RUNNABLE_APP_OWNED_INTEGRATION_SPECS_MESSAGE =
69
+ 'No app-owned integration specs are runnable in the ephemeral environment: every one is skipped by its requiredModules/requiredEnvVars metadata'
70
+
71
+ export const INTEGRATION_TEST_USAGE = [
72
+ 'Usage: mercato test:integration [filter] [options]',
73
+ '',
74
+ 'Boots an ephemeral environment (Postgres, built app) and runs the Playwright integration suite.',
75
+ '',
76
+ 'Options:',
77
+ ' --filter <pattern> Run only specs matching the pattern (also accepted as a bare first argument)',
78
+ ' --app-only Run only app-owned specs (outside node_modules/). Exits 0 without starting',
79
+ ' anything when the app has none',
80
+ ' --keep Leave the app and database running after the suite finishes',
81
+ ' --screenshots Capture screenshots for every test (default outside CI)',
82
+ ' --no-screenshots Capture screenshots only on failure (default in CI)',
83
+ ' --verbose Stream build and server output',
84
+ ' --force-rebuild Rebuild the app even when cached build artifacts are fresh',
85
+ ' --no-reuse-env Always boot a fresh ephemeral environment',
86
+ ' -h, --help Show this help',
87
+ ].join('\n')
51
88
 
52
89
  type EphemeralAppOptions = {
53
90
  verbose: boolean
@@ -2454,6 +2491,8 @@ export function parseOptions(rawArgs: string[]): IntegrationOptions {
2454
2491
  let verbose = false
2455
2492
  let forceRebuild = false
2456
2493
  let reuseExisting = true
2494
+ let appOnly = false
2495
+ let help = false
2457
2496
 
2458
2497
  for (let index = 0; index < rawArgs.length; index += 1) {
2459
2498
  const argument = rawArgs[index]
@@ -2461,6 +2500,14 @@ export function parseOptions(rawArgs: string[]): IntegrationOptions {
2461
2500
  keep = true
2462
2501
  continue
2463
2502
  }
2503
+ if (argument === '--app-only') {
2504
+ appOnly = true
2505
+ continue
2506
+ }
2507
+ if (argument === '--help' || argument === '-h') {
2508
+ help = true
2509
+ continue
2510
+ }
2464
2511
  if (argument === '--screenshots') {
2465
2512
  captureScreenshots = true
2466
2513
  continue
@@ -2515,9 +2562,42 @@ export function parseOptions(rawArgs: string[]): IntegrationOptions {
2515
2562
  verbose,
2516
2563
  forceRebuild,
2517
2564
  reuseExisting,
2565
+ appOnly,
2566
+ help,
2518
2567
  }
2519
2568
  }
2520
2569
 
2570
+ function matchesPlaywrightFileFilter(relativePath: string, filter: string): boolean {
2571
+ let pattern: RegExp
2572
+ try {
2573
+ pattern = new RegExp(filter, 'i')
2574
+ } catch {
2575
+ return relativePath.toLowerCase().includes(filter.toLowerCase())
2576
+ }
2577
+ return pattern.test(relativePath)
2578
+ }
2579
+
2580
+ export function resolveAppOwnedIntegrationSpecPaths(
2581
+ discoveredSpecs: ReadonlyArray<{ path: string }>,
2582
+ filter: string | null,
2583
+ ): string[] {
2584
+ const appOwned = discoveredSpecs
2585
+ .map((entry) => entry.path)
2586
+ .filter((specPath) => isAppOwnedIntegrationSpecPath(specPath))
2587
+ if (!filter) {
2588
+ return appOwned
2589
+ }
2590
+ const matching = appOwned.filter((specPath) => matchesPlaywrightFileFilter(specPath, filter))
2591
+ if (appOwned.length > 0 && matching.length === 0) {
2592
+ throw new Error(`No app-owned integration specs match filter "${filter}"`)
2593
+ }
2594
+ return matching
2595
+ }
2596
+
2597
+ export function buildAppOnlyPlaywrightFileFilters(specPaths: readonly string[]): string[] {
2598
+ return specPaths.map((specPath) => `/${specPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`)
2599
+ }
2600
+
2521
2601
  export function parseEphemeralAppOptions(rawArgs: string[]): EphemeralAppOptions {
2522
2602
  let verbose = false
2523
2603
  let captureScreenshots: boolean | null = null
@@ -2815,6 +2895,166 @@ async function discoverIntegrationSpecFiles(): Promise<DiscoveredIntegrationSpec
2815
2895
  return discoverIntegrationSpecFilesShared(projectRootDirectory, LEGACY_INTEGRATION_TEST_ROOT)
2816
2896
  }
2817
2897
 
2898
+ export type PlaywrightSpecLister = (environment: NodeJS.ProcessEnv, fileFilters: readonly string[]) => Promise<string[]>
2899
+
2900
+ export type PlaywrightConfigSelectionLister = (environment: NodeJS.ProcessEnv) => Promise<string[] | null>
2901
+
2902
+ function isRecord(value: unknown): value is Record<string, unknown> {
2903
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
2904
+ }
2905
+
2906
+ export function parsePlaywrightListedSpecPaths(report: unknown, projectRoot: string): string[] {
2907
+ if (!isRecord(report) || !Array.isArray(report.suites)) {
2908
+ throw new Error('[internal] Playwright --list report has no suites')
2909
+ }
2910
+ const rootDir = isRecord(report.config) && typeof report.config.rootDir === 'string'
2911
+ ? report.config.rootDir
2912
+ : projectRoot
2913
+ const listed = new Set<string>()
2914
+ for (const suite of report.suites) {
2915
+ if (!isRecord(suite) || typeof suite.file !== 'string' || suite.file.length === 0) continue
2916
+ listed.add(normalizePath(path.relative(projectRoot, path.resolve(rootDir, suite.file))))
2917
+ }
2918
+ return Array.from(listed).sort((left, right) => left.localeCompare(right))
2919
+ }
2920
+
2921
+ function runQuietNpxCommand(args: string[], environment: NodeJS.ProcessEnv, cwd: string): Promise<void> {
2922
+ const binary = process.platform === 'win32' ? 'npx.cmd' : 'npx'
2923
+ return new Promise((resolve, reject) => {
2924
+ const resolvedSpawn = resolveSpawnCommand(binary, args)
2925
+ const command = spawn(resolvedSpawn.command, resolvedSpawn.args, {
2926
+ cwd,
2927
+ env: environment,
2928
+ stdio: ['ignore', 'ignore', 'pipe'],
2929
+ ...resolvedSpawn.spawnOptions,
2930
+ })
2931
+ let stderr = ''
2932
+ command.stderr?.on('data', (chunk: Buffer | string) => {
2933
+ stderr += chunk.toString()
2934
+ })
2935
+ command.on('error', reject)
2936
+ command.on('exit', (code) => {
2937
+ if (code === 0) {
2938
+ resolve()
2939
+ return
2940
+ }
2941
+ reject(new Error(`Command failed: npx ${args.join(' ')} (exit ${code ?? 'unknown'})\n${stderr.trim()}`))
2942
+ })
2943
+ })
2944
+ }
2945
+
2946
+ export function parseDiscoverySelectionReport(report: unknown, projectRoot: string): string[] {
2947
+ if (!isRecord(report) || !Array.isArray(report.paths)) {
2948
+ throw new Error('[internal] Integration discovery selection report has no paths')
2949
+ }
2950
+ const reportRoot = typeof report.projectRoot === 'string' ? report.projectRoot : projectRoot
2951
+ const selected = new Set<string>()
2952
+ for (const entry of report.paths) {
2953
+ if (typeof entry !== 'string' || entry.length === 0) continue
2954
+ selected.add(normalizePath(path.relative(projectRoot, path.resolve(reportRoot, entry))))
2955
+ }
2956
+ return Array.from(selected).sort((left, right) => left.localeCompare(right))
2957
+ }
2958
+
2959
+ export type PlaywrightListTarget = {
2960
+ projectRoot: string
2961
+ configPath: string
2962
+ }
2963
+
2964
+ const DEFAULT_PLAYWRIGHT_LIST_TARGET: PlaywrightListTarget = {
2965
+ projectRoot: projectRootDirectory,
2966
+ configPath: PLAYWRIGHT_INTEGRATION_CONFIG_PATH,
2967
+ }
2968
+
2969
+ const PLAYWRIGHT_NO_SPEC_FILE_FILTER = '/__om_app_only_preflight_no_spec__$'
2970
+
2971
+ async function runPlaywrightList<T>(
2972
+ environment: NodeJS.ProcessEnv,
2973
+ fileFilters: readonly string[],
2974
+ target: PlaywrightListTarget,
2975
+ readResult: (files: { listFile: string; selectionFile: string }) => Promise<T>,
2976
+ ): Promise<T> {
2977
+ const outputDirectory = await mkdtemp(path.join(os.tmpdir(), 'om-integration-list-'))
2978
+ const files = {
2979
+ listFile: path.join(outputDirectory, 'list.json'),
2980
+ selectionFile: path.join(outputDirectory, 'selection.json'),
2981
+ }
2982
+ try {
2983
+ await runQuietNpxCommand(
2984
+ ['playwright', 'test', '--config', target.configPath, '--list', '--reporter=json', '--pass-with-no-tests', ...fileFilters],
2985
+ {
2986
+ ...environment,
2987
+ PLAYWRIGHT_JSON_OUTPUT_FILE: files.listFile,
2988
+ [DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR]: files.selectionFile,
2989
+ },
2990
+ target.projectRoot,
2991
+ )
2992
+ return await readResult(files)
2993
+ } finally {
2994
+ await rm(outputDirectory, { recursive: true, force: true }).catch(() => undefined)
2995
+ }
2996
+ }
2997
+
2998
+ export function listPlaywrightSelectedSpecPaths(
2999
+ environment: NodeJS.ProcessEnv,
3000
+ fileFilters: readonly string[] = [],
3001
+ target: PlaywrightListTarget = DEFAULT_PLAYWRIGHT_LIST_TARGET,
3002
+ ): Promise<string[]> {
3003
+ return runPlaywrightList(environment, fileFilters, target, async ({ listFile }) =>
3004
+ parsePlaywrightListedSpecPaths(JSON.parse(await readFile(listFile, 'utf8')), target.projectRoot),
3005
+ )
3006
+ }
3007
+
3008
+ export function listPlaywrightConfigSelectedSpecPaths(
3009
+ environment: NodeJS.ProcessEnv,
3010
+ target: PlaywrightListTarget = DEFAULT_PLAYWRIGHT_LIST_TARGET,
3011
+ ): Promise<string[] | null> {
3012
+ return runPlaywrightList(environment, [PLAYWRIGHT_NO_SPEC_FILE_FILTER], target, async ({ selectionFile }) =>
3013
+ existsSync(selectionFile)
3014
+ ? parseDiscoverySelectionReport(JSON.parse(await readFile(selectionFile, 'utf8')), target.projectRoot)
3015
+ : null,
3016
+ )
3017
+ }
3018
+
3019
+ function buildAppOnlyEnvironment(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
3020
+ return { ...environment, [APP_ONLY_INTEGRATION_ENV_VAR]: '1' }
3021
+ }
3022
+
3023
+ export async function listAppOwnedIntegrationSpecCandidates(
3024
+ listConfigSelection: PlaywrightConfigSelectionLister = listPlaywrightConfigSelectedSpecPaths,
3025
+ ): Promise<Array<{ path: string }> | null> {
3026
+ const environment = { ...buildAppOnlyEnvironment(process.env), [SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR]: '1' }
3027
+ const selected = await listConfigSelection(environment)
3028
+ return selected ? selected.map((specPath) => ({ path: specPath })) : null
3029
+ }
3030
+
3031
+ export type AppOnlySuiteRun = {
3032
+ fileFilters: string[]
3033
+ commandEnvironment: NodeJS.ProcessEnv
3034
+ }
3035
+
3036
+ export async function resolveAppOnlySuiteRun(
3037
+ appOnlySpecPaths: readonly string[] | null,
3038
+ environment: Pick<EphemeralEnvironmentHandle, 'commandEnvironment'>,
3039
+ listSpecs: PlaywrightSpecLister = listPlaywrightSelectedSpecPaths,
3040
+ filter: string | null = null,
3041
+ ): Promise<AppOnlySuiteRun | null> {
3042
+ const commandEnvironment = buildAppOnlyEnvironment(environment.commandEnvironment)
3043
+ const fileFilters = appOnlySpecPaths ? buildAppOnlyPlaywrightFileFilters(appOnlySpecPaths) : filter ? [filter] : []
3044
+ const listed = await listSpecs(commandEnvironment, fileFilters)
3045
+ const runnable = new Set(listed)
3046
+ const selected = appOnlySpecPaths
3047
+ ? appOnlySpecPaths.filter((specPath) => runnable.has(specPath))
3048
+ : resolveAppOwnedIntegrationSpecPaths(listed.map((specPath) => ({ path: specPath })), null)
3049
+ if (selected.length === 0) {
3050
+ if (!appOnlySpecPaths && filter) {
3051
+ throw new Error(`No app-owned integration specs match filter "${filter}"`)
3052
+ }
3053
+ return null
3054
+ }
3055
+ return { fileFilters: buildAppOnlyPlaywrightFileFilters(selected), commandEnvironment }
3056
+ }
3057
+
2818
3058
  async function extractSpecDescription(relativePath: string): Promise<string> {
2819
3059
  const absolutePath = path.join(projectRootDirectory, relativePath)
2820
3060
  try {
@@ -3365,13 +3605,27 @@ type IntegrationTestRunResult = {
3365
3605
 
3366
3606
  async function runIntegrationTestSuiteOnce(
3367
3607
  environment: EphemeralEnvironmentHandle,
3368
- options: IntegrationOptions,
3608
+ options: IntegrationSuiteOptions,
3369
3609
  ): Promise<void> {
3370
3610
  const testArgs = ['test:integration']
3371
- if (options.filter) {
3611
+ let commandEnvironment = environment.commandEnvironment
3612
+ if (options.appOnly) {
3613
+ const appOnlyRun = await resolveAppOnlySuiteRun(
3614
+ options.appOnlySpecPaths,
3615
+ environment,
3616
+ listPlaywrightSelectedSpecPaths,
3617
+ options.filter,
3618
+ )
3619
+ if (!appOnlyRun) {
3620
+ console.log(`[integration] ${NO_RUNNABLE_APP_OWNED_INTEGRATION_SPECS_MESSAGE}.`)
3621
+ return
3622
+ }
3623
+ testArgs.push(...appOnlyRun.fileFilters)
3624
+ commandEnvironment = appOnlyRun.commandEnvironment
3625
+ } else if (options.filter) {
3372
3626
  testArgs.push(options.filter)
3373
3627
  }
3374
- await runYarnCommandWithOutputMonitoring(testArgs, environment.commandEnvironment, {
3628
+ await runYarnCommandWithOutputMonitoring(testArgs, commandEnvironment, {
3375
3629
  detectEnvironmentUnavailable: true,
3376
3630
  abortOnEnvironmentUnavailable: true,
3377
3631
  playwrightFailureHealthCheck: {
@@ -3398,7 +3652,7 @@ function normalizeError(error: unknown): Error {
3398
3652
 
3399
3653
  async function runIntegrationTestAttempt(
3400
3654
  environment: EphemeralEnvironmentHandle,
3401
- integrationOptions: IntegrationOptions,
3655
+ integrationOptions: IntegrationSuiteOptions,
3402
3656
  prepareTestEnvironment: (environment: EphemeralEnvironmentHandle) => Promise<void>,
3403
3657
  ): Promise<Error | null> {
3404
3658
  try {
@@ -3426,7 +3680,7 @@ async function detectEnvironmentFailure(
3426
3680
 
3427
3681
  async function runIntegrationTestSuiteWithRecovery(
3428
3682
  startOptions: Pick<EphemeralRuntimeOptions, 'verbose' | 'captureScreenshots' | 'forceRebuild' | 'reuseExisting'>,
3429
- integrationOptions: IntegrationOptions,
3683
+ integrationOptions: IntegrationSuiteOptions,
3430
3684
  prepareTestEnvironment: (environment: EphemeralEnvironmentHandle) => Promise<void>,
3431
3685
  ): Promise<{
3432
3686
  environment: EphemeralEnvironmentHandle
@@ -3905,8 +4159,36 @@ async function keepEnvironmentRunningForever(): Promise<void> {
3905
4159
  await new Promise<void>(() => {})
3906
4160
  }
3907
4161
 
3908
- export async function runIntegrationTestsInEphemeralEnvironment(rawArgs: string[]): Promise<void> {
4162
+ export type IntegrationTestRunDependencies = {
4163
+ discoverSpecs?: () => Promise<ReadonlyArray<{ path: string }> | null>
4164
+ runSuiteWithRecovery?: typeof runIntegrationTestSuiteWithRecovery
4165
+ }
4166
+
4167
+ export async function runIntegrationTestsInEphemeralEnvironment(
4168
+ rawArgs: string[],
4169
+ dependencies: IntegrationTestRunDependencies = {},
4170
+ ): Promise<void> {
3909
4171
  const options = parseOptions(rawArgs)
4172
+ if (options.help) {
4173
+ console.log(INTEGRATION_TEST_USAGE)
4174
+ return
4175
+ }
4176
+ let appOnlySpecPaths: string[] | null = null
4177
+ if (options.appOnly) {
4178
+ const discoverSpecs = dependencies.discoverSpecs ?? (() => listAppOwnedIntegrationSpecCandidates())
4179
+ const candidates = await discoverSpecs()
4180
+ if (candidates) {
4181
+ appOnlySpecPaths = resolveAppOwnedIntegrationSpecPaths(candidates, options.filter)
4182
+ if (appOnlySpecPaths.length === 0) {
4183
+ console.log(NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE)
4184
+ return
4185
+ }
4186
+ console.log(`[integration] --app-only enabled: running ${appOnlySpecPaths.length} app-owned spec file(s).`)
4187
+ } else {
4188
+ console.log(`[integration] --app-only enabled: ${UNREPORTED_APP_OWNED_INTEGRATION_SPECS_MESSAGE}.`)
4189
+ }
4190
+ }
4191
+ const runSuiteWithRecovery = dependencies.runSuiteWithRecovery ?? runIntegrationTestSuiteWithRecovery
3910
4192
  const startOptions: Pick<EphemeralRuntimeOptions, 'verbose' | 'captureScreenshots' | 'forceRebuild' | 'reuseExisting'> = {
3911
4193
  verbose: options.verbose,
3912
4194
  captureScreenshots: options.captureScreenshots,
@@ -3923,9 +4205,9 @@ export async function runIntegrationTestsInEphemeralEnvironment(rawArgs: string[
3923
4205
  } else {
3924
4206
  console.log('[integration] --no-reuse-env enabled: always booting a fresh ephemeral environment.')
3925
4207
  }
3926
- const environmentState = await runIntegrationTestSuiteWithRecovery(
4208
+ const environmentState = await runSuiteWithRecovery(
3927
4209
  startOptions,
3928
- options,
4210
+ { ...options, appOnlySpecPaths },
3929
4211
  async (runtimeEnvironment) => {
3930
4212
  console.log('[integration] Ensuring Playwright Chromium is installed...')
3931
4213
  await runNpxCommand(['playwright', 'install', 'chromium'], runtimeEnvironment.commandEnvironment)
package/src/mercato.ts CHANGED
@@ -47,7 +47,11 @@ import { parseModuleInstallArgs } from './lib/module-install-args'
47
47
  import type { ModuleCommandResult } from './lib/module-install'
48
48
  import { resolveNextBuildIdCandidate } from './lib/next-build-id'
49
49
  import { acquireServerStartLock } from './lib/server-start-lock'
50
- import { assertSingleInstanceStrategies } from './lib/single-instance-strategy-guard'
50
+ import {
51
+ assertSingleInstanceStrategies,
52
+ readInfraStrategySnapshot,
53
+ resolveEffectiveCacheProviderSnapshot,
54
+ } from './lib/single-instance-strategy-guard'
51
55
  import { createDevEnvReloader, watchDevEnvFiles } from './lib/dev-env-reload'
52
56
  import { quotePostgresIdentifier } from './lib/db/identifiers'
53
57
  import { getRegisteredDevSupervisorManifest } from './lib/dev-supervisor-manifest'
@@ -893,6 +897,7 @@ async function createGenerateWatchRuntime(quiet = false) {
893
897
  { resolveStandaloneSourceMirrorBase },
894
898
  { getOpenApiWatchInputs },
895
899
  { getWebResearchAdapterWatchInputs },
900
+ { getCacheProviderManifestPaths },
896
901
  ] = await Promise.all([
897
902
  import('./lib/resolver'),
898
903
  import('./lib/generate-watch-structure'),
@@ -901,6 +906,7 @@ async function createGenerateWatchRuntime(quiet = false) {
901
906
  import('./lib/generators/scanner'),
902
907
  import('./lib/generators/openapi'),
903
908
  import('./lib/generators/web-research-adapters'),
909
+ import('./lib/generators/cache-providers'),
904
910
  ])
905
911
 
906
912
  let latestSnapshot: GenerateWatchSnapshot | undefined
@@ -945,6 +951,7 @@ async function createGenerateWatchRuntime(quiet = false) {
945
951
  openapiInputs,
946
952
  webResearchAdapterInputs: adapterInputs.manifestPaths,
947
953
  webResearchAdapterFullReasons: adapterInputs.fullReasons,
954
+ cacheProviderInputs: getCacheProviderManifestPaths(resolver.getAppDir()),
948
955
  shallowDirectories: adapterInputs.directoryPaths,
949
956
  appSourceDir: path.join(resolver.getAppDir(), 'src'),
950
957
  outputDir: resolver.getOutputDir(),
@@ -1262,7 +1269,7 @@ export async function run(argv = process.argv) {
1262
1269
  // Step 1: Run generators directly (no process spawn)
1263
1270
  console.log('๐Ÿ”ง Preparing modules (registry, entities, DI)...')
1264
1271
  const { createResolver } = await import('./lib/resolver')
1265
- const { generateEntityIds, generateModuleRegistries, generateModuleEntities, generateModuleDi, generateModulePackageSources, generateOpenApi, generateWebResearchAdapters } = await import('./lib/generators')
1272
+ const { generateEntityIds, generateModuleRegistries, generateModuleEntities, generateModuleDi, generateModulePackageSources, generateOpenApi, generateWebResearchAdapters, generateCacheProviders } = await import('./lib/generators')
1266
1273
  const resolver = createResolver()
1267
1274
  await generateEntityIds({ resolver, quiet: true })
1268
1275
  await generateModuleRegistries({ resolver, quiet: true })
@@ -1270,6 +1277,7 @@ export async function run(argv = process.argv) {
1270
1277
  await generateModuleDi({ resolver, quiet: true })
1271
1278
  await generateModulePackageSources({ resolver, quiet: true })
1272
1279
  await generateWebResearchAdapters({ resolver, quiet: true })
1280
+ await generateCacheProviders({ resolver, quiet: true })
1273
1281
  await generateOpenApi({ resolver, quiet: true })
1274
1282
  console.log('โœ… Modules prepared\n')
1275
1283
 
@@ -1563,12 +1571,13 @@ export async function run(argv = process.argv) {
1563
1571
  const commandArgs = remaining.filter(Boolean)
1564
1572
 
1565
1573
  if (!subcommand || subcommand === 'help' || subcommand === '--help' || subcommand === '-h') {
1566
- console.log('Usage: yarn mercato module <add|enable|eject|search|info> ...')
1574
+ console.log('Usage: yarn mercato module <add|enable|eject|search|info|scaffold> ...')
1567
1575
  console.log(' yarn mercato module add <packageSpec> [--module <moduleId>] [--eject] [--allow-third-party]')
1568
1576
  console.log(' yarn mercato module enable <packageName> [--module <moduleId>] [--eject] [--allow-third-party]')
1569
1577
  console.log(' yarn mercato module eject <moduleId>')
1570
1578
  console.log(' yarn mercato module search [<query>] [--category <id>] [--kind <kind>] [--all-lines] [--limit <n>] [--json]')
1571
1579
  console.log(' yarn mercato module info <package-or-module-id> [--json]')
1580
+ console.log(' yarn mercato module scaffold <moduleId> --entity <entity> --fields "<fields>" [--with-ui] [--target app|packages/core] [--features-prefix <prefix>] [--dry-run]')
1572
1581
  return 0
1573
1582
  }
1574
1583
 
@@ -1613,6 +1622,11 @@ export async function run(argv = process.argv) {
1613
1622
  return handleDirectEjectCommand(commandArgs)
1614
1623
  }
1615
1624
 
1625
+ if (subcommand === 'scaffold') {
1626
+ const { runModuleScaffold } = await import('./lib/scaffold')
1627
+ return await runModuleScaffold(commandArgs)
1628
+ }
1629
+
1616
1630
  console.error(`Unknown module subcommand "${subcommand}".`)
1617
1631
  return 1
1618
1632
  } catch (error: unknown) {
@@ -2646,7 +2660,10 @@ export async function run(argv = process.argv) {
2646
2660
  applyEventsSingleDeliveryGuard({ processEnv: process.env, runtimeEnv, autoSpawnWorkersMode })
2647
2661
  // Throws on single-instance strategies under a multi-instance topology,
2648
2662
  // aborting before the start lock is acquired or any process is spawned.
2649
- assertSingleInstanceStrategies(runtimeEnv)
2663
+ const cacheProvider = await resolveEffectiveCacheProviderSnapshot(appDir, runtimeEnv)
2664
+ assertSingleInstanceStrategies(runtimeEnv, {
2665
+ snapshot: readInfraStrategySnapshot(runtimeEnv, { cacheProvider }),
2666
+ })
2650
2667
  const schedulerCommand = lookupModuleCommand(getCliModules(), 'scheduler', 'start')
2651
2668
  const serverStartLock = acquireServerStartLock(appDir, {
2652
2669
  port: runtimeEnv.PORT ?? process.env.PORT ?? null,
@@ -2919,7 +2936,24 @@ export async function run(argv = process.argv) {
2919
2936
  }
2920
2937
  return commandExitCode
2921
2938
  } catch (e: any) {
2922
- console.error(`๐Ÿ’ฅ Failed: ${formatCliFailureMessage(modName, cmdName, e)}`)
2939
+ const message = formatCliFailureMessage(modName, cmdName, e)
2940
+ if (modName === 'entities' && cmdName === 'rotate-encryption-key' && process.env.OM_ROTATION_PROGRESS === 'json') {
2941
+ process.stderr.write(JSON.stringify({
2942
+ schemaVersion: 1,
2943
+ type: 'phase.changed',
2944
+ runId: 'rotation',
2945
+ phase: 'rotation.failed',
2946
+ entity: message,
2947
+ rowsDone: '0',
2948
+ rowsTotal: '0',
2949
+ rowsTotalExact: false,
2950
+ bytesDone: '0',
2951
+ chunksDone: 0,
2952
+ at: new Date().toISOString(),
2953
+ }) + '\n')
2954
+ } else {
2955
+ console.error(`๐Ÿ’ฅ Failed: ${message}`)
2956
+ }
2923
2957
  return 1
2924
2958
  }
2925
2959
  }
@@ -1,11 +0,0 @@
1
- # dashboards โ€” Incoming installed contributions
2
-
3
- [Back to module index](index.md)
4
-
5
- ## Incoming installed contributions
6
-
7
- | Contributor | Kind | Target | Resolution | Activation | Contribution ยท Source |
8
- |---|---|---|---|---|---|
9
- | staff | api-interceptor | api-route:dashboards/widgets/data @dashboards | bound | api-route:dashboards/widgets/data:POST:api-interceptor-bridge | staff.timesheets.self-scope-widget-data ยท [node_modules/@open-mercato/core/src/modules/staff/api/interceptors.ts](../../../../node_modules/@open-mercato/core/src/modules/staff/api/interceptors.ts) |
10
-
11
- <!-- end module facts section: dashboards/incoming-installed-contributions -->