@open-mercato/cli 0.10.1-develop.8004.1.a8a79ee43f → 0.10.1-develop.8022.1.b6753de892

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 (102) hide show
  1. package/dist/agentic/guides/module-facts.json +162 -162
  2. package/dist/agentic/guides/module-facts.v2.json +162 -162
  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/carrier_inpost/index.md +1 -1
  13. package/dist/agentic/guides/modules/cart/index.md +1 -1
  14. package/dist/agentic/guides/modules/catalog/index.md +1 -1
  15. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  16. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  17. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  18. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  19. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  20. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  21. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  22. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  23. package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
  24. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  25. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  26. package/dist/agentic/guides/modules/configs/index.md +1 -1
  27. package/dist/agentic/guides/modules/content/index.md +1 -1
  28. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  29. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  30. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  31. package/dist/agentic/guides/modules/customers/index.md +1 -1
  32. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  33. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  34. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  35. package/dist/agentic/guides/modules/devices/index.md +1 -1
  36. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  37. package/dist/agentic/guides/modules/directory/index.md +1 -1
  38. package/dist/agentic/guides/modules/documents/index.md +1 -1
  39. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  40. package/dist/agentic/guides/modules/entities/index.md +1 -1
  41. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  42. package/dist/agentic/guides/modules/events/index.md +1 -1
  43. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  44. package/dist/agentic/guides/modules/forms/index.md +1 -1
  45. package/dist/agentic/guides/modules/gateway_autopay/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/promotions/index.md +1 -1
  61. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  62. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  63. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  64. package/dist/agentic/guides/modules/resources/index.md +1 -1
  65. package/dist/agentic/guides/modules/sales/index.md +1 -1
  66. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  67. package/dist/agentic/guides/modules/search/index.md +1 -1
  68. package/dist/agentic/guides/modules/security/index.md +1 -1
  69. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  70. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  71. package/dist/agentic/guides/modules/sso/index.md +1 -1
  72. package/dist/agentic/guides/modules/staff/index.md +1 -1
  73. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  74. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  75. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  76. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  77. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  78. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  79. package/dist/agentic/guides/modules/translations/index.md +1 -1
  80. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  81. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  82. package/dist/agentic/guides/modules/wms/index.md +1 -1
  83. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  84. package/dist/agentic/guides/reference-module-facts.json +1 -1
  85. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +4 -0
  86. package/dist/agentic/guides/upstream/manifest.json +2 -2
  87. package/dist/agentic/shared/ai/harness/cases.json +2 -2
  88. package/dist/agentic/shared/ai/trackers/github.md +257 -2
  89. package/dist/agentic/shared/scripts/execution-sandbox.mjs +1 -0
  90. package/dist/lib/generators/openapi.js +7 -2
  91. package/dist/lib/generators/openapi.js.map +2 -2
  92. package/dist/lib/telemetry-init.js +1 -1
  93. package/dist/lib/telemetry-init.js.map +1 -1
  94. package/dist/lib/testing/integration.js +22 -0
  95. package/dist/lib/testing/integration.js.map +2 -2
  96. package/package.json +7 -7
  97. package/src/lib/__tests__/telemetry-init.test.ts +1 -1
  98. package/src/lib/generators/__tests__/openapi.test.ts +24 -0
  99. package/src/lib/generators/openapi.ts +7 -2
  100. package/src/lib/telemetry-init.ts +1 -1
  101. package/src/lib/testing/__tests__/integration.test.ts +24 -0
  102. package/src/lib/testing/integration.ts +23 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/cli",
3
- "version": "0.10.1-develop.8004.1.a8a79ee43f",
3
+ "version": "0.10.1-develop.8022.1.b6753de892",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,10 +60,10 @@
60
60
  "@mikro-orm/decorators": "^7.1.14",
61
61
  "@mikro-orm/migrations": "^7.1.14",
62
62
  "@mikro-orm/postgresql": "^7.1.14",
63
- "@open-mercato/events": "0.10.1-develop.8004.1.a8a79ee43f",
64
- "@open-mercato/queue": "0.10.1-develop.8004.1.a8a79ee43f",
65
- "@open-mercato/shared": "0.10.1-develop.8004.1.a8a79ee43f",
66
- "@open-mercato/telemetry": "0.10.1-develop.8004.1.a8a79ee43f",
63
+ "@open-mercato/events": "0.10.1-develop.8022.1.b6753de892",
64
+ "@open-mercato/queue": "0.10.1-develop.8022.1.b6753de892",
65
+ "@open-mercato/shared": "0.10.1-develop.8022.1.b6753de892",
66
+ "@open-mercato/telemetry": "0.10.1-develop.8022.1.b6753de892",
67
67
  "cross-spawn": "^7.0.6",
68
68
  "minisearch": "7.2.0",
69
69
  "pg": "8.23.0",
@@ -75,10 +75,10 @@
75
75
  "typescript-js": "npm:typescript@6.0.3"
76
76
  },
77
77
  "peerDependencies": {
78
- "@open-mercato/shared": "0.10.1-develop.8004.1.a8a79ee43f"
78
+ "@open-mercato/shared": "0.10.1-develop.8022.1.b6753de892"
79
79
  },
80
80
  "devDependencies": {
81
- "@open-mercato/shared": "0.10.1-develop.8004.1.a8a79ee43f",
81
+ "@open-mercato/shared": "0.10.1-develop.8022.1.b6753de892",
82
82
  "@types/jest": "^30.0.0",
83
83
  "jest": "^30.4.2",
84
84
  "ts-jest": "^29.4.12"
@@ -164,7 +164,7 @@ describe('mercato telemetry init', () => {
164
164
 
165
165
  const pkg = JSON.parse(read('package.json'))
166
166
  expect(pkg.dependencies['@open-mercato/telemetry']).toBe('1.2.3')
167
- expect(pkg.optionalDependencies['bullmq-otel']).toBe('^1.3.1')
167
+ expect(pkg.optionalDependencies['bullmq-otel']).toBe('^2.0.1')
168
168
 
169
169
  expect(read('.env.example')).toContain('TELEMETRY_BACKEND')
170
170
  expect(read('.env.example')).toContain('OTEL_EXPORTER_OTLP_ENDPOINT')
@@ -160,6 +160,30 @@ export function buildOpenApiDocument(modules: any[], options: any) {
160
160
  expect(openApiDoc.paths['/api/demo/details']?.get?.summary).toBe('package details')
161
161
  })
162
162
 
163
+ it('bundles into a per-run file and leaves no bundle behind', async () => {
164
+ touchFile(
165
+ path.join(tmpDir, 'packages', 'core', 'src', 'modules', 'demo', 'api', 'health', 'route.ts'),
166
+ [
167
+ 'export async function GET() { return new Response("pkg-health") }',
168
+ 'export const openApi = {',
169
+ " GET: { summary: 'package health' }",
170
+ '}',
171
+ '',
172
+ ].join('\n'),
173
+ )
174
+ const cacheDir = path.join(tmpDir, 'node_modules', '.cache')
175
+ touchFile(path.join(cacheDir, '_openapi-bundle.mjs'), 'export {}\n')
176
+
177
+ const result = await generateOpenApi({ resolver: createMockResolver([{ id: 'demo', from: '@open-mercato/core' }]), quiet: true })
178
+
179
+ expect(result.errors).toEqual([])
180
+ const openApiDoc = JSON.parse(
181
+ fs.readFileSync(path.join(tmpDir, 'output', 'generated', 'openapi.generated.json'), 'utf8'),
182
+ ) as { paths: Record<string, { get?: { summary?: string } }> }
183
+ expect(openApiDoc.paths['/api/demo/health']?.get?.summary).toBe('package health')
184
+ expect(fs.readdirSync(cacheDir).filter((name) => name.startsWith('_openapi-bundle'))).toEqual([])
185
+ })
186
+
163
187
  it('skips route discovery and bundling when all tracked inputs are unchanged', async () => {
164
188
  touchFile(
165
189
  path.join(tmpDir, 'packages', 'core', 'src', 'modules', 'demo', 'api', 'health', 'route.ts'),
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import * as fs from 'node:fs'
10
+ import { randomBytes } from 'node:crypto'
10
11
  import * as path from 'node:path'
11
12
  import type { ModuleEntry, PackageResolver } from '../resolver'
12
13
  import { getEnabledModuleIdentities } from '../module-identity'
@@ -340,7 +341,10 @@ async function generateOpenApiViaBundle(
340
341
  const cacheDir = path.join(rootDir, 'node_modules', '.cache')
341
342
  if (!fs.existsSync(cacheDir)) fs.mkdirSync(cacheDir, { recursive: true })
342
343
 
343
- const bundlePath = path.join(cacheDir, '_openapi-bundle.mjs')
344
+ // Per-run file: `yarn dev`'s watcher and a CLI `generate` (e.g. after
345
+ // create-mercato-module init) can bundle concurrently, and a shared path let
346
+ // one process execute the other's half-written bundle ("Unexpected end of input").
347
+ const bundlePath = path.join(cacheDir, `_openapi-bundle-${process.pid}-${randomBytes(6).toString('hex')}.mjs`)
344
348
  let inputPaths: string[] = []
345
349
 
346
350
  // Build the entry script that imports all routes and calls buildOpenApiDocument
@@ -607,7 +611,8 @@ process.stdout.write(JSON.stringify(deepClone(doc), (_, v) =>
607
611
  // process exit when a plugin request is still in flight.
608
612
  try { await esbuild.stop() } catch {}
609
613
  // Clean up old files from previous tsx-based approach
610
- for (const file of ['_openapi-register.mjs', '_openapi-loader.mjs', '_next-stub.cjs']) {
614
+ try { fs.unlinkSync(bundlePath) } catch {}
615
+ for (const file of ['_openapi-bundle.mjs', '_openapi-register.mjs', '_openapi-loader.mjs', '_next-stub.cjs']) {
611
616
  try { fs.unlinkSync(path.join(cacheDir, file)) } catch {}
612
617
  }
613
618
  }
@@ -23,7 +23,7 @@ import { dirname, join, resolve } from 'node:path'
23
23
  * `@open-mercato/cli`'s telemetry dependency once the app updates its packages.
24
24
  */
25
25
 
26
- const BULLMQ_OTEL_VERSION = '^1.3.1'
26
+ const BULLMQ_OTEL_VERSION = '^2.0.1'
27
27
 
28
28
  type StepStatus = 'created' | 'patched' | 'skipped' | 'manual'
29
29
 
@@ -17,6 +17,7 @@ import {
17
17
  resolveAppReadyTimeoutMs,
18
18
  resolveEphemeralPostgresImage,
19
19
  resolveEphemeralJwtSecret,
20
+ resolveEphemeralSuperadminPassword,
20
21
  ephemeralPostgresInitSql,
21
22
  shouldReuseBuildArtifacts,
22
23
  acquireEphemeralRuntimeLock,
@@ -30,6 +31,7 @@ import {
30
31
  } from '../integration'
31
32
  import type { CapturedOutputProcess, ShutdownProcessRef } from '../integration'
32
33
  import { resolveSpawnCommand } from '../../spawn'
34
+ import { resolveInitSuperadminCredentials } from '../../init-secrets'
33
35
  import { EventEmitter } from 'node:events'
34
36
  import { spawn } from 'node:child_process'
35
37
  import type { ChildProcess } from 'node:child_process'
@@ -510,6 +512,28 @@ describe('integration cache and options', () => {
510
512
  )
511
513
  })
512
514
 
515
+ it('supplies a production-valid superadmin password when the inherited one is missing or a placeholder', () => {
516
+ const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => undefined)
517
+ try {
518
+ const fallback = resolveEphemeralSuperadminPassword({})
519
+ expect(fallback).toBe('Om-Ephemeral-Superadmin-2026!')
520
+ expect(() =>
521
+ resolveInitSuperadminCredentials([], { NODE_ENV: 'production', OM_INIT_SUPERADMIN_PASSWORD: fallback }),
522
+ ).not.toThrow()
523
+ expect(warnSpy).not.toHaveBeenCalled()
524
+ expect(resolveEphemeralSuperadminPassword({ OM_INIT_SUPERADMIN_PASSWORD: 'secret' })).toBe(fallback)
525
+ expect(warnSpy).toHaveBeenCalledTimes(1)
526
+ } finally {
527
+ warnSpy.mockRestore()
528
+ }
529
+ })
530
+
531
+ it('keeps a production-valid operator-provided superadmin password', () => {
532
+ expect(resolveEphemeralSuperadminPassword({ OM_INIT_SUPERADMIN_PASSWORD: 'Operator-Chosen-Pass-42!' })).toBe(
533
+ 'Operator-Chosen-Pass-42!',
534
+ )
535
+ })
536
+
513
537
  it('creates the vector and pgcrypto extensions in the ephemeral init SQL', () => {
514
538
  const sql = ephemeralPostgresInitSql()
515
539
  expect(sql).toContain('CREATE EXTENSION IF NOT EXISTS vector')
@@ -11,6 +11,7 @@ import spawn from 'cross-spawn'
11
11
  import { fetchWithTimeout, type FetchWithTimeoutInit } from '@open-mercato/shared/lib/http/fetchWithTimeout'
12
12
  import { isUnsafeJwtSecret } from '@open-mercato/shared/lib/auth/jwt'
13
13
  import { resolveEnvironment } from '../resolver'
14
+ import { resolveInitSuperadminCredentials } from '../init-secrets'
14
15
  import { resolveSpawnCommand } from '../spawn'
15
16
  import { discoverIntegrationSpecFiles as discoverIntegrationSpecFilesShared } from './integration-discovery'
16
17
  import { resolveDockerHostFromContext, runCommandAndCapture } from './runtime-utils'
@@ -202,6 +203,23 @@ export function resolveEphemeralJwtSecret(env: NodeJS.ProcessEnv = process.env):
202
203
  }
203
204
  return DEFAULT_EPHEMERAL_JWT_SECRET
204
205
  }
206
+ const DEFAULT_EPHEMERAL_SUPERADMIN_PASSWORD = 'Om-Ephemeral-Superadmin-2026!'
207
+
208
+ export function resolveEphemeralSuperadminPassword(env: NodeJS.ProcessEnv = process.env): string {
209
+ const inherited = env.OM_INIT_SUPERADMIN_PASSWORD
210
+ if (inherited !== undefined && inherited.trim().length > 0) {
211
+ try {
212
+ resolveInitSuperadminCredentials([], { ...env, NODE_ENV: 'production', OM_INIT_SUPERADMIN_PASSWORD: inherited })
213
+ return inherited
214
+ } catch {
215
+ console.warn(
216
+ '[integration] Ignoring the inherited OM_INIT_SUPERADMIN_PASSWORD: it is a placeholder or fails the password policy and the ephemeral app initializes with NODE_ENV=production. Using the ephemeral default instead.',
217
+ )
218
+ }
219
+ }
220
+ return DEFAULT_EPHEMERAL_SUPERADMIN_PASSWORD
221
+ }
222
+
205
223
  const PLAYWRIGHT_ENV_UNAVAILABLE_PATTERNS: RegExp[] = [
206
224
  /net::ERR_CONNECTION_REFUSED/i,
207
225
  /Failed to connect to .* (localhost|127\.0\.0\.1)/i,
@@ -2197,6 +2215,7 @@ function buildReusableEnvironment(
2197
2215
  // OM_INIT_*_PASSWORD to fix the seeded credential.
2198
2216
  OM_INIT_ADMIN_PASSWORD: process.env.OM_INIT_ADMIN_PASSWORD ?? 'secret',
2199
2217
  OM_INIT_EMPLOYEE_PASSWORD: process.env.OM_INIT_EMPLOYEE_PASSWORD ?? 'secret',
2218
+ OM_INIT_SUPERADMIN_PASSWORD: resolveEphemeralSuperadminPassword(),
2200
2219
  OM_INTEGRATION_TEST: 'true',
2201
2220
  OM_ENABLE_ENTERPRISE_MODULES: enterpriseModulesFlag,
2202
2221
  OM_ENABLE_ENTERPRISE_MODULES_SSO: process.env.OM_ENABLE_ENTERPRISE_MODULES_SSO ?? enterpriseModulesFlag,
@@ -3585,6 +3604,10 @@ export async function startEphemeralEnvironment(options: EphemeralRuntimeOptions
3585
3604
  // NODE_ENV=production.
3586
3605
  OM_INIT_ADMIN_PASSWORD: process.env.OM_INIT_ADMIN_PASSWORD ?? 'secret',
3587
3606
  OM_INIT_EMPLOYEE_PASSWORD: process.env.OM_INIT_EMPLOYEE_PASSWORD ?? 'secret',
3607
+ // Production init refuses a missing or placeholder superadmin password
3608
+ // (#8896). Integration auth helpers read OM_INIT_SUPERADMIN_PASSWORD, so
3609
+ // the Playwright runner logs in with the same value.
3610
+ OM_INIT_SUPERADMIN_PASSWORD: resolveEphemeralSuperadminPassword(),
3588
3611
  // Pool sizing for the ephemeral integration runtime. Defaults were once
3589
3612
  // very aggressive (max=5, idle=1000) which exposed flaky 'timeout exceeded
3590
3613
  // when trying to connect' errors on `progressService.createJob`-backed