@open-mercato/cli 0.10.1-develop.8292.1.59f204debc → 0.10.1

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 (106) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/agentic/guides/module-facts.json +278 -206
  3. package/dist/agentic/guides/module-facts.v2.json +278 -206
  4. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  5. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  6. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  7. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  8. package/dist/agentic/guides/modules/attachments/di-registrations-rich.md +6 -6
  9. package/dist/agentic/guides/modules/attachments/di-service-tokens.md +5 -5
  10. package/dist/agentic/guides/modules/attachments/exact-override-targets.md +6 -6
  11. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  12. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  13. package/dist/agentic/guides/modules/auth/index.md +1 -1
  14. package/dist/agentic/guides/modules/availability/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/index.md +1 -1
  19. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  20. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  21. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  22. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  23. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  24. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  25. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  26. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  27. package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
  28. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  29. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  30. package/dist/agentic/guides/modules/configs/index.md +1 -1
  31. package/dist/agentic/guides/modules/content/index.md +1 -1
  32. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  33. package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +4 -4
  34. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  35. package/dist/agentic/guides/modules/customer_accounts/setup.md +1 -1
  36. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  37. package/dist/agentic/guides/modules/customers/di-registrations-rich.md +6 -5
  38. package/dist/agentic/guides/modules/customers/exact-override-targets.md +6 -5
  39. package/dist/agentic/guides/modules/customers/index.md +2 -2
  40. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  41. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  42. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  43. package/dist/agentic/guides/modules/devices/index.md +1 -1
  44. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  45. package/dist/agentic/guides/modules/directory/index.md +1 -1
  46. package/dist/agentic/guides/modules/documents/index.md +1 -1
  47. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  48. package/dist/agentic/guides/modules/entities/cli-commands.md +1 -0
  49. package/dist/agentic/guides/modules/entities/exact-override-targets.md +1 -0
  50. package/dist/agentic/guides/modules/entities/index.md +1 -1
  51. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  52. package/dist/agentic/guides/modules/events/index.md +1 -1
  53. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  54. package/dist/agentic/guides/modules/forms/index.md +1 -1
  55. package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
  56. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  57. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  58. package/dist/agentic/guides/modules/generators/index.md +1 -1
  59. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  60. package/dist/agentic/guides/modules/integrations/index.md +1 -1
  61. package/dist/agentic/guides/modules/messages/index.md +1 -1
  62. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  63. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  64. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  65. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  66. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  67. package/dist/agentic/guides/modules/planner/index.md +1 -1
  68. package/dist/agentic/guides/modules/portal/index.md +1 -1
  69. package/dist/agentic/guides/modules/progress/index.md +1 -1
  70. package/dist/agentic/guides/modules/promotions/index.md +1 -1
  71. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  72. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  73. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  74. package/dist/agentic/guides/modules/resources/index.md +1 -1
  75. package/dist/agentic/guides/modules/sales/index.md +1 -1
  76. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  77. package/dist/agentic/guides/modules/search/index.md +1 -1
  78. package/dist/agentic/guides/modules/security/index.md +1 -1
  79. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  80. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  81. package/dist/agentic/guides/modules/sso/index.md +1 -1
  82. package/dist/agentic/guides/modules/staff/di-registrations-rich.md +8 -8
  83. package/dist/agentic/guides/modules/staff/exact-override-targets.md +8 -8
  84. package/dist/agentic/guides/modules/staff/index.md +1 -1
  85. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  86. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  87. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  88. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  89. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  90. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  91. package/dist/agentic/guides/modules/translations/index.md +1 -1
  92. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  93. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  94. package/dist/agentic/guides/modules/wms/index.md +1 -1
  95. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  96. package/dist/agentic/guides/reference-module-facts.json +1 -1
  97. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +12 -0
  98. package/dist/agentic/guides/upstream/manifest.json +2 -2
  99. package/dist/agentic/shared/ai/harness/cases.json +4 -4
  100. package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.9.0-to-0.10.0/SKILL.md +269 -0
  101. package/dist/agentic/shared/ai/skills/tiers.json +2 -1
  102. package/dist/lib/module-inspection.js +19 -3
  103. package/dist/lib/module-inspection.js.map +2 -2
  104. package/package.json +8 -9
  105. package/src/lib/__tests__/module-inspection.test.ts +72 -0
  106. package/src/lib/module-inspection.ts +23 -3
@@ -184,6 +184,78 @@ describe('module artifact inspection', () => {
184
184
  expect(fs.existsSync(temporaryConfig!)).toBe(false)
185
185
  })
186
186
 
187
+ function mockYarnConfigOutput(output: Record<string, string>, onPack: (args: readonly string[], npmrc: string) => void) {
188
+ jest.spyOn(childProcess, 'execFileSync').mockImplementation((_command, args) => args?.[0] === '-xOf'
189
+ ? JSON.stringify({ name: '@vendor/example', version: '1.2.3' })
190
+ : 'package/src/modules/example/index.ts\npackage/dist/modules/example/index.js\n')
191
+ jest.spyOn(spawn, 'sync').mockImplementation((command, args) => {
192
+ if (command === 'yarn' || command === 'yarn.cmd') return { status: 0, stdout: output[String(args?.[2])], stderr: '', pid: 1, output: [], signal: null }
193
+ const values = args ?? []
194
+ onPack(values, fs.readFileSync(String(values[values.indexOf('--userconfig') + 1]), 'utf8'))
195
+ return { status: 0, stdout: JSON.stringify([{ name: '@vendor/example', version: '1.2.3', filename: 'candidate.tgz' }]), stderr: '', pid: 1, output: [], signal: null }
196
+ })
197
+ }
198
+
199
+ it.each([
200
+ ['undefined', 'undefined\n'],
201
+ ['empty', ''],
202
+ ])('treats %s Yarn output for unset npmScopes and npmRegistries as not set', (_label, unset) => {
203
+ fs.writeFileSync(path.join(root, '.yarnrc.yml'), 'nodeLinker: node-modules\n')
204
+ let packArgs: readonly string[] = []
205
+ let npmrc = ''
206
+ mockYarnConfigOutput({
207
+ npmRegistryServer: '"https://registry.yarnpkg.com"\n',
208
+ npmScopes: unset,
209
+ npmRegistries: unset,
210
+ npmAuthToken: 'null\n',
211
+ npmAuthIdent: 'null\n',
212
+ }, (args, config) => { packArgs = args; npmrc = config })
213
+ expect(inspectNpmModuleTarget('@vendor/example@1.2.3', '@vendor/example', root)).toMatchObject({ version: '1.2.3', moduleIds: ['example'] })
214
+ expect(packArgs).toEqual(expect.arrayContaining(['--registry', 'https://registry.yarnpkg.com', '--@vendor:registry=https://registry.yarnpkg.com']))
215
+ expect(npmrc).toContain('registry="https://registry.yarnpkg.com"')
216
+ expect(npmrc).not.toContain('_auth')
217
+ })
218
+
219
+ it('keeps top-level Yarn authentication when npmScopes and npmRegistries are unset', () => {
220
+ fs.writeFileSync(path.join(root, '.yarnrc.yml'), 'nodeLinker: node-modules\n')
221
+ let npmrc = ''
222
+ mockYarnConfigOutput({
223
+ npmRegistryServer: '"https://registry.yarnpkg.com"\n',
224
+ npmScopes: 'undefined\n',
225
+ npmRegistries: 'undefined\n',
226
+ npmAuthToken: '"test-token-do-not-print"\n',
227
+ npmAuthIdent: 'null\n',
228
+ }, (_args, config) => { npmrc = config })
229
+ expect(inspectNpmModuleTarget('@vendor/example@1.2.3', '@vendor/example', root).version).toBe('1.2.3')
230
+ expect(npmrc).toContain('//registry.yarnpkg.com/:_authToken="test-token-do-not-print"')
231
+ })
232
+
233
+ it('still fails closed on malformed Yarn configuration output', () => {
234
+ fs.writeFileSync(path.join(root, '.yarnrc.yml'), 'nodeLinker: node-modules\n')
235
+ mockYarnConfigOutput({
236
+ npmRegistryServer: '"https://registry.yarnpkg.com"\n',
237
+ npmScopes: 'not json test-token-do-not-print',
238
+ npmRegistries: 'undefined\n',
239
+ npmAuthToken: 'null\n',
240
+ npmAuthIdent: 'null\n',
241
+ }, () => { throw new Error('npm pack must not run') })
242
+ expect(() => inspectNpmModuleTarget('@vendor/example@1.2.3', '@vendor/example', root)).toThrow('while trying to read the project registry configuration. Yarn setting npmScopes returned output that is not JSON.')
243
+ try { inspectNpmModuleTarget('@vendor/example@1.2.3', '@vendor/example', root) } catch (error) {
244
+ expect(String(error)).not.toContain('test-token-do-not-print')
245
+ }
246
+ })
247
+
248
+ it('names the Yarn setting and exit code when yarn config get fails, without exposing its output', () => {
249
+ fs.writeFileSync(path.join(root, '.yarnrc.yml'), 'nodeLinker: node-modules\n')
250
+ jest.spyOn(spawn, 'sync').mockImplementation((_command, args) => args?.[2] === 'npmRegistries'
251
+ ? { status: 1, stdout: 'test-token-do-not-print', stderr: 'test-token-do-not-print', pid: 1, output: [], signal: null }
252
+ : { status: 0, stdout: 'undefined\n', stderr: '', pid: 1, output: [], signal: null })
253
+ expect(() => inspectNpmModuleTarget('@vendor/example@1.2.3', '@vendor/example', root)).toThrow('Yarn setting npmRegistries could not be read (exit 1).')
254
+ try { inspectNpmModuleTarget('@vendor/example@1.2.3', '@vendor/example', root) } catch (error) {
255
+ expect(String(error)).not.toContain('test-token-do-not-print')
256
+ }
257
+ })
258
+
187
259
  it('fails closed on unavailable inspection without exposing private tool output', () => {
188
260
  jest.spyOn(spawn, 'sync').mockImplementation(() => { throw new Error('private registry token') })
189
261
  expect(() => inspectNpmModuleTarget('@vendor/example@next', '@vendor/example', root)).toThrow('No package was installed')
@@ -63,6 +63,26 @@ function isModernYarnProject(appDir: string): boolean {
63
63
  }
64
64
  }
65
65
 
66
+ const YARN_SETTING_UNREADABLE = 'YARN_SETTING_UNREADABLE'
67
+
68
+ function yarnSettingError(message: string): Error {
69
+ return Object.assign(new Error(message), { code: YARN_SETTING_UNREADABLE })
70
+ }
71
+
72
+ function isYarnSettingError(error: unknown): error is Error {
73
+ return error instanceof Error && 'code' in error && error.code === YARN_SETTING_UNREADABLE
74
+ }
75
+
76
+ function parseYarnConfigValue(setting: string, stdout: string): unknown {
77
+ const output = stdout.trim()
78
+ if (output === '' || output === 'undefined') return undefined
79
+ try {
80
+ return JSON.parse(output)
81
+ } catch {
82
+ throw yarnSettingError(`Yarn setting ${setting} returned output that is not JSON.`)
83
+ }
84
+ }
85
+
66
86
  function yarnNpmConfiguration(appDir: string, packageName: string, temporaryDir: string): string[] {
67
87
  if (!isModernYarnProject(appDir)) return []
68
88
  const settings = new Map<string, unknown>()
@@ -70,8 +90,8 @@ function yarnNpmConfiguration(appDir: string, packageName: string, temporaryDir:
70
90
  const result = spawn.sync(process.platform === 'win32' ? 'yarn.cmd' : 'yarn', ['config', 'get', setting, '--json', '--no-redacted'], {
71
91
  cwd: appDir, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 15_000,
72
92
  })
73
- if (result.error || result.status !== 0) throw new Error('Cannot inspect project package registry configuration')
74
- settings.set(setting, JSON.parse(result.stdout))
93
+ if (result.error || result.status !== 0) throw yarnSettingError(`Yarn setting ${setting} could not be read (exit ${result.status ?? 'none'}).`)
94
+ settings.set(setting, parseYarnConfigValue(setting, result.stdout))
75
95
  }
76
96
  const scope = packageName.startsWith('@') ? packageName.slice(1).split('/')[0] : undefined
77
97
  const scopeSettings = scope ? record(record(settings.get('npmScopes'))[scope]) : {}
@@ -125,7 +145,7 @@ export function inspectNpmModuleTarget(packageSpec: string, packageName: string,
125
145
  if (inspected.version !== packed.version) throw new Error('Packed artifact version disagrees with resolution')
126
146
  return { packageName, packageSpec, ...inspected, locator: `npm:${packageName}` }
127
147
  } catch (error) {
128
- const safeDetail = isModulePackageExportError(error) && error instanceof Error ? ` ${error.message}` : ''
148
+ const safeDetail = (isModulePackageExportError(error) || isYarnSettingError(error)) && error instanceof Error ? ` ${error.message}` : ''
129
149
  throw new Error(`Cannot inspect the exact module artifact for "${packageName}" while trying to ${inspectionStep}.${safeDetail} Check project registry credentials, package access and shipped src/dist module descriptors before retrying. No package was installed.`)
130
150
  } finally {
131
151
  fs.rmSync(temporaryDir, { recursive: true, force: true })