@open-mercato/cli 0.9.1-develop.7476.1.342138d35e → 0.9.1-develop.7496.1.3346415f94

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 (94) hide show
  1. package/dist/agentic/guides/module-facts.json +172 -172
  2. package/dist/agentic/guides/module-facts.v2.json +172 -172
  3. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  4. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  5. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  6. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  7. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  8. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  9. package/dist/agentic/guides/modules/auth/index.md +1 -1
  10. package/dist/agentic/guides/modules/availability/index.md +1 -1
  11. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  12. package/dist/agentic/guides/modules/catalog/index.md +1 -1
  13. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  14. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  15. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  16. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  17. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  18. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  19. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  20. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  21. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  22. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  23. package/dist/agentic/guides/modules/configs/index.md +1 -1
  24. package/dist/agentic/guides/modules/content/index.md +1 -1
  25. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  26. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  27. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  28. package/dist/agentic/guides/modules/customers/active-extension-bindings.md +4 -4
  29. package/dist/agentic/guides/modules/customers/index.md +1 -1
  30. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  31. package/dist/agentic/guides/modules/data_sync/di-registrations-rich.md +8 -8
  32. package/dist/agentic/guides/modules/data_sync/di-service-tokens.md +4 -4
  33. package/dist/agentic/guides/modules/data_sync/exact-override-targets.md +8 -8
  34. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  35. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  36. package/dist/agentic/guides/modules/devices/index.md +1 -1
  37. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  38. package/dist/agentic/guides/modules/directory/index.md +1 -1
  39. package/dist/agentic/guides/modules/documents/index.md +1 -1
  40. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  41. package/dist/agentic/guides/modules/entities/index.md +1 -1
  42. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  43. package/dist/agentic/guides/modules/events/index.md +1 -1
  44. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  45. package/dist/agentic/guides/modules/forms/index.md +1 -1
  46. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  47. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  48. package/dist/agentic/guides/modules/generators/index.md +1 -1
  49. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  50. package/dist/agentic/guides/modules/integrations/index.md +1 -1
  51. package/dist/agentic/guides/modules/messages/index.md +1 -1
  52. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  53. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  54. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  55. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  56. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  57. package/dist/agentic/guides/modules/planner/index.md +1 -1
  58. package/dist/agentic/guides/modules/portal/index.md +1 -1
  59. package/dist/agentic/guides/modules/progress/index.md +1 -1
  60. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  61. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  62. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  63. package/dist/agentic/guides/modules/resources/index.md +1 -1
  64. package/dist/agentic/guides/modules/sales/index.md +1 -1
  65. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  66. package/dist/agentic/guides/modules/search/index.md +1 -1
  67. package/dist/agentic/guides/modules/security/index.md +1 -1
  68. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  69. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  70. package/dist/agentic/guides/modules/sso/index.md +1 -1
  71. package/dist/agentic/guides/modules/staff/index.md +1 -1
  72. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  73. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  74. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  75. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  76. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  77. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  78. package/dist/agentic/guides/modules/translations/index.md +1 -1
  79. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  80. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  81. package/dist/agentic/guides/modules/wms/index.md +1 -1
  82. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  83. package/dist/agentic/guides/reference-module-facts.json +1 -1
  84. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +4 -0
  85. package/dist/agentic/guides/upstream/manifest.json +2 -2
  86. package/dist/bin.js +2 -0
  87. package/dist/bin.js.map +2 -2
  88. package/dist/mercato.js +71 -5
  89. package/dist/mercato.js.map +2 -2
  90. package/package.json +7 -7
  91. package/src/__tests__/mercato.test.ts +260 -0
  92. package/src/bin.ts +5 -0
  93. package/src/lib/__tests__/bin-next-subpath-hook.test.ts +25 -0
  94. package/src/mercato.ts +87 -6
@@ -1,5 +1,5 @@
1
1
  # resources — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/resources
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # sales — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/sales
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # scheduler — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/scheduler 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/scheduler 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/scheduler/src/modules/scheduler
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # search — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/search 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/search 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/search/src/modules/search
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # security — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/enterprise 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/enterprise 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/enterprise/src/modules/security
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # seeds — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/seeds
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # shipping_carriers — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/shipping_carriers
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # sso — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/enterprise 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/enterprise 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/enterprise/src/modules/sso
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # staff — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/staff
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # storage_s3 — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/storage-s3 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/storage-s3 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/storage-s3/src/modules/storage_s3
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # sync_akeneo — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/sync-akeneo 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/sync-akeneo 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/sync-akeneo/src/modules/sync_akeneo
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # sync_excel — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/sync_excel
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # system_status_overlays — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/enterprise 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/enterprise 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/enterprise/src/modules/system_status_overlays
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # telemetry — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/telemetry 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/telemetry 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/telemetry/src/modules/telemetry
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # tillio — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/tillio 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/tillio 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/tillio/src/modules/tillio
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # translations — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/translations
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # warranty_claims — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/warranty_claims
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # webhooks — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/webhooks 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/webhooks 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/webhooks/src/modules/webhooks
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # wms — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/wms
4
4
 
5
5
  ## Sections
@@ -1,5 +1,5 @@
1
1
  # workflows — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.9.1-develop.7476.1.342138d35e; core 0.9.1-develop.7476.1.342138d35e — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.9.1-develop.7496.1.3346415f94; core 0.9.1-develop.7496.1.3346415f94 — R1 staleness stamp -->
3
3
  Source root: node_modules/@open-mercato/core/src/modules/workflows
4
4
 
5
5
  ## Sections
@@ -1185,7 +1185,7 @@
1185
1185
  "facts": {
1186
1186
  "title": "Example Module",
1187
1187
  "description": "Demonstrates pages, APIs, entities and DI.",
1188
- "coreVersion": "0.9.1-develop.7476.1.342138d35e",
1188
+ "coreVersion": "0.9.1-develop.7496.1.3346415f94",
1189
1189
  "sourcePackage": null,
1190
1190
  "sourceVersion": null,
1191
1191
  "sourceRoot": "src/modules/example",
@@ -557,3 +557,7 @@ Spec: [`.ai/specs/2026-09-08-error-reporting-policy.md`](.ai/specs/2026-09-08-er
557
557
  | Database schema, event IDs, ACL features, DI names, CLI commands | No change | ✓ n/a |
558
558
 
559
559
  **Migration path for existing modules**: send `parentId: null` / `childIds: []` where clearing is intended. Trees flattened before the upgrade are not repaired (see UPGRADE_NOTES.md).
560
+
561
+ ## Discord AI Proposals (2026-10-13)
562
+
563
+ [Waiver](UPGRADE_NOTES.md#discord-proposals)
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": 1,
3
- "generator": "@open-mercato/cli@0.9.1-develop.7476.1.342138d35e",
3
+ "generator": "@open-mercato/cli@0.9.1-develop.7496.1.3346415f94",
4
4
  "files": {
5
5
  "AGENTS.md": "9fdaca247f55c64f5966cc103265cfb03233e0532f58f14aff538ae18aa3555d",
6
- "BACKWARD_COMPATIBILITY.md": "4ed6dfe6a79217d169748d52b92856516ed7fadff0f785c6d4b1913555e2e933"
6
+ "BACKWARD_COMPATIBILITY.md": "02d20617e0a3dfd578bd1f7514eb4a15034c60423f4e24056dbe51f9330f756e"
7
7
  }
8
8
  }
package/dist/bin.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { isTelemetryBackendEnabled } from "@open-mercato/shared/lib/telemetry/runtime";
3
+ import { installNextSubpathResolveHook } from "@open-mercato/shared/lib/bootstrap/next-subpath-resolve-hook";
3
4
  import { resolveCliBootstrapMode } from "./lib/cli-bootstrap-mode.js";
4
5
  import { flushBeforeExit } from "./lib/flush-before-exit.js";
5
6
  function assertNode24Runtime() {
@@ -48,6 +49,7 @@ async function tryBootstrap(mode) {
48
49
  }
49
50
  async function main() {
50
51
  assertNode24Runtime();
52
+ installNextSubpathResolveHook();
51
53
  const bootstrapMode = resolveCliBootstrapMode(process.argv);
52
54
  if (bootstrapMode !== "none") {
53
55
  const { loadAppEnv } = await import("./lib/load-env.js");
package/dist/bin.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/bin.ts"],
4
- "sourcesContent": ["/**\n * CLI binary entry point for @open-mercato/cli package.\n *\n * Called from within a Next.js app directory as: yarn mercato <command>\n * Uses dynamic app resolution to find generated files at .mercato/generated/\n */\nimport { isTelemetryBackendEnabled } from '@open-mercato/shared/lib/telemetry/runtime'\nimport { resolveCliBootstrapMode, type CliBootstrapMode } from './lib/cli-bootstrap-mode.js'\nimport { flushBeforeExit } from './lib/flush-before-exit.js'\n// `run` is imported dynamically inside `main()` so telemetry can initialize\n// before the mercato entry (and its Postgres driver) loads \u2014 see main().\n\nfunction assertNode24Runtime(): void {\n const detectedNodeVersion = process.versions.node\n const majorVersion = Number.parseInt(detectedNodeVersion.split('.')[0] ?? '0', 10)\n if (majorVersion >= 24) {\n return\n }\n throw new Error(\n [\n 'Unsupported Node.js runtime.',\n `Cause: Detected Node ${detectedNodeVersion}, but Open Mercato requires Node 24.x.`,\n 'What to do: switch your shell to Node 24 (for example `nvm use 24`), run `yarn install`, then retry.',\n ].join(' '),\n )\n}\n\nasync function tryBootstrap(mode: Exclude<CliBootstrapMode, 'none'>): Promise<boolean> {\n try {\n // Use the CLI resolver to find the app directory (handles monorepo detection)\n const { createResolver } = await import('./lib/resolver.js')\n const resolver = createResolver()\n const appDir = resolver.getAppDir()\n\n if (mode === 'dev-supervisor') {\n const {\n canUseLightweightDevSupervisor,\n loadDevSupervisorManifest,\n registerDevSupervisorManifest,\n } = await import(\n './lib/dev-supervisor-manifest.js'\n )\n const manifest = loadDevSupervisorManifest(appDir)\n if (canUseLightweightDevSupervisor(manifest)) {\n registerDevSupervisorManifest(manifest)\n return true\n }\n }\n\n const { bootstrapFromAppRoot } = await import('@open-mercato/shared/lib/bootstrap/dynamicLoader')\n const { registerCliModules } = await import('./mercato.js')\n const data = await bootstrapFromAppRoot(appDir)\n // Register CLI modules directly to avoid module resolution issues\n registerCliModules(data.modules)\n return true\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n // Check if the error is about missing generated files\n if (\n message.includes('dev-supervisor.generated.json') ||\n (\n message.includes('Cannot find module') &&\n (message.includes('/generated/') || message.includes('.generated') || message.includes('.mercato'))\n )\n ) {\n return false\n }\n // Re-throw other errors\n throw err\n }\n}\n\nasync function main(): Promise<void> {\n assertNode24Runtime()\n const bootstrapMode = resolveCliBootstrapMode(process.argv)\n\n if (bootstrapMode !== 'none') {\n // Load the app's `.env` BEFORE initTelemetry(): `run()` only dotenv-loads it\n // later (ensureEnvLoaded), which is too late \u2014 TELEMETRY_BACKEND set only in\n // `.env` would silently resolve to `noop` for worker/scheduler processes.\n // The loader touches only the resolver + dotenv (no `pg`), preserving the\n // instrumentation load-order guarantee below.\n const { loadAppEnv } = await import('./lib/load-env.js')\n await loadAppEnv()\n\n // Initialize telemetry BEFORE bootstrapping the app graph. Bootstrap and the\n // per-command handlers load MikroORM's Postgres driver \u2192 `pg`, and the\n // OpenTelemetry pg/undici auto-instrumentation only records spans for a\n // driver required AFTER the SDK has started. Registering here \u2014 ahead of any\n // app module \u2014 is what lets long-running worker/scheduler processes emit DB\n // spans (not just the bullmq-otel add/process envelope). The package itself\n // is not imported unless an explicit supported backend is selected.\n if (isTelemetryBackendEnabled()) {\n const { initTelemetry } = await import('@open-mercato/telemetry')\n await initTelemetry()\n }\n\n const bootstrapSucceeded = await tryBootstrap(bootstrapMode)\n if (!bootstrapSucceeded) {\n console.error('\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557')\n console.error('\u2551 Generated files not found! \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 The CLI requires generated files to discover modules. \u2551')\n console.error('\u2551 Please run the following command first: \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 yarn mercato generate \u2551')\n console.error('\u2551 \u2551')\n console.error('\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D')\n process.exit(1)\n }\n }\n\n // Dynamic import (not a top-level static import) so the mercato entry \u2014 and the\n // Postgres driver it pulls in \u2014 loads only after initTelemetry() above.\n const { run } = await import('./mercato.js')\n const code = await run(process.argv)\n // Flush the coalesced browser broadcasts, then spans/logs, for commands that\n // return (workers block forever and flush via their own shutdown handler instead).\n await flushBeforeExit()\n process.exit(code ?? 0)\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof Error) {\n console.error(error.message)\n } else {\n console.error(error)\n }\n process.exit(1)\n})\n"],
5
- "mappings": "AAMA,SAAS,iCAAiC;AAC1C,SAAS,+BAAsD;AAC/D,SAAS,uBAAuB;AAIhC,SAAS,sBAA4B;AACnC,QAAM,sBAAsB,QAAQ,SAAS;AAC7C,QAAM,eAAe,OAAO,SAAS,oBAAoB,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AACjF,MAAI,gBAAgB,IAAI;AACtB;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR;AAAA,MACE;AAAA,MACA,wBAAwB,mBAAmB;AAAA,MAC3C;AAAA,IACF,EAAE,KAAK,GAAG;AAAA,EACZ;AACF;AAEA,eAAe,aAAa,MAA2D;AACrF,MAAI;AAEF,UAAM,EAAE,eAAe,IAAI,MAAM,OAAO,mBAAmB;AAC3D,UAAM,WAAW,eAAe;AAChC,UAAM,SAAS,SAAS,UAAU;AAElC,QAAI,SAAS,kBAAkB;AAC7B,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,MACF,IAAI,MAAM,OACR,kCACF;AACA,YAAM,WAAW,0BAA0B,MAAM;AACjD,UAAI,+BAA+B,QAAQ,GAAG;AAC5C,sCAA8B,QAAQ;AACtC,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,kDAAkD;AAChG,UAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,cAAc;AAC1D,UAAM,OAAO,MAAM,qBAAqB,MAAM;AAE9C,uBAAmB,KAAK,OAAO;AAC/B,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,UAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAE/D,QACE,QAAQ,SAAS,+BAA+B,KAE9C,QAAQ,SAAS,oBAAoB,MACpC,QAAQ,SAAS,aAAa,KAAK,QAAQ,SAAS,YAAY,KAAK,QAAQ,SAAS,UAAU,IAEnG;AACA,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;AAEA,eAAe,OAAsB;AACnC,sBAAoB;AACpB,QAAM,gBAAgB,wBAAwB,QAAQ,IAAI;AAE1D,MAAI,kBAAkB,QAAQ;AAM5B,UAAM,EAAE,WAAW,IAAI,MAAM,OAAO,mBAAmB;AACvD,UAAM,WAAW;AASjB,QAAI,0BAA0B,GAAG;AAC/B,YAAM,EAAE,cAAc,IAAI,MAAM,OAAO,yBAAyB;AAChE,YAAM,cAAc;AAAA,IACtB;AAEA,UAAM,qBAAqB,MAAM,aAAa,aAAa;AAC3D,QAAI,CAAC,oBAAoB;AACvB,cAAQ,MAAM,gaAAuE;AACrF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gaAAuE;AACrF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAIA,QAAM,EAAE,IAAI,IAAI,MAAM,OAAO,cAAc;AAC3C,QAAM,OAAO,MAAM,IAAI,QAAQ,IAAI;AAGnC,QAAM,gBAAgB;AACtB,UAAQ,KAAK,QAAQ,CAAC;AACxB;AAEA,KAAK,EAAE,MAAM,CAAC,UAAmB;AAC/B,MAAI,iBAAiB,OAAO;AAC1B,YAAQ,MAAM,MAAM,OAAO;AAAA,EAC7B,OAAO;AACL,YAAQ,MAAM,KAAK;AAAA,EACrB;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;",
4
+ "sourcesContent": ["/**\n * CLI binary entry point for @open-mercato/cli package.\n *\n * Called from within a Next.js app directory as: yarn mercato <command>\n * Uses dynamic app resolution to find generated files at .mercato/generated/\n */\nimport { isTelemetryBackendEnabled } from '@open-mercato/shared/lib/telemetry/runtime'\nimport { installNextSubpathResolveHook } from '@open-mercato/shared/lib/bootstrap/next-subpath-resolve-hook'\nimport { resolveCliBootstrapMode, type CliBootstrapMode } from './lib/cli-bootstrap-mode.js'\nimport { flushBeforeExit } from './lib/flush-before-exit.js'\n// `run` is imported dynamically inside `main()` so telemetry can initialize\n// before the mercato entry (and its Postgres driver) loads \u2014 see main().\n\nfunction assertNode24Runtime(): void {\n const detectedNodeVersion = process.versions.node\n const majorVersion = Number.parseInt(detectedNodeVersion.split('.')[0] ?? '0', 10)\n if (majorVersion >= 24) {\n return\n }\n throw new Error(\n [\n 'Unsupported Node.js runtime.',\n `Cause: Detected Node ${detectedNodeVersion}, but Open Mercato requires Node 24.x.`,\n 'What to do: switch your shell to Node 24 (for example `nvm use 24`), run `yarn install`, then retry.',\n ].join(' '),\n )\n}\n\nasync function tryBootstrap(mode: Exclude<CliBootstrapMode, 'none'>): Promise<boolean> {\n try {\n // Use the CLI resolver to find the app directory (handles monorepo detection)\n const { createResolver } = await import('./lib/resolver.js')\n const resolver = createResolver()\n const appDir = resolver.getAppDir()\n\n if (mode === 'dev-supervisor') {\n const {\n canUseLightweightDevSupervisor,\n loadDevSupervisorManifest,\n registerDevSupervisorManifest,\n } = await import(\n './lib/dev-supervisor-manifest.js'\n )\n const manifest = loadDevSupervisorManifest(appDir)\n if (canUseLightweightDevSupervisor(manifest)) {\n registerDevSupervisorManifest(manifest)\n return true\n }\n }\n\n const { bootstrapFromAppRoot } = await import('@open-mercato/shared/lib/bootstrap/dynamicLoader')\n const { registerCliModules } = await import('./mercato.js')\n const data = await bootstrapFromAppRoot(appDir)\n // Register CLI modules directly to avoid module resolution issues\n registerCliModules(data.modules)\n return true\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n // Check if the error is about missing generated files\n if (\n message.includes('dev-supervisor.generated.json') ||\n (\n message.includes('Cannot find module') &&\n (message.includes('/generated/') || message.includes('.generated') || message.includes('.mercato'))\n )\n ) {\n return false\n }\n // Re-throw other errors\n throw err\n }\n}\n\nasync function main(): Promise<void> {\n assertNode24Runtime()\n // Commands and workers run in plain Node, where a bare `next/<subpath>` such\n // as `next/dynamic` or `next/link` does not resolve (#7102). Install the\n // retry-with-`.js` hook before any package dist can be imported.\n installNextSubpathResolveHook()\n const bootstrapMode = resolveCliBootstrapMode(process.argv)\n\n if (bootstrapMode !== 'none') {\n // Load the app's `.env` BEFORE initTelemetry(): `run()` only dotenv-loads it\n // later (ensureEnvLoaded), which is too late \u2014 TELEMETRY_BACKEND set only in\n // `.env` would silently resolve to `noop` for worker/scheduler processes.\n // The loader touches only the resolver + dotenv (no `pg`), preserving the\n // instrumentation load-order guarantee below.\n const { loadAppEnv } = await import('./lib/load-env.js')\n await loadAppEnv()\n\n // Initialize telemetry BEFORE bootstrapping the app graph. Bootstrap and the\n // per-command handlers load MikroORM's Postgres driver \u2192 `pg`, and the\n // OpenTelemetry pg/undici auto-instrumentation only records spans for a\n // driver required AFTER the SDK has started. Registering here \u2014 ahead of any\n // app module \u2014 is what lets long-running worker/scheduler processes emit DB\n // spans (not just the bullmq-otel add/process envelope). The package itself\n // is not imported unless an explicit supported backend is selected.\n if (isTelemetryBackendEnabled()) {\n const { initTelemetry } = await import('@open-mercato/telemetry')\n await initTelemetry()\n }\n\n const bootstrapSucceeded = await tryBootstrap(bootstrapMode)\n if (!bootstrapSucceeded) {\n console.error('\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557')\n console.error('\u2551 Generated files not found! \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 The CLI requires generated files to discover modules. \u2551')\n console.error('\u2551 Please run the following command first: \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 yarn mercato generate \u2551')\n console.error('\u2551 \u2551')\n console.error('\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D')\n process.exit(1)\n }\n }\n\n // Dynamic import (not a top-level static import) so the mercato entry \u2014 and the\n // Postgres driver it pulls in \u2014 loads only after initTelemetry() above.\n const { run } = await import('./mercato.js')\n const code = await run(process.argv)\n // Flush the coalesced browser broadcasts, then spans/logs, for commands that\n // return (workers block forever and flush via their own shutdown handler instead).\n await flushBeforeExit()\n process.exit(code ?? 0)\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof Error) {\n console.error(error.message)\n } else {\n console.error(error)\n }\n process.exit(1)\n})\n"],
5
+ "mappings": "AAMA,SAAS,iCAAiC;AAC1C,SAAS,qCAAqC;AAC9C,SAAS,+BAAsD;AAC/D,SAAS,uBAAuB;AAIhC,SAAS,sBAA4B;AACnC,QAAM,sBAAsB,QAAQ,SAAS;AAC7C,QAAM,eAAe,OAAO,SAAS,oBAAoB,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AACjF,MAAI,gBAAgB,IAAI;AACtB;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR;AAAA,MACE;AAAA,MACA,wBAAwB,mBAAmB;AAAA,MAC3C;AAAA,IACF,EAAE,KAAK,GAAG;AAAA,EACZ;AACF;AAEA,eAAe,aAAa,MAA2D;AACrF,MAAI;AAEF,UAAM,EAAE,eAAe,IAAI,MAAM,OAAO,mBAAmB;AAC3D,UAAM,WAAW,eAAe;AAChC,UAAM,SAAS,SAAS,UAAU;AAElC,QAAI,SAAS,kBAAkB;AAC7B,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,MACF,IAAI,MAAM,OACR,kCACF;AACA,YAAM,WAAW,0BAA0B,MAAM;AACjD,UAAI,+BAA+B,QAAQ,GAAG;AAC5C,sCAA8B,QAAQ;AACtC,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,kDAAkD;AAChG,UAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,cAAc;AAC1D,UAAM,OAAO,MAAM,qBAAqB,MAAM;AAE9C,uBAAmB,KAAK,OAAO;AAC/B,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,UAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAE/D,QACE,QAAQ,SAAS,+BAA+B,KAE9C,QAAQ,SAAS,oBAAoB,MACpC,QAAQ,SAAS,aAAa,KAAK,QAAQ,SAAS,YAAY,KAAK,QAAQ,SAAS,UAAU,IAEnG;AACA,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;AAEA,eAAe,OAAsB;AACnC,sBAAoB;AAIpB,gCAA8B;AAC9B,QAAM,gBAAgB,wBAAwB,QAAQ,IAAI;AAE1D,MAAI,kBAAkB,QAAQ;AAM5B,UAAM,EAAE,WAAW,IAAI,MAAM,OAAO,mBAAmB;AACvD,UAAM,WAAW;AASjB,QAAI,0BAA0B,GAAG;AAC/B,YAAM,EAAE,cAAc,IAAI,MAAM,OAAO,yBAAyB;AAChE,YAAM,cAAc;AAAA,IACtB;AAEA,UAAM,qBAAqB,MAAM,aAAa,aAAa;AAC3D,QAAI,CAAC,oBAAoB;AACvB,cAAQ,MAAM,gaAAuE;AACrF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gaAAuE;AACrF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAIA,QAAM,EAAE,IAAI,IAAI,MAAM,OAAO,cAAc;AAC3C,QAAM,OAAO,MAAM,IAAI,QAAQ,IAAI;AAGnC,QAAM,gBAAgB;AACtB,UAAQ,KAAK,QAAQ,CAAC;AACxB;AAEA,KAAK,EAAE,MAAM,CAAC,UAAmB;AAC/B,MAAI,iBAAiB,OAAO;AAC1B,YAAQ,MAAM,MAAM,OAAO;AAAA,EAC7B,OAAO;AACL,YAAQ,MAAM,KAAK;AAAA,EACrB;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;",
6
6
  "names": []
7
7
  }
package/dist/mercato.js CHANGED
@@ -233,7 +233,11 @@ async function ensureEnvLoaded(options = {}) {
233
233
  const examplePath = path.join(appDir, ".env.example");
234
234
  if (fs.existsSync(examplePath)) {
235
235
  fs.copyFileSync(examplePath, envPath);
236
- console.log(`\u{1F4CB} Copied .env.example \u2192 .env (edit ${envPath} to customize)`);
236
+ console.log("");
237
+ console.log("\u26A0\uFE0F No .env was found, so one was created from .env.example.");
238
+ console.log(` ${envPath}`);
239
+ console.log(" It carries the example placeholders \u2014 review DATABASE_URL and secrets before continuing.");
240
+ console.log("");
237
241
  }
238
242
  }
239
243
  if (fs.existsSync(envPath)) {
@@ -656,13 +660,53 @@ async function buildAllModules() {
656
660
  if (appCli.length) all.push({ id: "app", cli: appCli });
657
661
  return all;
658
662
  }
663
+ function isHelpRequest(args) {
664
+ return args.some((arg) => arg === "--help" || arg === "-h");
665
+ }
666
+ const TOP_LEVEL_COMMAND_HELP = {
667
+ init: [
668
+ "Usage: mercato init [--reinstall|-r] [--no-examples] [--stresstest [--lite] [--count=<n>]]",
669
+ "Initializes this app: installs dependencies, runs generators, applies migrations and seeds data."
670
+ ],
671
+ "agentic:init": [
672
+ "Usage: mercato agentic:init [--force]",
673
+ "Scaffolds the agentic harness (AGENTS.md, .ai/ config and skills) into this app."
674
+ ],
675
+ "seed:defaults": [
676
+ "Usage: mercato seed:defaults [--module <moduleId>]",
677
+ "Runs every enabled module's seedDefaults hook, or only the named module's."
678
+ ],
679
+ "umes:list": [
680
+ "Usage: mercato umes:list",
681
+ "Lists the extension points every enabled module declares."
682
+ ],
683
+ "umes:inspect": [
684
+ "Usage: mercato umes:inspect --module <moduleId>",
685
+ "Prints the extension surface a single module declares."
686
+ ],
687
+ "umes:check": [
688
+ "Usage: mercato umes:check",
689
+ "Validates declared extension points against the modules that implement them."
690
+ ]
691
+ };
692
+ function resolveEnvBootstrapOptions(parts) {
693
+ const first = parts[0];
694
+ const opaqueEnvCommand = first === "deploy" || first === "telemetry";
695
+ const helpRequested = isHelpRequest(parts);
696
+ return {
697
+ createIfMissing: !helpRequested && !opaqueEnvCommand,
698
+ quiet: helpRequested || opaqueEnvCommand
699
+ };
700
+ }
659
701
  async function run(argv = process.argv) {
660
702
  const [, , ...parts] = argv;
661
703
  const [first, second, ...remaining] = parts;
662
- await ensureEnvLoaded({
663
- createIfMissing: first !== "deploy" && first !== "telemetry",
664
- quiet: first === "deploy" || first === "telemetry"
665
- });
704
+ const helpRequested = isHelpRequest(parts);
705
+ await ensureEnvLoaded(resolveEnvBootstrapOptions(parts));
706
+ if (helpRequested && first && Object.hasOwn(TOP_LEVEL_COMMAND_HELP, first)) {
707
+ for (const line of TOP_LEVEL_COMMAND_HELP[first]) console.log(` ${line}`);
708
+ return 0;
709
+ }
666
710
  if (first === "init") {
667
711
  const { execSync } = await import("child_process");
668
712
  console.log("\u{1F680} Initializing Open Mercato app...\n");
@@ -1297,6 +1341,8 @@ async function run(argv = process.argv) {
1297
1341
  cli: [
1298
1342
  {
1299
1343
  command: "railway",
1344
+ // Parses --help/-h itself and prints railwayDeployHelp() without deploying.
1345
+ handlesHelp: true,
1300
1346
  run: async (args) => {
1301
1347
  const { runRailwayDeploy } = await import("./lib/deploy/railway/index.js");
1302
1348
  await runRailwayDeploy(args);
@@ -1600,6 +1646,7 @@ async function run(argv = process.argv) {
1600
1646
  cli: [
1601
1647
  {
1602
1648
  command: "generate",
1649
+ help: "Generates a migration per module from the current ORM entities and refreshes each\nmodule's .snapshot-open-mercato.json. Writes files only \u2014 nothing is applied.",
1603
1650
  run: async () => {
1604
1651
  const { createResolver } = await import("./lib/resolver.js");
1605
1652
  const { dbGenerate } = await import("./lib/db/index.js");
@@ -1609,6 +1656,7 @@ async function run(argv = process.argv) {
1609
1656
  },
1610
1657
  {
1611
1658
  command: "migrate",
1659
+ help: "Applies every pending migration to the database DATABASE_URL points at.\nThis mutates the database \u2014 check .env before running it.",
1612
1660
  run: async () => {
1613
1661
  const { createResolver } = await import("./lib/resolver.js");
1614
1662
  const { dbMigrate } = await import("./lib/db/index.js");
@@ -1618,6 +1666,7 @@ async function run(argv = process.argv) {
1618
1666
  },
1619
1667
  {
1620
1668
  command: "greenfield",
1669
+ help: "Drops and recreates the schema from scratch, then re-applies every migration.\nDestroys all data. Pass --yes (-y) to skip the confirmation prompt.",
1621
1670
  run: async (args) => {
1622
1671
  const { createResolver } = await import("./lib/resolver.js");
1623
1672
  const { dbGreenfield } = await import("./lib/db/index.js");
@@ -2170,11 +2219,26 @@ async function run(argv = process.argv) {
2170
2219
  console.log(pad(`Commands for "${modName}": ${mod.cli.map((c) => c.command).join(", ")}`));
2171
2220
  return 1;
2172
2221
  }
2222
+ if (isHelpRequest([cmdName])) {
2223
+ console.log(pad(`Usage: \u2728 mercato ${modName} <command> [args]`));
2224
+ console.log(pad(`Commands for "${modName}": ${mod.cli.map((c) => c.command).join(", ")}`));
2225
+ return 0;
2226
+ }
2173
2227
  const cmd = mod.cli.find((c) => c.command === cmdName);
2174
2228
  if (!cmd) {
2175
2229
  console.error(`\u{1F914} Unknown command "${cmdName}". Available: ${mod.cli.map((c) => c.command).join(", ")}`);
2176
2230
  return 1;
2177
2231
  }
2232
+ if (isHelpRequest(rest) && !cmd.handlesHelp) {
2233
+ console.log(pad(`Usage: \u2728 mercato ${modName} ${cmdName} [args]`));
2234
+ if (cmd.help) {
2235
+ console.log("");
2236
+ for (const line of cmd.help.split("\n")) console.log(pad(line));
2237
+ }
2238
+ console.log("");
2239
+ console.log(pad(`Commands for "${modName}": ${mod.cli.map((c) => c.command).join(", ")}`));
2240
+ return 0;
2241
+ }
2178
2242
  console.log("");
2179
2243
  const started = Date.now();
2180
2244
  const loggedArgs = modName === "deploy" && cmdName === "railway" ? (await import("./lib/deploy/railway/options.js")).redactRailwayCliArgs(rest) : rest;
@@ -2194,8 +2258,10 @@ async function run(argv = process.argv) {
2194
2258
  export {
2195
2259
  getCliModules,
2196
2260
  hasCliModules,
2261
+ isHelpRequest,
2197
2262
  padByCodePointWidth,
2198
2263
  registerCliModules,
2264
+ resolveEnvBootstrapOptions,
2199
2265
  resolveQueueAbandonHook,
2200
2266
  run
2201
2267
  };