@open-mercato/cli 0.11.1-develop.8883.1.78d3645a50 → 0.11.1-develop.8910.1.d07a49d70a

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 (162) hide show
  1. package/.turbo/turbo-build.log +7 -1
  2. package/dist/agentic/guides/integrations.md +1 -1
  3. package/dist/agentic/guides/module-facts.json +2117 -178
  4. package/dist/agentic/guides/module-facts.v2.json +2117 -178
  5. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  6. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  7. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  8. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  9. package/dist/agentic/guides/modules/assisted_selling/index.md +1 -1
  10. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  11. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  12. package/dist/agentic/guides/modules/auth/index.md +1 -1
  13. package/dist/agentic/guides/modules/availability/index.md +1 -1
  14. package/dist/agentic/guides/modules/backups/index.md +1 -1
  15. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  16. package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
  17. package/dist/agentic/guides/modules/cart/index.md +1 -1
  18. package/dist/agentic/guides/modules/catalog/acl-features.md +3 -1
  19. package/dist/agentic/guides/modules/catalog/backend-pages.md +3 -0
  20. package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +4 -0
  21. package/dist/agentic/guides/modules/catalog/custom-entities.md +1 -0
  22. package/dist/agentic/guides/modules/catalog/domain-commands.md +3 -0
  23. package/dist/agentic/guides/modules/catalog/entities.md +3 -0
  24. package/dist/agentic/guides/modules/catalog/events.md +4 -1
  25. package/dist/agentic/guides/modules/catalog/exact-override-targets.md +5 -0
  26. package/dist/agentic/guides/modules/catalog/host-extension-points.md +1 -1
  27. package/dist/agentic/guides/modules/catalog/index.md +6 -6
  28. package/dist/agentic/guides/modules/catalog/search-entities.md +1 -0
  29. package/dist/agentic/guides/modules/catalog/umes-contributions.md +4 -0
  30. package/dist/agentic/guides/modules/catalog/umes-hosts.md +8 -0
  31. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  32. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  33. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  34. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  35. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  36. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  37. package/dist/agentic/guides/modules/channel_ms365/acl-features.md +12 -0
  38. package/dist/agentic/guides/modules/channel_ms365/contribution-resolutions.md +12 -0
  39. package/dist/agentic/guides/modules/channel_ms365/di-registrations-rich.md +12 -0
  40. package/dist/agentic/guides/modules/channel_ms365/exact-override-targets.md +17 -0
  41. package/dist/agentic/guides/modules/channel_ms365/index.md +18 -0
  42. package/dist/agentic/guides/modules/channel_ms365/owned-contract-module-metadata.md +11 -0
  43. package/dist/agentic/guides/modules/channel_ms365/setup.md +11 -0
  44. package/dist/agentic/guides/modules/channel_ms365/umes-contributions.md +12 -0
  45. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  46. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  47. package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
  48. package/dist/agentic/guides/modules/checkout/exact-override-targets.md +1 -1
  49. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  50. package/dist/agentic/guides/modules/checkout/workers.md +1 -1
  51. package/dist/agentic/guides/modules/communication_channels/incoming-installed-contributions.md +1 -0
  52. package/dist/agentic/guides/modules/communication_channels/index.md +2 -2
  53. package/dist/agentic/guides/modules/configs/acl-features.md +3 -1
  54. package/dist/agentic/guides/modules/configs/backend-pages.md +1 -0
  55. package/dist/agentic/guides/modules/configs/exact-override-targets.md +3 -0
  56. package/dist/agentic/guides/modules/configs/index.md +3 -3
  57. package/dist/agentic/guides/modules/configs/owned-contract-module-metadata.md +1 -1
  58. package/dist/agentic/guides/modules/configs/umes-hosts.md +1 -0
  59. package/dist/agentic/guides/modules/content/index.md +1 -1
  60. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  61. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  62. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  63. package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +1 -0
  64. package/dist/agentic/guides/modules/customers/index.md +1 -1
  65. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  66. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  67. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  68. package/dist/agentic/guides/modules/devices/index.md +1 -1
  69. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  70. package/dist/agentic/guides/modules/directory/index.md +1 -1
  71. package/dist/agentic/guides/modules/documents/index.md +1 -1
  72. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  73. package/dist/agentic/guides/modules/entities/index.md +1 -1
  74. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  75. package/dist/agentic/guides/modules/events/index.md +1 -1
  76. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  77. package/dist/agentic/guides/modules/forms/index.md +1 -1
  78. package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
  79. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  80. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  81. package/dist/agentic/guides/modules/generators/index.md +1 -1
  82. package/dist/agentic/guides/modules/gus_regon/acl-features.md +11 -0
  83. package/dist/agentic/guides/modules/gus_regon/cli-commands.md +12 -0
  84. package/dist/agentic/guides/modules/gus_regon/contribution-resolutions.md +11 -0
  85. package/dist/agentic/guides/modules/gus_regon/di-registrations-rich.md +11 -0
  86. package/dist/agentic/guides/modules/gus_regon/exact-override-targets.md +17 -0
  87. package/dist/agentic/guides/modules/gus_regon/index.md +19 -0
  88. package/dist/agentic/guides/modules/gus_regon/owned-contract-module-metadata.md +11 -0
  89. package/dist/agentic/guides/modules/gus_regon/setup.md +11 -0
  90. package/dist/agentic/guides/modules/gus_regon/umes-contributions.md +11 -0
  91. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  92. package/dist/agentic/guides/modules/integrations/index.md +1 -1
  93. package/dist/agentic/guides/modules/ledger/index.md +1 -1
  94. package/dist/agentic/guides/modules/maintenance/index.md +1 -1
  95. package/dist/agentic/guides/modules/messages/index.md +1 -1
  96. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  97. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  98. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  99. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  100. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  101. package/dist/agentic/guides/modules/planner/index.md +1 -1
  102. package/dist/agentic/guides/modules/portal/index.md +1 -1
  103. package/dist/agentic/guides/modules/progress/index.md +1 -1
  104. package/dist/agentic/guides/modules/promotions/index.md +1 -1
  105. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  106. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  107. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  108. package/dist/agentic/guides/modules/resources/index.md +1 -1
  109. package/dist/agentic/guides/modules/sales/index.md +1 -1
  110. package/dist/agentic/guides/modules/sales_invoices_gl_posting/index.md +1 -1
  111. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  112. package/dist/agentic/guides/modules/search/index.md +1 -1
  113. package/dist/agentic/guides/modules/security/index.md +1 -1
  114. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  115. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  116. package/dist/agentic/guides/modules/sso/index.md +1 -1
  117. package/dist/agentic/guides/modules/staff/index.md +1 -1
  118. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  119. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  120. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  121. package/dist/agentic/guides/modules/sync_shopify/acl-features.md +12 -0
  122. package/dist/agentic/guides/modules/sync_shopify/cli-commands.md +12 -0
  123. package/dist/agentic/guides/modules/sync_shopify/contribution-resolutions.md +11 -0
  124. package/dist/agentic/guides/modules/sync_shopify/di-registrations-rich.md +11 -0
  125. package/dist/agentic/guides/modules/sync_shopify/exact-override-targets.md +17 -0
  126. package/dist/agentic/guides/modules/sync_shopify/index.md +19 -0
  127. package/dist/agentic/guides/modules/sync_shopify/owned-contract-module-metadata.md +11 -0
  128. package/dist/agentic/guides/modules/sync_shopify/setup.md +11 -0
  129. package/dist/agentic/guides/modules/sync_shopify/umes-contributions.md +11 -0
  130. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  131. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  132. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  133. package/dist/agentic/guides/modules/translations/index.md +1 -1
  134. package/dist/agentic/guides/modules/upgrade_actions/index.md +1 -1
  135. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  136. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  137. package/dist/agentic/guides/modules/wms/index.md +1 -1
  138. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  139. package/dist/agentic/guides/reference-module-facts.json +2 -2
  140. package/dist/agentic/guides/reference-modules/example/index.md +1 -1
  141. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +18 -0
  142. package/dist/agentic/guides/upstream/manifest.json +2 -2
  143. package/dist/agentic/shared/ai/harness/cases.json +4 -3
  144. package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +1 -1
  145. package/dist/lib/init-secrets.js +1 -1
  146. package/dist/lib/init-secrets.js.map +2 -2
  147. package/dist/lib/testing/integration-discovery.js +13 -0
  148. package/dist/lib/testing/integration-discovery.js.map +2 -2
  149. package/dist/lib/testing/integration.js +286 -26
  150. package/dist/lib/testing/integration.js.map +2 -2
  151. package/dist/mercato.js +9 -2
  152. package/dist/mercato.js.map +2 -2
  153. package/package.json +7 -7
  154. package/src/__tests__/mercato.test.ts +68 -0
  155. package/src/lib/__tests__/init-secrets.test.ts +11 -2
  156. package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +2 -0
  157. package/src/lib/init-secrets.ts +1 -1
  158. package/src/lib/testing/__tests__/integration-prebuilt-artifacts.test.ts +486 -0
  159. package/src/lib/testing/__tests__/integration.test.ts +27 -0
  160. package/src/lib/testing/integration-discovery.ts +16 -0
  161. package/src/lib/testing/integration.ts +366 -27
  162. package/src/mercato.ts +9 -2
@@ -17,6 +17,7 @@ import {
17
17
  resolveAppReadyTimeoutMs,
18
18
  resolveEphemeralPostgresImage,
19
19
  resolveEphemeralJwtSecret,
20
+ buildEphemeralInitializationEnvironment,
20
21
  resolveEphemeralSuperadminPassword,
21
22
  ephemeralPostgresInitSql,
22
23
  shouldReuseBuildArtifacts,
@@ -1515,3 +1516,29 @@ describeOnPosix('terminateProcessTree against a real detached process tree', ()
1515
1516
  }
1516
1517
  }, 20_000)
1517
1518
  })
1519
+
1520
+ describe('isolated initialization password policy', () => {
1521
+ it('validates historical fixtures against an explicit initialization-only policy', async () => {
1522
+ const { buildPasswordSchema, getPasswordPolicy } = await import('@open-mercato/shared/lib/auth/passwordPolicy')
1523
+ const runtime = {
1524
+ OM_INTEGRATION_TEST: 'true',
1525
+ OM_PASSWORD_MIN_LENGTH: '12',
1526
+ OM_PASSWORD_REQUIRE_DIGIT: 'true',
1527
+ OM_PASSWORD_REQUIRE_UPPERCASE: 'true',
1528
+ OM_PASSWORD_REQUIRE_SPECIAL: 'true',
1529
+ }
1530
+ const initialization = buildEphemeralInitializationEnvironment(runtime)
1531
+ expect(buildPasswordSchema({ policy: getPasswordPolicy(initialization) }).safeParse('secret').success).toBe(true)
1532
+ expect(buildPasswordSchema({ policy: getPasswordPolicy(runtime) }).safeParse('secret').success).toBe(false)
1533
+ expect(runtime.OM_PASSWORD_MIN_LENGTH).toBe('12')
1534
+ expect(runtime.OM_PASSWORD_REQUIRE_DIGIT).toBe('true')
1535
+ })
1536
+
1537
+ it('preserves isolated database and credential overrides without mutating runtime configuration', () => {
1538
+ const runtime = { DATABASE_URL: 'isolated-fixture-database', OM_INIT_ADMIN_PASSWORD: 'Custom-Test-1!' }
1539
+ const initialization = buildEphemeralInitializationEnvironment(runtime)
1540
+ expect(initialization.DATABASE_URL).toBe(runtime.DATABASE_URL)
1541
+ expect(initialization.OM_INIT_ADMIN_PASSWORD).toBe(runtime.OM_INIT_ADMIN_PASSWORD)
1542
+ expect(runtime).not.toHaveProperty('OM_PASSWORD_MIN_LENGTH')
1543
+ })
1544
+ })
@@ -45,6 +45,22 @@ function normalizeModuleId(moduleId: string): string {
45
45
  return moduleId.trim().toLowerCase()
46
46
  }
47
47
 
48
+ export function parseIntegrationModuleList(value: string | undefined): Set<string> {
49
+ return new Set((value ?? '').split(',').map(normalizeModuleId).filter(Boolean))
50
+ }
51
+
52
+ export function filterIntegrationSpecsForModules<T extends Pick<IntegrationSpecDiscoveryItem, 'moduleName' | 'requiredModules'>>(
53
+ specs: T[],
54
+ modules: Set<string>,
55
+ ): T[] {
56
+ if (modules.size === 0) return specs
57
+ return specs.filter((spec) => {
58
+ if (spec.moduleName === null) return true
59
+ if (modules.has(normalizeModuleId(spec.moduleName))) return true
60
+ return spec.requiredModules.some((moduleId) => modules.has(normalizeModuleId(moduleId)))
61
+ })
62
+ }
63
+
48
64
  function isEnterpriseModulesEnabled(): boolean {
49
65
  const rawValue = process.env.OM_ENABLE_ENTERPRISE_MODULES?.trim().toLowerCase()
50
66
  return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'
@@ -11,6 +11,7 @@ import { stdin as input, stdout as output } from 'node:process'
11
11
  import spawn from 'cross-spawn'
12
12
  import { fetchWithTimeout, type FetchWithTimeoutInit } from '@open-mercato/shared/lib/http/fetchWithTimeout'
13
13
  import { isUnsafeJwtSecret } from '@open-mercato/shared/lib/auth/jwt'
14
+ import { parseBooleanToken, parseBooleanWithDefault } from '@open-mercato/shared/lib/boolean'
14
15
  import { resolveEnvironment } from '../resolver'
15
16
  import { resolveInitSuperadminCredentials } from '../init-secrets'
16
17
  import { resolveSpawnCommand } from '../spawn'
@@ -202,6 +203,7 @@ const EPHEMERAL_ENV_LOCK_POLL_MS = 500
202
203
  const DEFAULT_BUILD_CACHE_TTL_SECONDS = 600
203
204
  const APP_READY_TIMEOUT_ENV_VAR = 'OM_INTEGRATION_APP_READY_TIMEOUT_SECONDS'
204
205
  const BUILD_CACHE_TTL_ENV_VAR = 'OM_INTEGRATION_BUILD_CACHE_TTL_SECONDS'
206
+ export const PREBUILT_ARTIFACTS_ENV_VAR = 'OM_INTEGRATION_PREBUILT_ARTIFACTS'
205
207
  const EPHEMERAL_POSTGRES_IMAGE_ENV_VAR = 'OM_INTEGRATION_POSTGRES_IMAGE'
206
208
  // Dev/prod and the dev container run pgvector-enabled Postgres (see docker-compose*.yml,
207
209
  // docker/postgres-init.sh, .devcontainer/docker-compose.yml). The ephemeral integration DB
@@ -228,6 +230,16 @@ export function ephemeralPostgresInitSql(): string {
228
230
  return EPHEMERAL_POSTGRES_INIT_SQL
229
231
  }
230
232
 
233
+ export function buildEphemeralInitializationEnvironment(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
234
+ return {
235
+ ...environment,
236
+ OM_PASSWORD_MIN_LENGTH: '6',
237
+ OM_PASSWORD_REQUIRE_DIGIT: 'false',
238
+ OM_PASSWORD_REQUIRE_UPPERCASE: 'false',
239
+ OM_PASSWORD_REQUIRE_SPECIAL: 'false',
240
+ }
241
+ }
242
+
231
243
  const DEFAULT_EPHEMERAL_JWT_SECRET = 'om-ephemeral-integration-jwt-secret'
232
244
 
233
245
  export function resolveEphemeralJwtSecret(env: NodeJS.ProcessEnv = process.env): string {
@@ -402,12 +414,19 @@ const FOLDER_TO_CATEGORY_CODE: Record<string, string> = {
402
414
  const BACKEND_BROWSER_AUTH_REDIRECT_LIMIT = 6
403
415
  const AUTHENTICATED_API_PROBE_PATH = '/api/auth/profile'
404
416
  const BUILD_CACHE_STATE_VERSION = 2
405
- const BUILD_CACHE_ENV_KEYS = [
406
- 'NODE_ENV',
417
+ // Variables that change what `yarn generate` / `next build` emit, besides the NEXT_PUBLIC_* values
418
+ // Next inlines. Both the runner's own build cache and the prebuilt-artifact check key on this list.
419
+ const BUILD_SHAPING_ENV_KEYS = [
407
420
  'OM_ENABLE_ENTERPRISE_MODULES',
408
421
  'OM_ENABLE_ENTERPRISE_MODULES_SSO',
409
422
  'OM_ENABLE_ENTERPRISE_MODULES_SECURITY',
423
+ 'OM_ENABLE_ENTERPRISE_MODULES_AGENTS',
424
+ 'OM_ENABLE_ENTERPRISE_MODULES_BACKUPS',
425
+ 'OM_ENABLE_STORAGE_S3',
426
+ 'OM_INTEGRATION_TEST',
427
+ 'SELF_SERVICE_ONBOARDING_ENABLED',
410
428
  ] as const
429
+ const BUILD_CACHE_ENV_KEYS = ['NODE_ENV', ...BUILD_SHAPING_ENV_KEYS] as const
411
430
  const IGNORED_EPHEMERAL_BUILD_CACHE_DIRS = new Set([
412
431
  'node_modules',
413
432
  '.next',
@@ -1300,6 +1319,325 @@ export async function shouldRebuildBuildArtifacts(
1300
1319
  return !(await shouldReuseBuildArtifacts(ttlSeconds, logPrefix, options))
1301
1320
  }
1302
1321
 
1322
+ // In prebuilt mode the build ran outside this runner (CI `prepare`). `mercato test record-build-env`
1323
+ // stores the build-shaping values that build used next to its output, and the runner refuses to start
1324
+ // when its own values differ, so the app under test cannot silently differ from the one it would build.
1325
+ // The record also pins the git commit the build came from, so an older build is never run against newer
1326
+ // test or app code. Only a build from a clean tree can be pinned; uncommitted changes in the runner's
1327
+ // checkout only warn, because a test run itself may touch tracked files between runner invocations.
1328
+ export const PREBUILT_BUILD_ENV_RECORD_FILE = 'om-integration-build-env.json'
1329
+ const PREBUILT_BUILD_ENV_RECORD_VERSION = 2
1330
+ // The runner points this at the per-run port, so no prebuilt bundle can match it. Client code prefers an
1331
+ // inlined value over the browser origin, so the build must leave it unset; it is recorded and rejected
1332
+ // when set instead of being compared.
1333
+ const PREBUILT_RUNTIME_ONLY_PUBLIC_KEYS = new Set(['NEXT_PUBLIC_APP_URL'])
1334
+ const PREBUILT_CHANGED_FILES_PREVIEW_LIMIT = 10
1335
+
1336
+ export type PrebuiltSourceRevision = {
1337
+ commit: string
1338
+ changedFiles: string[]
1339
+ }
1340
+
1341
+ export type PrebuiltArtifactRequirement = {
1342
+ label: string
1343
+ anyOf: string[]
1344
+ }
1345
+
1346
+ export type PrebuiltBuildEnvironmentRecord = {
1347
+ recordPath: string
1348
+ environment: Record<string, string>
1349
+ source: { commit: string }
1350
+ }
1351
+
1352
+ export function resolvePrebuiltArtifactsMode(env: NodeJS.ProcessEnv = process.env): boolean {
1353
+ return parseBooleanWithDefault(env[PREBUILT_ARTIFACTS_ENV_VAR], false)
1354
+ }
1355
+
1356
+ export function resolvePrebuiltArtifactRequirements(): PrebuiltArtifactRequirement[] {
1357
+ const requirements: PrebuiltArtifactRequirement[] = [
1358
+ {
1359
+ label: 'Next.js build output (BUILD_ID)',
1360
+ anyOf: NEXT_BUILD_OUTPUT_DIRECTORIES.map((directory) => path.join(directory, 'BUILD_ID')),
1361
+ },
1362
+ {
1363
+ label: 'generated module registry',
1364
+ anyOf: [path.join(appDirectory, '.mercato', 'generated', 'modules.generated.ts')],
1365
+ },
1366
+ ]
1367
+ if (PROJECT_SUPPORTS_PACKAGE_BUILDS) {
1368
+ requirements.push(
1369
+ { label: 'core package dist', anyOf: [path.join(corePackageRootDirectory, 'dist', 'index.js')] },
1370
+ { label: 'ui package dist', anyOf: [path.join(uiPackageRootDirectory, 'dist', 'index.js')] },
1371
+ )
1372
+ }
1373
+ return requirements
1374
+ }
1375
+
1376
+ export async function findMissingPrebuiltArtifacts(
1377
+ requirements: PrebuiltArtifactRequirement[],
1378
+ ): Promise<PrebuiltArtifactRequirement[]> {
1379
+ const missing: PrebuiltArtifactRequirement[] = []
1380
+ for (const requirement of requirements) {
1381
+ let found = false
1382
+ for (const candidate of requirement.anyOf) {
1383
+ if (!(await isBuildArtifactMissing(candidate))) {
1384
+ found = true
1385
+ break
1386
+ }
1387
+ }
1388
+ if (!found) missing.push(requirement)
1389
+ }
1390
+ return missing
1391
+ }
1392
+
1393
+ function isBuildShapingEnvKey(key: string): boolean {
1394
+ return (BUILD_SHAPING_ENV_KEYS as readonly string[]).includes(key) || key.startsWith('NEXT_PUBLIC_')
1395
+ }
1396
+
1397
+ function isComparedBuildShapingEnvKey(key: string): boolean {
1398
+ return isBuildShapingEnvKey(key) && !PREBUILT_RUNTIME_ONLY_PUBLIC_KEYS.has(key)
1399
+ }
1400
+
1401
+ export function pickBuildShapingEnvironment(environment: NodeJS.ProcessEnv): Record<string, string> {
1402
+ const picked: Record<string, string> = {}
1403
+ for (const key of Object.keys(environment).sort((left, right) => left.localeCompare(right))) {
1404
+ const value = environment[key]
1405
+ if (value !== undefined && isBuildShapingEnvKey(key)) picked[key] = value
1406
+ }
1407
+ return picked
1408
+ }
1409
+
1410
+ export function findPrebuiltBuildEnvironmentMismatches(
1411
+ builtEnvironment: NodeJS.ProcessEnv,
1412
+ runtimeEnvironment: NodeJS.ProcessEnv,
1413
+ ): string[] {
1414
+ const publicKeys = [...Object.keys(builtEnvironment), ...Object.keys(runtimeEnvironment)]
1415
+ .filter((key) => key.startsWith('NEXT_PUBLIC_') && isComparedBuildShapingEnvKey(key))
1416
+ const keys = Array.from(new Set<string>([...BUILD_SHAPING_ENV_KEYS, ...publicKeys]))
1417
+ .sort((left, right) => left.localeCompare(right))
1418
+ return keys.filter((key) => (
1419
+ normalizePrebuiltEnvValue(key, builtEnvironment[key])
1420
+ !== normalizePrebuiltEnvValue(key, runtimeEnvironment[key])
1421
+ ))
1422
+ }
1423
+
1424
+ function normalizePrebuiltEnvValue(key: string, raw: string | undefined): string | undefined {
1425
+ if (key.startsWith('NEXT_PUBLIC_') || key === 'SELF_SERVICE_ONBOARDING_ENABLED') return raw
1426
+ const trimmed = raw?.trim() ?? ''
1427
+ if (!trimmed) return 'false'
1428
+ const parsed = parseBooleanToken(trimmed)
1429
+ return parsed === null ? trimmed : String(parsed)
1430
+ }
1431
+
1432
+ export function resolvePrebuiltSourceRevision(cwd: string = projectRootDirectory): PrebuiltSourceRevision | null {
1433
+ const head = spawnSync('git', ['rev-parse', 'HEAD'], { cwd, encoding: 'utf8' })
1434
+ const commit = head.status === 0 ? head.stdout.trim() : ''
1435
+ if (!commit) return null
1436
+ const diff = spawnSync('git', ['diff', 'HEAD', '--name-only', '-z', '--no-ext-diff'], { cwd, encoding: 'utf8' })
1437
+ if (diff.status !== 0) return null
1438
+ const changedFiles = diff.stdout.split('\0').filter((file) => file.length > 0).sort((left, right) => left.localeCompare(right))
1439
+ return { commit, changedFiles }
1440
+ }
1441
+
1442
+ function describeChangedFiles(changedFiles: string[]): string {
1443
+ const preview = changedFiles.slice(0, PREBUILT_CHANGED_FILES_PREVIEW_LIMIT).join(', ')
1444
+ const remaining = changedFiles.length - PREBUILT_CHANGED_FILES_PREVIEW_LIMIT
1445
+ return remaining > 0 ? `${preview} and ${remaining} more` : preview
1446
+ }
1447
+
1448
+ async function findNextBuildOutputDirectory(directories: readonly string[]): Promise<string | null> {
1449
+ for (const directory of directories) {
1450
+ if (!(await isBuildArtifactMissing(path.join(directory, 'BUILD_ID')))) return directory
1451
+ }
1452
+ return null
1453
+ }
1454
+
1455
+ export async function writePrebuiltBuildEnvironmentRecord(options: {
1456
+ environment?: NodeJS.ProcessEnv
1457
+ buildOutputDirectories?: readonly string[]
1458
+ resolveSourceRevision?: () => PrebuiltSourceRevision | null
1459
+ } = {}): Promise<PrebuiltBuildEnvironmentRecord> {
1460
+ const directories = options.buildOutputDirectories ?? NEXT_BUILD_OUTPUT_DIRECTORIES
1461
+ const directory = await findNextBuildOutputDirectory(directories)
1462
+ if (!directory) {
1463
+ throw new Error(
1464
+ `[internal] No Next.js build output (BUILD_ID) found in ${directories.join(' or ')}. Build the app first (yarn build:app), then record its environment.`,
1465
+ )
1466
+ }
1467
+ const source = (options.resolveSourceRevision ?? (() => resolvePrebuiltSourceRevision()))()
1468
+ if (!source) {
1469
+ throw new Error(
1470
+ '[internal] Cannot determine the source revision of the build (git rev-parse HEAD / git diff HEAD failed). Record the build environment from inside the git checkout the app was built from.',
1471
+ )
1472
+ }
1473
+ if (source.changedFiles.length > 0) {
1474
+ throw new Error(
1475
+ `[internal] Cannot record a build made from uncommitted changes (${describeChangedFiles(source.changedFiles)}): the prebuilt app could not be matched to a commit. Commit or stash them, rebuild, then record.`,
1476
+ )
1477
+ }
1478
+ const environment = pickBuildShapingEnvironment(options.environment ?? process.env)
1479
+ const recordPath = path.join(directory, PREBUILT_BUILD_ENV_RECORD_FILE)
1480
+ const contents = { version: PREBUILT_BUILD_ENV_RECORD_VERSION, environment, source: { commit: source.commit } }
1481
+ await writeFile(recordPath, `${JSON.stringify(contents, null, 2)}\n`, 'utf8')
1482
+ return { recordPath, environment, source: { commit: source.commit } }
1483
+ }
1484
+
1485
+ function parsePrebuiltBuildEnvironmentRecord(
1486
+ raw: string,
1487
+ recordPath: string,
1488
+ ): Pick<PrebuiltBuildEnvironmentRecord, 'environment' | 'source'> {
1489
+ const invalid = new Error(`[internal] ${recordPath} is not a valid build environment record. Record it again after the app build.`)
1490
+ let parsed: unknown
1491
+ try {
1492
+ parsed = JSON.parse(raw)
1493
+ } catch {
1494
+ throw invalid
1495
+ }
1496
+ if (!parsed || typeof parsed !== 'object') throw invalid
1497
+ const { version, environment, source } = parsed as { version?: unknown; environment?: unknown; source?: unknown }
1498
+ if (version !== PREBUILT_BUILD_ENV_RECORD_VERSION || !environment || typeof environment !== 'object') throw invalid
1499
+ const entries = Object.entries(environment)
1500
+ if (entries.some(([, value]) => typeof value !== 'string')) throw invalid
1501
+ if (!source || typeof source !== 'object') throw invalid
1502
+ const { commit } = source as { commit?: unknown }
1503
+ if (typeof commit !== 'string' || !commit) throw invalid
1504
+ return {
1505
+ environment: Object.fromEntries(entries) as Record<string, string>,
1506
+ source: { commit },
1507
+ }
1508
+ }
1509
+
1510
+ export async function readPrebuiltBuildEnvironmentRecord(
1511
+ buildOutputDirectories: readonly string[] = NEXT_BUILD_OUTPUT_DIRECTORIES,
1512
+ ): Promise<PrebuiltBuildEnvironmentRecord | null> {
1513
+ const directory = await findNextBuildOutputDirectory(buildOutputDirectories)
1514
+ if (!directory) return null
1515
+ const recordPath = path.join(directory, PREBUILT_BUILD_ENV_RECORD_FILE)
1516
+ let raw: string
1517
+ try {
1518
+ raw = await readFile(recordPath, 'utf8')
1519
+ } catch (error) {
1520
+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null
1521
+ throw error
1522
+ }
1523
+ return { recordPath, ...parsePrebuiltBuildEnvironmentRecord(raw, recordPath) }
1524
+ }
1525
+
1526
+ export async function assertPrebuiltArtifactsUsable(options: {
1527
+ runtimeEnvironment: NodeJS.ProcessEnv
1528
+ requirements?: PrebuiltArtifactRequirement[]
1529
+ buildOutputDirectories?: readonly string[]
1530
+ resolveSourceRevision?: () => PrebuiltSourceRevision | null
1531
+ }): Promise<void> {
1532
+ const missing = await findMissingPrebuiltArtifacts(options.requirements ?? resolvePrebuiltArtifactRequirements())
1533
+ if (missing.length > 0) {
1534
+ const details = missing.map((requirement) => `${requirement.label} (${requirement.anyOf.join(' or ')})`).join('; ')
1535
+ throw new Error(
1536
+ `[internal] ${PREBUILT_ARTIFACTS_ENV_VAR} is set but prebuilt artifacts are missing: ${details}. Build them first (yarn build:packages && yarn generate && yarn build:packages && yarn build:app && yarn mercato test record-build-env) or unset ${PREBUILT_ARTIFACTS_ENV_VAR}.`,
1537
+ )
1538
+ }
1539
+ const record = await readPrebuiltBuildEnvironmentRecord(options.buildOutputDirectories)
1540
+ if (!record) {
1541
+ throw new Error(
1542
+ `[internal] ${PREBUILT_ARTIFACTS_ENV_VAR} is set but the prebuilt app has no ${PREBUILT_BUILD_ENV_RECORD_FILE} next to its BUILD_ID. Run "yarn mercato test record-build-env" right after the app build, with the same environment, or unset ${PREBUILT_ARTIFACTS_ENV_VAR}.`,
1543
+ )
1544
+ }
1545
+ const currentSource = (options.resolveSourceRevision ?? (() => resolvePrebuiltSourceRevision()))()
1546
+ if (!currentSource) {
1547
+ throw new Error(
1548
+ `[internal] ${PREBUILT_ARTIFACTS_ENV_VAR} is set but the current source revision cannot be determined (git rev-parse HEAD / git diff HEAD failed), so the prebuilt app cannot be matched to it. Run from the git checkout or unset ${PREBUILT_ARTIFACTS_ENV_VAR}.`,
1549
+ )
1550
+ }
1551
+ if (currentSource.commit !== record.source.commit) {
1552
+ throw new Error(
1553
+ `[internal] ${PREBUILT_ARTIFACTS_ENV_VAR} is set but the prebuilt app was built from commit ${record.source.commit} and the checkout is at ${currentSource.commit}. Rebuild the artifacts from the current checkout or unset ${PREBUILT_ARTIFACTS_ENV_VAR}.`,
1554
+ )
1555
+ }
1556
+ if (currentSource.changedFiles.length > 0) {
1557
+ console.warn(
1558
+ `[integration] ${PREBUILT_ARTIFACTS_ENV_VAR}: the checkout has uncommitted changes the prebuilt app does not include: ${describeChangedFiles(currentSource.changedFiles)}.`,
1559
+ )
1560
+ }
1561
+ const bakedAppUrl = Array.from(PREBUILT_RUNTIME_ONLY_PUBLIC_KEYS)
1562
+ .filter((key) => (record.environment[key] ?? '').length > 0)
1563
+ if (bakedAppUrl.length > 0) {
1564
+ const details = bakedAppUrl.map((key) => `${key} (built "${record.environment[key]}")`).join('; ')
1565
+ throw new Error(
1566
+ `[internal] ${PREBUILT_ARTIFACTS_ENV_VAR} is set but the prebuilt app inlined a fixed app URL: ${details}. The runner serves the app on a per-run port, so rebuild with it unset or unset ${PREBUILT_ARTIFACTS_ENV_VAR}.`,
1567
+ )
1568
+ }
1569
+ const mismatches = findPrebuiltBuildEnvironmentMismatches(record.environment, options.runtimeEnvironment)
1570
+ if (mismatches.length > 0) {
1571
+ const details = mismatches
1572
+ .map((key) => `${key} (built "${record.environment[key] ?? ''}", runner "${options.runtimeEnvironment[key] ?? ''}")`)
1573
+ .join('; ')
1574
+ throw new Error(
1575
+ `[internal] ${PREBUILT_ARTIFACTS_ENV_VAR} is set but the prebuilt app was built with different build-shaping environment than the integration runner uses: ${details}. Rebuild the artifacts with the runner values or unset ${PREBUILT_ARTIFACTS_ENV_VAR}.`,
1576
+ )
1577
+ }
1578
+ }
1579
+
1580
+ export type EphemeralBuildDecision = {
1581
+ mode: 'prebuilt' | 'cached' | 'rebuild'
1582
+ sourceFingerprint: string | null
1583
+ shouldPersistBuildCache: boolean
1584
+ }
1585
+
1586
+ export type EphemeralBuildDecisionDependencies = {
1587
+ assertPrebuiltArtifactsUsable?: typeof assertPrebuiltArtifactsUsable
1588
+ buildSourceFingerprint?: () => Promise<string | null>
1589
+ shouldRebuildBuildArtifacts?: typeof shouldRebuildBuildArtifacts
1590
+ }
1591
+
1592
+ export async function resolveEphemeralBuildDecision(
1593
+ options: {
1594
+ logPrefix: string
1595
+ forceRebuild: boolean
1596
+ buildCacheTtlSeconds: number
1597
+ environmentFingerprint: string
1598
+ buildToolEnvironment: NodeJS.ProcessEnv
1599
+ prebuiltArtifactsRequested: boolean
1600
+ },
1601
+ dependencies: EphemeralBuildDecisionDependencies = {},
1602
+ ): Promise<EphemeralBuildDecision> {
1603
+ if (options.prebuiltArtifactsRequested && options.forceRebuild) {
1604
+ console.log(`[${options.logPrefix}] --force-rebuild overrides ${PREBUILT_ARTIFACTS_ENV_VAR}.`)
1605
+ }
1606
+ if (options.prebuiltArtifactsRequested && !options.forceRebuild) {
1607
+ await (dependencies.assertPrebuiltArtifactsUsable ?? assertPrebuiltArtifactsUsable)({
1608
+ runtimeEnvironment: options.buildToolEnvironment,
1609
+ })
1610
+ return { mode: 'prebuilt', sourceFingerprint: null, shouldPersistBuildCache: false }
1611
+ }
1612
+ try {
1613
+ const sourceFingerprint = await (dependencies.buildSourceFingerprint ?? (() => buildSourceFingerprint()))()
1614
+ const needsBuild = options.forceRebuild
1615
+ ? true
1616
+ : await (dependencies.shouldRebuildBuildArtifacts ?? shouldRebuildBuildArtifacts)(
1617
+ options.buildCacheTtlSeconds,
1618
+ options.logPrefix,
1619
+ {
1620
+ environmentFingerprint: options.environmentFingerprint,
1621
+ precomputedSourceFingerprint: sourceFingerprint ?? undefined,
1622
+ },
1623
+ )
1624
+ return { mode: needsBuild ? 'rebuild' : 'cached', sourceFingerprint, shouldPersistBuildCache: true }
1625
+ } catch (error) {
1626
+ const message = error instanceof Error ? error.message : String(error)
1627
+ console.warn(`[${options.logPrefix}] Build cache check failed (${message}). Rebuilding with cache bypass.`)
1628
+ return { mode: 'rebuild', sourceFingerprint: null, shouldPersistBuildCache: false }
1629
+ }
1630
+ }
1631
+
1632
+ export async function runRecordPrebuiltBuildEnvironment(args: string[] = []): Promise<void> {
1633
+ if (args.length > 0) {
1634
+ throw new Error(`[internal] record-build-env takes no arguments (received: ${args.join(' ')}).`)
1635
+ }
1636
+ const { recordPath, environment, source } = await writePrebuiltBuildEnvironmentRecord()
1637
+ const keys = Object.keys(environment)
1638
+ console.log(`[integration] Recorded the build environment in ${recordPath} (${keys.length > 0 ? keys.join(', ') : 'no build-shaping values set'}; source ${source.commit}).`)
1639
+ }
1640
+
1303
1641
  async function getFreePort(): Promise<number> {
1304
1642
  const tryListen = (host: string): Promise<number | null> => new Promise((resolve, reject) => {
1305
1643
  const server = createServer()
@@ -2294,6 +2632,8 @@ function buildReusableEnvironment(
2294
2632
  // adapters run end-to-end. Unlike `push_stub` (which replaces the whole adapter),
2295
2633
  // this replaces only each SDK client. Mirrors the fresh-environment env below.
2296
2634
  OM_PUSH_FAKE_PROVIDERS: process.env.OM_PUSH_FAKE_PROVIDERS ?? '1',
2635
+ // Network-free Shopify Admin API fake for sync_shopify import integration tests.
2636
+ OM_SYNC_SHOPIFY_FAKE_API: process.env.OM_SYNC_SHOPIFY_FAKE_API ?? '1',
2297
2637
  // Expo's receipt reaper ignores rows younger than 15 minutes by default, which no
2298
2638
  // integration test can wait out. Poll immediately instead.
2299
2639
  OM_PUSH_RECEIPT_MIN_AGE_MINUTES: process.env.OM_PUSH_RECEIPT_MIN_AGE_MINUTES ?? '0',
@@ -3925,6 +4265,8 @@ export async function startEphemeralEnvironment(options: EphemeralRuntimeOptions
3925
4265
  // registered only under this flag. Applies to the app server, the Playwright process, and any
3926
4266
  // drain/worker child that inherits this environment.
3927
4267
  OM_PUSH_FAKE_PROVIDERS: process.env.OM_PUSH_FAKE_PROVIDERS ?? '1',
4268
+ // Network-free Shopify Admin API fake for sync_shopify import integration tests.
4269
+ OM_SYNC_SHOPIFY_FAKE_API: process.env.OM_SYNC_SHOPIFY_FAKE_API ?? '1',
3928
4270
  // Expo's receipt reaper ignores rows younger than 15 minutes by default (it polls a real
3929
4271
  // provider's async receipts). No integration test can wait that out — poll immediately.
3930
4272
  OM_PUSH_RECEIPT_MIN_AGE_MINUTES: process.env.OM_PUSH_RECEIPT_MIN_AGE_MINUTES ?? '0',
@@ -3947,6 +4289,12 @@ export async function startEphemeralEnvironment(options: EphemeralRuntimeOptions
3947
4289
  // var at the workflow level, masking the gap). Keep in sync with the
3948
4290
  // Playwright-process env block above.
3949
4291
  MOCK_INBOUND_WEBHOOK_SECRET: 'open-mercato-mock-dev-inbound-webhook-secret',
4292
+ // The communication_channels hub fails closed under NODE_ENV=production
4293
+ // instead of deriving the OAuth state-cookie key from JWT_SECRET
4294
+ // (lib/oauth-state.ts), so without a dedicated key every provider's
4295
+ // happy-path `/oauth/<provider>/initiate` 500s in this runtime. Test-only
4296
+ // value; real deployments set OM_HUB_OAUTH_STATE_KEY or KMS_MASTER_KEY.
4297
+ OM_HUB_OAUTH_STATE_KEY: process.env.OM_HUB_OAUTH_STATE_KEY ?? 'om-ephemeral-integration-oauth-state-key',
3950
4298
  NEXT_PUBLIC_UMES_DEVTOOLS: 'true',
3951
4299
  CI: 'true',
3952
4300
  TENANT_DATA_ENCRYPTION_FALLBACK_KEY: process.env.TENANT_DATA_ENCRYPTION_FALLBACK_KEY ?? 'om-ephemeral-integration-fallback-key',
@@ -4035,36 +4383,27 @@ export async function startEphemeralEnvironment(options: EphemeralRuntimeOptions
4035
4383
  const buildCacheTtlSeconds = resolveBuildCacheTtlSeconds(options.logPrefix)
4036
4384
  const environmentFingerprint = buildEnvironmentFingerprint(commandEnvironment)
4037
4385
  const buildToolEnvironment = withoutCoverageEnvironment(commandEnvironment)
4038
- let sourceFingerprintValue: string | null = null
4039
- let needsBuild = true
4040
- let shouldPersistBuildCache = true
4041
-
4042
- try {
4043
- sourceFingerprintValue = await buildSourceFingerprint()
4044
- needsBuild = options.forceRebuild
4045
- ? true
4046
- : await shouldRebuildBuildArtifacts(buildCacheTtlSeconds, options.logPrefix, {
4047
- environmentFingerprint,
4048
- precomputedSourceFingerprint: sourceFingerprintValue ?? undefined,
4049
- })
4050
- } catch (error) {
4051
- const message = error instanceof Error ? error.message : String(error)
4052
- shouldPersistBuildCache = false
4053
- needsBuild = true
4054
- sourceFingerprintValue = null
4055
- console.warn(
4056
- `[${options.logPrefix}] Build cache check failed (${message}). Rebuilding with cache bypass.`,
4057
- )
4058
- }
4386
+ const buildDecision = await resolveEphemeralBuildDecision({
4387
+ logPrefix: options.logPrefix,
4388
+ forceRebuild: options.forceRebuild === true,
4389
+ buildCacheTtlSeconds,
4390
+ environmentFingerprint,
4391
+ buildToolEnvironment,
4392
+ prebuiltArtifactsRequested: resolvePrebuiltArtifactsMode(),
4393
+ })
4059
4394
 
4060
4395
  console.log(`[${options.logPrefix}] Ephemeral database ready at ${databaseHost}:${databasePort}`)
4061
4396
  console.log(`[${options.logPrefix}] Initializing application data (includes migrations)...`)
4062
4397
  await runTimedStep(options.logPrefix, 'Initializing application data', { expectedSeconds: 45 }, async () =>
4063
- runYarnCommand(['initialize'], commandEnvironment, {
4398
+ runYarnCommand(['initialize'], buildEphemeralInitializationEnvironment(commandEnvironment), {
4064
4399
  silent: !options.verbose,
4065
4400
  }, appDirectory))
4066
4401
 
4067
- if (!needsBuild) {
4402
+ if (buildDecision.mode === 'prebuilt') {
4403
+ console.log(
4404
+ `[${options.logPrefix}] ${PREBUILT_ARTIFACTS_ENV_VAR} is set. Skipping build pipeline and using the prebuilt artifacts.`,
4405
+ )
4406
+ } else if (buildDecision.mode === 'cached') {
4068
4407
  console.log(
4069
4408
  `[${options.logPrefix}] Build cache valid (within ${BUILD_CACHE_TTL_ENV_VAR}=${buildCacheTtlSeconds}s). Skipping build pipeline.`,
4070
4409
  )
@@ -4109,8 +4448,8 @@ export async function startEphemeralEnvironment(options: EphemeralRuntimeOptions
4109
4448
  }, appDirectory))
4110
4449
  }
4111
4450
 
4112
- if (shouldPersistBuildCache && sourceFingerprintValue) {
4113
- await writeBuildCacheState(sourceFingerprintValue, { environmentFingerprint })
4451
+ if (buildDecision.shouldPersistBuildCache && buildDecision.sourceFingerprint) {
4452
+ await writeBuildCacheState(buildDecision.sourceFingerprint, { environmentFingerprint })
4114
4453
  }
4115
4454
 
4116
4455
  console.log(`[${options.logPrefix}] Starting application on ${applicationBaseUrl}...`)
package/src/mercato.ts CHANGED
@@ -1341,12 +1341,13 @@ export async function run(argv = process.argv) {
1341
1341
  }
1342
1342
  const orgName = findArgValue(['--org=', '--orgName='], 'Acme Corp')
1343
1343
  const derivedSecrets = resolveInitDerivedSecrets({ email, env: process.env })
1344
+ const isProduction = (process.env.NODE_ENV ?? '').trim().toLowerCase() === 'production'
1344
1345
  const adminEmailDerived = derivedSecrets.adminEmail
1345
1346
  const employeeEmailDerived = derivedSecrets.employeeEmail
1346
- if (!skipDemoUsers && adminEmailDerived && derivedSecrets.adminPassword) {
1347
+ if (!skipDemoUsers && isProduction && adminEmailDerived && derivedSecrets.adminPassword) {
1347
1348
  process.env.OM_INIT_ADMIN_PASSWORD = derivedSecrets.adminPassword
1348
1349
  }
1349
- if (!skipDemoUsers && employeeEmailDerived && derivedSecrets.employeePassword) {
1350
+ if (!skipDemoUsers && isProduction && employeeEmailDerived && derivedSecrets.employeePassword) {
1350
1351
  process.env.OM_INIT_EMPLOYEE_PASSWORD = derivedSecrets.employeePassword
1351
1352
  }
1352
1353
  // Symmetrical with the passwords above: setupInitialTenant derives admin/employee
@@ -2886,6 +2887,12 @@ export async function run(argv = process.argv) {
2886
2887
  await (await lazyIntegration()).runIntegrationSpecCoverageReport(args)
2887
2888
  },
2888
2889
  },
2890
+ {
2891
+ command: 'record-build-env',
2892
+ run: async (args: string[]) => {
2893
+ await (await lazyIntegration()).runRecordPrebuiltBuildEnvironment(args)
2894
+ },
2895
+ },
2889
2896
  ],
2890
2897
  } as any)
2891
2898