peachsim 0.1.2411 → 0.1.2421

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 (146) hide show
  1. package/README.md +1 -1
  2. package/cli/catalog/content.ts +6 -3
  3. package/cli/catalog/meta.ts +63 -17
  4. package/cli/catalog/routes.ts +4 -0
  5. package/cli/cloud-box-artifact.ts +45 -24
  6. package/cli/cloud-client.ts +6 -2
  7. package/cli/command-registry.ts +3 -1
  8. package/cli/commands/control.ts +74 -55
  9. package/cli/commands/desktop.ts +3 -3
  10. package/cli/commands/electron.ts +7 -5
  11. package/cli/commands/kotlin.ts +8 -1
  12. package/cli/commands/platform.ts +5 -7
  13. package/cli/commands/profile.ts +2 -2
  14. package/cli/commands/settings.ts +90 -0
  15. package/cli/commands/shell-url.ts +18 -10
  16. package/cli/commands/swift.ts +3 -1
  17. package/cli/main.ts +6 -0
  18. package/cli/outbound-endpoints.ts +17 -15
  19. package/cli/settings-flags.ts +115 -0
  20. package/dist-lib/agent-daemon-client.cjs +1 -1
  21. package/dist-lib/agent-events.cjs +1 -1
  22. package/dist-lib/attached-projects.cjs +1 -1
  23. package/dist-lib/auth/shared-session.cjs +1 -1
  24. package/dist-lib/backend-origin.cjs +1 -1
  25. package/dist-lib/beta.cjs +1 -1
  26. package/dist-lib/beta.mjs +1 -1
  27. package/dist-lib/bridge-constants.cjs +1 -1
  28. package/dist-lib/bridge-contract-input.cjs +1 -1
  29. package/dist-lib/bridge-contract-input.mjs +1 -1
  30. package/dist-lib/bridge-contract.cjs +1 -1
  31. package/dist-lib/bridge-contract.mjs +1 -1
  32. package/dist-lib/bundle-channel.cjs +3706 -1818
  33. package/dist-lib/capture-contract.cjs +1 -1
  34. package/dist-lib/capture-contract.mjs +1 -1
  35. package/dist-lib/cloud-contract.cjs +1 -1
  36. package/dist-lib/cloud-contract.mjs +1 -1
  37. package/dist-lib/cloud-test-args.cjs +1 -1
  38. package/dist-lib/cloud-test-args.mjs +1 -1
  39. package/dist-lib/cloud.cjs +1 -1
  40. package/dist-lib/cloud.mjs +1 -1
  41. package/dist-lib/config.cjs +3 -7
  42. package/dist-lib/config.mjs +3 -7
  43. package/dist-lib/detox/index.cjs +4 -4
  44. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  45. package/dist-lib/expo-swift-bundle.cjs +17144 -15295
  46. package/dist-lib/expo-swift-metadata.cjs +1 -1
  47. package/dist-lib/expo-swift-metadata.mjs +1 -1
  48. package/dist-lib/home-paths.cjs +1 -1
  49. package/dist-lib/host/bridge-host.cjs +63288 -62269
  50. package/dist-lib/host/fetch-proxy-handler.cjs +1598 -211
  51. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  52. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  53. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  54. package/dist-lib/host/websocket-proxy.cjs +1 -1
  55. package/dist-lib/index.cjs +3007 -1512
  56. package/dist-lib/jump-to-source-babel.cjs +1 -1
  57. package/dist-lib/jump-to-source-native.cjs +1 -1
  58. package/dist-lib/kotlin-host.cjs +972 -246
  59. package/dist-lib/menu.cjs +1 -1
  60. package/dist-lib/menu.mjs +1 -1
  61. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  62. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  63. package/dist-lib/metro-production-bundle.cjs +1 -1
  64. package/dist-lib/metro-production-bundle.mjs +1 -1
  65. package/dist-lib/metro.cjs +1742 -247
  66. package/dist-lib/native-app-identity-project.cjs +40 -204
  67. package/dist-lib/native-app-identity-project.mjs +40 -204
  68. package/dist-lib/native-app-identity.cjs +1 -1
  69. package/dist-lib/native-app-identity.mjs +1 -1
  70. package/dist-lib/native-firebase-metadata.cjs +1 -1
  71. package/dist-lib/native-firebase-metadata.mjs +1 -1
  72. package/dist-lib/pdfium-raster.cjs +1 -1
  73. package/dist-lib/pdfium-raster.mjs +1 -1
  74. package/dist-lib/plist.cjs +1 -1
  75. package/dist-lib/plist.mjs +1 -1
  76. package/dist-lib/profiles.cjs +1 -1
  77. package/dist-lib/public-brand.cjs +1 -1
  78. package/dist-lib/public-origins-lib-esm.json +26 -24
  79. package/dist-lib/public-origins-lib.json +198 -117
  80. package/dist-lib/react-native-host-modules.cjs +1 -1
  81. package/dist-lib/react-native-host-modules.mjs +1 -1
  82. package/dist-lib/reap-browser.cjs +1 -1
  83. package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
  84. package/dist-lib/sdk.cjs +1 -1
  85. package/dist-lib/sdk.mjs +1 -1
  86. package/dist-lib/skills.cjs +21765 -20511
  87. package/dist-lib/swift-compile.cjs +48 -228
  88. package/dist-lib/swift-compile.mjs +48 -228
  89. package/dist-lib/swift-package.cjs +1 -1
  90. package/dist-lib/swift-package.mjs +1 -1
  91. package/dist-lib/swift-submit.cjs +1 -1
  92. package/dist-lib/swift-submit.mjs +1 -1
  93. package/dist-lib/swift-toolchain.cjs +1 -199
  94. package/dist-lib/swift.cjs +1 -1
  95. package/dist-lib/vite-swift.cjs +227 -251
  96. package/dist-lib/vite.cjs +5240 -3788
  97. package/dist-lib/worklet-executable.cjs +1 -1
  98. package/dist-lib/worklet-executable.mjs +1 -1
  99. package/dist-types/packages/peach-engine/src/config.d.ts +1 -4
  100. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -0
  101. package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -0
  102. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -0
  103. package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +5 -0
  104. package/kotlin/README.md +4 -3
  105. package/kotlin/sdk.tar.gz +0 -0
  106. package/kotlin/toolchain.json +3 -6
  107. package/package.json +1 -1
  108. package/runtime-companion.json +1 -1
  109. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h +1 -43
  110. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayerContents.h +55 -0
  111. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Modules/module.modulemap +3 -3
  112. package/sdk/ios/usr/include/ObjectiveC.apinotes +0 -24
  113. package/sdk/ios/usr/include/grp.h +93 -0
  114. package/sdk/ios/usr/include/netinet/tcp.h +299 -0
  115. package/sdk/ios/wasm/include/netinet/tcp.h +6 -0
  116. package/sdk/ios/wasm/include/stdlib.h +1 -0
  117. package/sdk/ios/wasm/include/unistd.h +2 -0
  118. package/skills/contrast/SKILL.md +1 -0
  119. package/skills/peach-setup/SKILL.md +11 -1
  120. package/src/android-bridge-dependencies.ts +1 -1
  121. package/src/app-config.ts +7 -0
  122. package/src/binaryen.lock.json +21 -0
  123. package/src/cocoapods-trunk.ts +52 -0
  124. package/src/config.ts +21 -31
  125. package/src/expo-native-workspace.ts +4 -0
  126. package/src/kotlin-host.ts +1 -1
  127. package/src/kotlin-sdk.ts +7 -7
  128. package/src/kotlin-toolchain.ts +28 -24
  129. package/src/kotlinSdkContract.ts +2 -2
  130. package/src/native-bundles.ts +5 -2
  131. package/src/native-static-libraries.ts +38 -5
  132. package/src/podfile-cocoapods.ts +1473 -0
  133. package/src/podspec-cocoapods.ts +331 -106
  134. package/src/podspec-ruby-stdlib.ts +134 -19
  135. package/src/podspec-ruby.ts +199 -46
  136. package/src/settingsContract.ts +74 -0
  137. package/src/swift-compile.ts +1 -1
  138. package/src/swift-compiler-digest.ts +1 -0
  139. package/src/swift-host.ts +107 -15
  140. package/src/swift-objc-compile.ts +5 -0
  141. package/src/swift-packages.ts +75 -0
  142. package/src/swift-shared-sdk.ts +19 -0
  143. package/src/swift-toolchain.ts +2 -201
  144. package/src/turbo-source.ts +7 -37
  145. package/src/wasm-optimize.ts +4 -27
  146. package/src/xcode-project.ts +22 -7
package/README.md CHANGED
@@ -307,7 +307,7 @@ the later trace URL notifies viewers without extending that duration.
307
307
  Maestro YAML header `onFlowStart` and `onFlowComplete` hooks reach the same
308
308
  runner as body hooks, including nested `runFlow` files. A header reset flow
309
309
  therefore runs before assertions in each flow.
310
- | sim drivers | Launch or attach the actual sim page. Playwright owns isolated browser profiles; the native host owns Mac and Linux desktop windows; Electron owns Windows windows. The current sim is reused unless `--new`, `--profile`, or `--ephemeral` requests a separate one. A profile holds one browser: `--profile <id>` refuses before launching while that profile's browser is alive. An external Playwright `connectOverCDP` observer that calls `exposeBinding` replaces the page's existing host bindings, so observe with raw CDP. | `cli/drivers/index.ts`, `cli/drivers/registry.ts`, `cli/drivers/electron.ts`, `cli/drivers/playwright.ts` |
310
+ | sim drivers | Launch or attach the actual sim page. Playwright owns isolated browser profiles; the native host owns Mac and Linux desktop windows; Electron owns Windows windows. The current sim is reused unless `--new`, `--storage-profile`, or `--ephemeral` requests a separate one. A storage profile holds one browser: `--storage-profile <id>` refuses before launching while that profile's browser is alive. An external Playwright `connectOverCDP` observer that calls `exposeBinding` replaces the page's existing host bindings, so observe with raw CDP. | `cli/drivers/index.ts`, `cli/drivers/registry.ts`, `cli/drivers/electron.ts`, `cli/drivers/playwright.ts` |
311
311
  | SootSimBridgeHost (serve/daemon) | The bridge process (`peach serve`, or autostarted as the daemon via launchd/systemd). HTTP+WS hub on `:7668`: relays commands between CLI clients and registered sims; also serves runtime HTTP, `/__server-scan`, and fetch/WS proxies. | `src/host/bridge-host.ts`, `cli/commands/serve.ts`, `cli/commands/daemon.ts`, `src/home-paths.ts` |
312
312
  | AgentHost + sessions | Agent-routing extension of the host: owns the single FIFO reader per agent session and fans `agent:event`/`session-status` pushes to every WS subscriber. Backed by agent-sessions + attached-projects stores. | `src/host/agent-host.ts`, `src/agent-sessions.ts`, `src/attached-projects.ts`, `src/agent-daemon-client.ts` |
313
313
  | host proxies + dev-server scan | Host-side helpers so a cross-origin tenant worker can reach local dev servers and same-origin APIs: `/__server-scan` discovers running metro/expo/vxrn/one servers; fetch + websocket proxies relay guest-app network through the daemon. An optional network policy authorizes each of those hops before it transmits ([Network policy](#network-policy)). | `src/host/fetch-proxy-handler.ts`, `src/host/websocket-proxy.ts`, `src/host/network-policy.ts`, `src/host/network-policy-proxy.ts`, `src/host/websocket-frame-guard.ts`, `scripts/dev-server-scanner.ts`, `src/dev-bundle-resolution.ts` |
@@ -44,7 +44,7 @@ The bridge host is the control plane behind top-level verbs like \`describe\` an
44
44
  - default shell URL: \`{{defaultShellUrl}}\`
45
45
  - every connected sim gets a stable hex id like \`a1\`, \`a2\`, …, \`af\`, \`b0\`
46
46
  - browser sims use isolated Playwright Chrome for Testing profiles; the desktop app uses the native host on Mac and Linux, and Electron on Windows
47
- - \`peach open\` reuses the saved sim by default. \`--new\`, \`--profile\`, and \`--ephemeral\` explicitly request a separate sim
47
+ - \`peach open\` reuses the saved sim by default. \`--new\`, \`--storage-profile\`, and \`--ephemeral\` explicitly request a separate sim
48
48
  - the first CLI to send a state-changing command to a sim holds a 10-minute lease on it. read-only inspection and close bypass the lease. other agents cannot change state until the lease expires or, last-resort, is taken with \`peach claim --force\` (which interrupts whoever's mid-flow; prefer \`peach open --new\` to get a fresh sim instead). the lease refreshes on state-changing commands from the owner
49
49
 
50
50
  This means you can open a sim one way and still inspect or debug it later from the CLI.
@@ -89,7 +89,10 @@ peach debug diff before after
89
89
 
90
90
  # isolate app storage in the native desktop app, Windows Electron, or Playwright
91
91
  peach storage profile create qa
92
- peach open 8081 --profile qa
92
+ peach open 8081 --storage-profile qa
93
+
94
+ # boot with the accessibility settings profile from peach.config.ts
95
+ peach open 8081 --profile accessibility
93
96
 
94
97
  # run a single Maestro flow
95
98
  peach test .maestro/login.yaml --record
@@ -314,7 +317,7 @@ Use \`mode screenshot on\` when you need the browser chrome hidden around the ca
314
317
  body: `
315
318
  \`storage clear\` targets the guest app in the current sim: localStorage, sessionStorage, secure-store, and IndexedDB are cleared through the live reload bridge.
316
319
 
317
- \`storage profile\` manages persistent launch profiles used by the native app, Windows Electron and Playwright. Profiles isolate browser storage at window/context creation time, so opening with \`--profile <id>\` always creates a fresh isolated sim.
320
+ \`storage profile\` manages persistent launch profiles used by the native app, Windows Electron and Playwright. Profiles isolate browser storage at window/context creation time, so opening with \`--storage-profile <id>\` always creates a fresh isolated sim.
318
321
  `,
319
322
  },
320
323
  ],
@@ -1,3 +1,4 @@
1
+ import { settingsFlagHelp } from '../settings-flags'
1
2
  import type {
2
3
  CliCommandMeta,
3
4
  CliDocRenderContext,
@@ -258,7 +259,7 @@ export const cliCommandMetas: CliCommandMeta[] = [
258
259
  ),
259
260
  example('peach storage profile list'),
260
261
  example('peach storage profile create qa'),
261
- example('peach open 8081 --profile qa --driver playwright'),
262
+ example('peach open 8081 --storage-profile qa --driver playwright'),
262
263
  example('peach storage profile clear qa'),
263
264
  ],
264
265
  related: ['open', 'desktop', 'defaults'],
@@ -1593,7 +1594,7 @@ export const cliCommandMetas: CliCommandMeta[] = [
1593
1594
  title: 'peach open',
1594
1595
  description: 'run a React Native, Swift or Android app in the simulator',
1595
1596
  summary:
1596
- "Resolve a port, dev-server URL, bundle URL, built bundle file, full shell URL, or app deep link. It also runs native apps: an Xcode project or workspace, a SwiftPM package or a Swift file compiles on this machine against the Swift toolchain and SDK Peach pins and installs on first use (beta), and an Android app module compiles its Kotlin and Compose sources with the pinned Kotlin toolchain, which needs a Java runtime (beta). A native open stays in the foreground, recompiles on each source edit and closes its preview on Ctrl+C; when an app imports modules Peach does not provide, it lists each one with the files importing it. A bundle file loads with no dev server running: the bridge serves a copy, and the build's own `__DEV__` prelude picks production or development React. The first browser sim uses an isolated Playwright Chrome for Testing profile. Later opens reuse the saved sim and navigate it in place. Custom-scheme URLs and leading-slash routes dispatch through the current app’s React Native Linking pipeline. Named profiles force a fresh desktop or Playwright sim because storage isolation is fixed at window/context construction time. A peach preview/build link (e.g. `https://peachsim.com/preview/<id>`) is a full player page, not a driveable sim; `open` recognizes it and launches it in your browser for viewing instead of mis-loading the HTML as a bundle.",
1597
+ "Resolve a port, dev-server URL, bundle URL, built bundle file, full shell URL, or app deep link. It also runs native apps: an Xcode project or workspace, a SwiftPM package or a Swift file compiles on this machine against the Swift toolchain and SDK Peach pins and installs on first use (beta), and an Android app module compiles its Kotlin and Compose sources with the pinned Kotlin toolchain, which needs a Java runtime (beta). A native open stays in the foreground, recompiles on each source edit and closes its preview on Ctrl+C; when an app imports modules Peach does not provide, it lists each one with the files importing it. A bundle file loads with no dev server running: the bridge serves a copy, and the build's own `__DEV__` prelude picks production or development React. The first browser sim uses an isolated Playwright Chrome for Testing profile. Later opens reuse the saved sim and navigate it in place. Custom-scheme URLs and leading-slash routes dispatch through the current app’s React Native Linking pipeline. `--profile <name>` applies a set of device settings (dynamic type, contrast, appearance, locale) named under `profiles` in the app's `peach.config.ts`, and each setting flag sets one value over it; both stamp the engine URL, so they win over the persisted settings at boot in the browser, the desktop app and cloud sims. A storage profile forces a fresh desktop or Playwright sim because storage isolation is fixed at window/context construction time. A peach preview/build link (e.g. `https://peachsim.com/preview/<id>`) is a full player page, not a driveable sim; `open` recognizes it and launches it in your browser for viewing instead of mis-loading the HTML as a bundle.",
1597
1598
  order: 100,
1598
1599
  usage: [
1599
1600
  'peach open <port|target|bundle-url|bundle-file|swift-file|native-project|peach-url|deeplink> [--new]',
@@ -1619,7 +1620,15 @@ export const cliCommandMetas: CliCommandMeta[] = [
1619
1620
  '--new',
1620
1621
  'open a genuinely concurrent sim instead of reusing the current one. each new sim creates another isolated browser tree',
1621
1622
  ),
1622
- option('--profile <id>', 'open with an isolated persistent storage profile'),
1623
+ option(
1624
+ '--profile <name>',
1625
+ "apply the device settings profile of that name from the app's peach.config.ts; setting flags override its values",
1626
+ ),
1627
+ ...settingsFlagHelp().map(({ flag, description }) => option(flag, description)),
1628
+ option(
1629
+ '--storage-profile <id>',
1630
+ 'open with an isolated persistent storage profile',
1631
+ ),
1623
1632
  option(
1624
1633
  '--id <name>',
1625
1634
  "name this agent. the sim's agent indicator shows it while you drive the sim, and every later peach command from this session keeps using it. PEACH_AGENT_ID sets the same name from the environment, and --id wins",
@@ -1652,10 +1661,6 @@ export const cliCommandMetas: CliCommandMeta[] = [
1652
1661
  '--device <model>',
1653
1662
  'device profile for the opened sim (e.g. iphone-16, iphone-16-pro-max, pixel-8). stamped on the engine URL so every open path honors it; playwright sims also size their viewport to the device instead of a desktop-shaped default',
1654
1663
  ),
1655
- option(
1656
- '-t, --theme <light|dark|auto>',
1657
- 'appearance scheme for the opened sim, stamped on the engine URL so it wins over the persisted scheme at boot',
1658
- ),
1659
1664
  option(
1660
1665
  '--posture <closed|book|open|laptop|tent>',
1661
1666
  'fold rest for the opened sim, stamped on the engine URL next to --device so it round-trips across reloads. the foldable iPhone Duo boots at that rest, so the app sees its hinge from the first frame; anything else boots closed',
@@ -1664,10 +1669,6 @@ export const cliCommandMetas: CliCommandMeta[] = [
1664
1669
  '--render-resolution <high|medium|low>',
1665
1670
  "raster quality for the opened sim, stamped on the engine URL. the default is medium (density 2); high renders at the device's native scale (3 on current iPhones), which native-parity captures need",
1666
1671
  ),
1667
- option(
1668
- '--predictive-text <on|off>',
1669
- "the keyboard's QuickType suggestion lane for the opened sim, stamped on the engine URL over the persisted setting. native oracles captured by a test driver run with it off, so a keyboard capture compared against one passes off",
1670
- ),
1671
1672
  option(
1672
1673
  '--orientation <portrait|landscape>',
1673
1674
  "interface orientation the sim boots in, stamped on the engine URL like --posture. defaults to the device's own: portrait, or landscape for an open iPhone Duo",
@@ -1728,8 +1729,12 @@ export const cliCommandMetas: CliCommandMeta[] = [
1728
1729
  example('peach open ./MyPackage', 'watch and preview a SwiftPM package'),
1729
1730
  example('peach open ./app', 'run an Android app module from its launcher activity'),
1730
1731
  example('peach open --new 8085'),
1731
- example('peach open 8081 --profile qa'),
1732
- example('peach open 8081 --profile qa --driver playwright'),
1732
+ example(
1733
+ 'peach open 8081 --profile accessibility',
1734
+ 'apply the accessibility settings profile from peach.config.ts',
1735
+ ),
1736
+ example('peach open 8081 --font-size 1.786 --bold-text on --theme dark'),
1737
+ example('peach open 8081 --storage-profile qa --driver playwright'),
1733
1738
  example('peach open http://localhost:8082'),
1734
1739
  example(
1735
1740
  'peach open ./dist/ios.js',
@@ -2059,7 +2064,7 @@ export const cliCommandMetas: CliCommandMeta[] = [
2059
2064
  'Launch or install the native app on macOS arm64 and Linux x64, or Electron on Windows. Profiles keep cookies and app storage isolated.',
2060
2065
  order: 160,
2061
2066
  usage: [
2062
- 'peach desktop [--port <number>] [--profile <id>]',
2067
+ 'peach desktop [--port <number>] [--storage-profile <id>]',
2063
2068
  'peach desktop install [options]',
2064
2069
  'peach desktop uninstall',
2065
2070
  ],
@@ -2068,7 +2073,10 @@ export const cliCommandMetas: CliCommandMeta[] = [
2068
2073
  '--port <number>',
2069
2074
  'open a local app server through the peach shell, for example Metro on 8081',
2070
2075
  ),
2071
- option('--profile <id>', 'launch with an isolated persistent storage profile'),
2076
+ option(
2077
+ '--storage-profile <id>',
2078
+ 'launch with an isolated persistent storage profile',
2079
+ ),
2072
2080
  option('--ephemeral', 'launch with a temporary isolated storage profile'),
2073
2081
  option('-y, --yes', 'for install: skip confirmation and install immediately'),
2074
2082
  option('--force', 'for install: reinstall even if the companion is present'),
@@ -2085,7 +2093,7 @@ export const cliCommandMetas: CliCommandMeta[] = [
2085
2093
  examples: [
2086
2094
  example('peach desktop'),
2087
2095
  example('peach desktop --port 8081'),
2088
- example('peach desktop --profile qa'),
2096
+ example('peach desktop --storage-profile qa'),
2089
2097
  example('peach desktop install --yes'),
2090
2098
  example(
2091
2099
  'peach desktop install --native --yes',
@@ -2364,7 +2372,45 @@ export const cliCommandMetas: CliCommandMeta[] = [
2364
2372
  'stand the iphone duo half open on its edge',
2365
2373
  ),
2366
2374
  ],
2367
- related: ['mode', 'screenshot', 'open', 'list'],
2375
+ related: ['mode', 'screenshot', 'open', 'list', 'settings'],
2376
+ },
2377
+ {
2378
+ id: 'settings',
2379
+ slug: 'settings',
2380
+ navTitle: 'settings',
2381
+ title: 'peach settings',
2382
+ description: 'read or change the device settings of a running sim',
2383
+ summary:
2384
+ "Read the device settings a running sim reports (appearance, dynamic type, the accessibility display options, predictive text and locale), or change them live as the Settings app would: `--profile <name>` applies a set named under `profiles` in the app's `peach.config.ts`, and each setting flag sets one value over it. `peach open` takes the same profile and flags to boot a sim with them.",
2385
+ order: 78.5,
2386
+ usage: [
2387
+ 'peach settings [--json] [--sim <id>]',
2388
+ 'peach settings --profile <name> [setting flags] [--sim <id>]',
2389
+ 'peach settings <setting flags> [--sim <id>]',
2390
+ ],
2391
+ options: [
2392
+ option(
2393
+ '--profile <name>',
2394
+ "apply the device settings profile of that name from the app's peach.config.ts",
2395
+ ),
2396
+ option(
2397
+ '--project-root <directory>',
2398
+ 'the app whose peach.config.ts holds the profile (defaults to the current directory)',
2399
+ ),
2400
+ ...settingsFlagHelp().map(({ flag, description }) => option(flag, description)),
2401
+ option('--json', 'print the settings as JSON'),
2402
+ option('--sim <sim>', 'target a specific connected sim'),
2403
+ option('--port <number>', 'bridge port (defaults to {{bridgePort}})'),
2404
+ ],
2405
+ examples: [
2406
+ example('peach settings', 'show the device settings of the current sim'),
2407
+ example(
2408
+ 'peach settings --profile accessibility',
2409
+ 'apply the accessibility profile from peach.config.ts',
2410
+ ),
2411
+ example('peach settings --font-size 1.786 --increase-contrast on --sim a7'),
2412
+ ],
2413
+ related: ['open', 'device'],
2368
2414
  },
2369
2415
  {
2370
2416
  id: 'skill',
@@ -94,6 +94,10 @@ export const sootsimCliDocsRoutes: CliDocsRoute[] = [
94
94
  title: 'device',
95
95
  route: '/docs/peach/cli/device',
96
96
  },
97
+ {
98
+ title: 'settings',
99
+ route: '/docs/peach/cli/settings',
100
+ },
97
101
  {
98
102
  title: 'network',
99
103
  route: '/docs/peach/cli/network',
@@ -15,6 +15,7 @@ import {
15
15
  nativeBundleAssets,
16
16
  } from '../src/native-bundles'
17
17
  import { embedBundleAssets, isRemoteBundleInput } from './cloud-client.ts'
18
+ import { buildRemoteProjectBundle } from './remote-project-bundle'
18
19
  import type { RemotePlatform } from './cloud-session.ts'
19
20
 
20
21
  export interface CloudBoxNativeAsset {
@@ -61,7 +62,7 @@ function bundleAppProject(bundlePath: string): string | null {
61
62
  * files beside it, which the page hands the guest as project assets.
62
63
  */
63
64
  export async function produceCloudBoxArtifact(
64
- bundlePath: string,
65
+ input: string | { projectDir: string; buildDir: string },
65
66
  platform: RemotePlatform,
66
67
  options: {
67
68
  assetsDirectory?: string
@@ -69,19 +70,49 @@ export async function produceCloudBoxArtifact(
69
70
  assetServer?: URL
70
71
  } = {},
71
72
  ): Promise<CloudBoxArtifactProduction> {
72
- const { assetsDirectory } = options
73
- const prepared = await embedBundleAssets(
74
- bundlePath,
75
- 'peach box create',
76
- assetsDirectory ? 'require-assets' : 'allow-placeholders',
77
- assetsDirectory,
78
- options.assetServer,
79
- )
80
- if (!readPackageVersionsFooter(prepared.source)?.['react-native']) {
81
- throw new Error(
82
- 'remote simulator bundle is missing __peachPackageVersions with the installed react-native version. Wrap your project Metro config with withPeach from peachsim/metro, then rebuild the bundle before running peach ios --remote or peach android --remote.',
73
+ const preparation = (async () => {
74
+ const bundlePath =
75
+ typeof input === 'string'
76
+ ? input
77
+ : await buildRemoteProjectBundle(input.projectDir, platform, input.buildDir)
78
+ const assetsDirectory =
79
+ typeof input === 'string' ? options.assetsDirectory : input.buildDir
80
+ const prepared = await embedBundleAssets(
81
+ bundlePath,
82
+ 'peach box create',
83
+ assetsDirectory ? 'require-assets' : 'allow-placeholders',
84
+ assetsDirectory,
85
+ options.assetServer,
83
86
  )
84
- }
87
+ if (!readPackageVersionsFooter(prepared.source)?.['react-native']) {
88
+ throw new Error(
89
+ 'remote simulator bundle is missing __peachPackageVersions with the installed react-native version. Wrap your project Metro config with withPeach from peachsim/metro, then rebuild the bundle before running peach ios --remote or peach android --remote.',
90
+ )
91
+ }
92
+ return prepared
93
+ })()
94
+ const nativePreparation = (async () => {
95
+ if (typeof input === 'string') await preparation
96
+ const nativeProject =
97
+ typeof input !== 'string'
98
+ ? input.projectDir
99
+ : options.nativeProjectDir
100
+ ? resolve(options.nativeProjectDir)
101
+ : bundleAppProject(input)
102
+ const natives = nativeProject
103
+ ? await buildNativeBundles(nativeProject, platform, async () =>
104
+ (await detectBundleModeFromText((await preparation).source)) === 'production'
105
+ ? 'Release'
106
+ : 'Debug',
107
+ )
108
+ : null
109
+ return { nativeProject, natives }
110
+ })()
111
+ const [bundle, native] = await Promise.allSettled([preparation, nativePreparation])
112
+ if (bundle.status === 'rejected') throw bundle.reason
113
+ if (native.status === 'rejected') throw native.reason
114
+ const prepared = bundle.value
115
+ const { nativeProject, natives } = native.value
85
116
  const warnings: string[] = []
86
117
  if (prepared.search.unconfirmed && prepared.dest) {
87
118
  warnings.push(
@@ -93,19 +124,9 @@ export async function produceCloudBoxArtifact(
93
124
  `peach box create embedded a placeholder image for ${prepared.substituted.length} asset(s) no scale of which is in ${prepared.search.searched.join(', ') || 'any asset dest directory'}: ${prepared.substituted.join(', ')}. Rebuild with \`react-native bundle --assets-dest\` to ship the real images.`,
94
125
  )
95
126
  }
96
- const nativeProject = options.nativeProjectDir
97
- ? resolve(options.nativeProjectDir)
98
- : bundleAppProject(bundlePath)
99
127
  let code = prepared.code
100
128
  const nativeAssets: CloudBoxNativeAsset[] = []
101
- if (nativeProject) {
102
- const natives = await buildNativeBundles(
103
- nativeProject,
104
- platform,
105
- (await detectBundleModeFromText(prepared.source)) === 'production'
106
- ? 'Release'
107
- : 'Debug',
108
- )
129
+ if (natives) {
109
130
  // a Kotlin module imports its loader and wasm by relative url, which the
110
131
  // box page does not serve.
111
132
  if (natives.expoKotlin?.metadata.module) {
@@ -899,10 +899,14 @@ export async function embedBundleAssets(
899
899
  variant.scale,
900
900
  )
901
901
  const url = new URL('/assets', assetServer)
902
- // metro preserves watched-folder ../ segments in this query instead of URL paths.
902
+ const [location = '', query] = variant.descriptor.httpServerLocation.split('?', 2)
903
+ const directory = (
904
+ new URLSearchParams(query).get('unstable_path') ??
905
+ location.replace(/^\/?assets(?:\/|$)/, '')
906
+ ).replace(/\/+$/, '')
903
907
  url.searchParams.set(
904
908
  'unstable_path',
905
- `${variant.descriptor.httpServerLocation.replace(/^\/?assets(?:\/|$)/, '')}/${filename}`,
909
+ directory ? `${directory}/${filename}` : filename,
906
910
  )
907
911
  url.searchParams.set('platform', assetServer.searchParams.get('platform') ?? 'ios')
908
912
  url.searchParams.set('hash', variant.descriptor.hash)
@@ -1,3 +1,4 @@
1
+ import { SETTING_FLAGS } from './settings-flags'
1
2
  import type {
2
3
  RnxBackendKind,
3
4
  RnxCommandInvocation,
@@ -39,6 +40,7 @@ const NODE_COMMAND_NAMES = [
39
40
  'shell',
40
41
  'assert',
41
42
  'device',
43
+ 'settings',
42
44
  'open',
43
45
  'stream',
44
46
  'package',
@@ -132,7 +134,7 @@ const VALUE_FLAGS = new Set([
132
134
  '--posture',
133
135
  '--window',
134
136
  '--render-resolution',
135
- '--predictive-text',
137
+ ...SETTING_FLAGS,
136
138
  '--os-version',
137
139
  '--ios-target',
138
140
  '--output',
@@ -63,7 +63,7 @@ import {
63
63
  import { rnxRuntime } from '../../src/runtime-delivery'
64
64
  import { sleep } from '../../src/sleep'
65
65
  import { fetchOneNativeAppCatalogDeclaration } from '../app-catalog'
66
- import { findExpoAppConfig } from '../app-project'
66
+ import { findExpoAppConfig, resolveAppProject } from '../app-project'
67
67
  import { discoverOneNativeAppSplash } from '../app-splash'
68
68
  import { extractAppBinaryBundle, isAppBinaryPath } from '../binary-sidecar'
69
69
  import { printBridgeFailureDiagnostics } from '../bridge-diagnostics'
@@ -86,6 +86,14 @@ import { diagnosticsAllowedForCurrentProcess, isCi } from '../privacy'
86
86
  import { rethrowIfExit, peachExit } from '../run-rnx'
87
87
  import { collectRuntimeDiagnostics } from '../runtime-diagnostics'
88
88
  import { rnxSelfInvocation } from '../self-invocation'
89
+ import {
90
+ readSettingsArgs,
91
+ resolveSettings,
92
+ type SettingsArgs,
93
+ SETTINGS_VALUE_FLAGS,
94
+ settingsToArgs,
95
+ withoutSettingsArgs,
96
+ } from '../settings-flags'
89
97
  import { accent, muted, warning } from '../ui'
90
98
  import {
91
99
  BRIDGE_VALUE_FLAGS,
@@ -120,6 +128,7 @@ import {
120
128
  type BuildShellUrlOptions,
121
129
  } from './shell-url'
122
130
  import { hasInstalledPeachSkills } from './skills'
131
+ import type { SettingsProfile } from '../../src/settingsContract'
123
132
  import type { DriverId, DriverLaunchResult } from '../drivers/types'
124
133
 
125
134
  interface ControlCommandOptions {
@@ -1346,11 +1355,12 @@ export async function runLinkCommand(args: string[], opts: ControlCommandOptions
1346
1355
  await dispatchAppLink(parsed)
1347
1356
  }
1348
1357
 
1349
- // device/theme seed the selected live sim through the settings bridge, the
1350
- // same call `peach device set` makes, before the link is delivered
1358
+ // device and settings seed the selected live sim through the settings bridge,
1359
+ // the calls `peach device set` and `peach settings` make, before the link is
1360
+ // delivered
1351
1361
  async function dispatchAppLink(
1352
1362
  parsed: ParsedBridgeCliArgs,
1353
- liveSettings: { device?: string; theme?: string } = {},
1363
+ liveSettings: { device?: string; settings?: SettingsProfile } = {},
1354
1364
  ) {
1355
1365
  if (parsed.positional.length !== 1) {
1356
1366
  console.error(' peach open: expected exactly one <url-or-route>')
@@ -1361,13 +1371,19 @@ async function dispatchAppLink(
1361
1371
  const bridge = createBridgeFromParsed(parsed)
1362
1372
  const simHint = parsed.simId ? ` --sim ${parsed.simId}` : ''
1363
1373
  try {
1364
- for (const [key, value] of [
1365
- ['deviceModel', liveSettings.device],
1366
- ['colorScheme', liveSettings.theme],
1367
- ] as const) {
1368
- if (value)
1369
- await callInBridgeWrite(bridge, 'SootSim.bridges.settings.set', key, value)
1370
- }
1374
+ if (liveSettings.device)
1375
+ await callInBridgeWrite(
1376
+ bridge,
1377
+ 'SootSim.bridges.settings.set',
1378
+ 'deviceModel',
1379
+ liveSettings.device,
1380
+ )
1381
+ if (liveSettings.settings && Object.keys(liveSettings.settings).length > 0)
1382
+ await callInBridgeWrite(
1383
+ bridge,
1384
+ 'SootSim.bridges.settings.apply',
1385
+ liveSettings.settings,
1386
+ )
1371
1387
  const target = await openAppUrl(bridge, parsed.positional[0] ?? '')
1372
1388
  console.log(` opened deep link: ${target}`)
1373
1389
  } catch (err) {
@@ -1467,14 +1483,13 @@ async function openSim(
1467
1483
  '--replace',
1468
1484
  '--remap',
1469
1485
  '--driver',
1470
- '--profile',
1486
+ '--storage-profile',
1471
1487
  '--id',
1472
1488
  '--cdp-port',
1473
1489
  '--device',
1474
1490
  '-d',
1475
1491
  '--posture',
1476
1492
  '--render-resolution',
1477
- '--predictive-text',
1478
1493
  '--orientation',
1479
1494
  '--window',
1480
1495
  '--os-version',
@@ -1488,8 +1503,7 @@ async function openSim(
1488
1503
  '--viewport',
1489
1504
  '--env',
1490
1505
  '--arg',
1491
- '--theme',
1492
- '-t',
1506
+ ...SETTINGS_VALUE_FLAGS,
1493
1507
  ],
1494
1508
  }
1495
1509
  const booleanFlags = new Set(openArgOptions.stripBooleanFlags)
@@ -1526,7 +1540,7 @@ async function openSim(
1526
1540
  port: opts.port,
1527
1541
  commandTimeoutMs: opts.timeoutMs,
1528
1542
  })
1529
- const requestedProfileId = args.find((_, i) => args[i - 1] === '--profile')
1543
+ const requestedProfileId = args.find((_, i) => args[i - 1] === '--storage-profile')
1530
1544
  const agentIdFlag = args.indexOf('--id')
1531
1545
  if (agentIdFlag !== -1) {
1532
1546
  const agentId = args[agentIdFlag + 1]?.trim()
@@ -1550,7 +1564,7 @@ async function openSim(
1550
1564
  peachExit(1)
1551
1565
  }
1552
1566
  if (requestedProfileId && ephemeralProfile) {
1553
- console.error(' peach open: --profile cannot be combined with --ephemeral')
1567
+ console.error(' peach open: --storage-profile cannot be combined with --ephemeral')
1554
1568
  peachExit(1)
1555
1569
  }
1556
1570
  const profileId = requestedProfileId ? ensureProfile(requestedProfileId).id : undefined
@@ -1558,7 +1572,7 @@ async function openSim(
1558
1572
  const commandConfig = parseOpenRuntimeConfig(args)
1559
1573
  if (openInNewSim && parsed.simIdSource === 'flag') {
1560
1574
  console.error(
1561
- ' peach open: --new, --profile, and --ephemeral cannot be combined with --sim',
1575
+ ' peach open: --new, --storage-profile, and --ephemeral cannot be combined with --sim',
1562
1576
  )
1563
1577
  peachExit(1)
1564
1578
  }
@@ -1578,26 +1592,28 @@ async function openSim(
1578
1592
  peachExit(1)
1579
1593
  }
1580
1594
 
1581
- // -t / --theme <light|dark|auto> seeds the appearance for the opened sim,
1582
- // stamped on the engine URL as ?theme= next to ?device=: the shell reads it
1583
- // at boot over the persisted scheme. without this the flag fell into the
1584
- // positional target (`peach open -t dark` opened `?open=-t`) and the theme
1585
- // was silently dropped. validated up here so a bad flag fails before the
1586
- // bridge spawns.
1587
- const themeFlagIndex = args.findIndex((arg) => arg === '--theme' || arg === '-t')
1588
- const themeArg = themeFlagIndex === -1 ? undefined : args[themeFlagIndex + 1]
1589
- if (themeFlagIndex !== -1 && themeArg === undefined) {
1590
- console.error(' peach open: --theme expects light, dark, or auto')
1595
+ // --profile <name> and the setting flags (--theme, --font-size, ...) seed
1596
+ // the opened sim's device settings, stamped on the engine URL so the shell
1597
+ // reads them at boot over the persisted values. checked up here so a bad
1598
+ // flag fails before the bridge spawns.
1599
+ let settingsArgs: SettingsArgs = { flags: {} }
1600
+ try {
1601
+ settingsArgs = readSettingsArgs(args)
1602
+ } catch (error) {
1603
+ console.error(
1604
+ ` peach open: ${error instanceof Error ? error.message : String(error)}`,
1605
+ )
1591
1606
  peachExit(1)
1592
1607
  }
1593
- if (
1594
- themeArg !== undefined &&
1595
- themeArg !== 'light' &&
1596
- themeArg !== 'dark' &&
1597
- themeArg !== 'auto'
1598
- ) {
1599
- console.error(` peach open: --theme must be light, dark, or auto, got "${themeArg}"`)
1600
- peachExit(1)
1608
+ const resolveOpenSettings = (config: PeachConfig | undefined) => {
1609
+ try {
1610
+ return resolveSettings(settingsArgs, config)
1611
+ } catch (error) {
1612
+ console.error(
1613
+ ` peach open: ${error instanceof Error ? error.message : String(error)}`,
1614
+ )
1615
+ peachExit(1)
1616
+ }
1601
1617
  }
1602
1618
 
1603
1619
  const { resolveNativeInput } = await import('../native-input')
@@ -1622,14 +1638,21 @@ async function openSim(
1622
1638
  else if (nativeBooleanFlags.has(arg)) nativeArgs.push(arg)
1623
1639
  else openArgs.push(arg)
1624
1640
  }
1641
+ // the preview open has no project to read a profile from
1642
+ const settings = resolveOpenSettings(
1643
+ settingsArgs.profile === undefined
1644
+ ? undefined
1645
+ : await loadRNXAppConfig(resolveAppProject(nativeInput.path)),
1646
+ )
1647
+ const previewArgs = [...withoutSettingsArgs(openArgs), ...settingsToArgs(settings)]
1625
1648
  const code =
1626
1649
  nativeInput.kind === 'kotlin'
1627
1650
  ? await (
1628
1651
  await import('./kotlin')
1629
- ).runKotlin(nativeArgs, { port: opts.port, openArgs })
1652
+ ).runKotlin(nativeArgs, { port: opts.port, openArgs: previewArgs })
1630
1653
  : await (
1631
1654
  await import('./swift')
1632
- ).runSwift(nativeArgs, { port: opts.port, openArgs })
1655
+ ).runSwift(nativeArgs, { port: opts.port, openArgs: previewArgs })
1633
1656
  if (code) peachExit(code)
1634
1657
  return
1635
1658
  }
@@ -1639,13 +1662,19 @@ async function openSim(
1639
1662
  if (!prebuiltBundle && isAppDeepLinkTarget(target)) {
1640
1663
  if (openInNewSim) {
1641
1664
  console.error(
1642
- ' peach open: deep links target the current app; remove --new, --profile, or --ephemeral',
1665
+ ' peach open: deep links target the current app; remove --new, --storage-profile, or --ephemeral',
1643
1666
  )
1644
1667
  peachExit(1)
1645
1668
  }
1646
1669
  const linkDevice = args.find((_, i) => args[i - 1] === '--device')
1647
1670
  if (!validateDeviceOption(linkDevice)) peachExit(1)
1648
- await dispatchAppLink(parsed, { device: linkDevice, theme: themeArg })
1671
+ const linkProjectRoot = args.find((_, i) => args[i - 1] === '--project-root')
1672
+ const settings = resolveOpenSettings(
1673
+ settingsArgs.profile === undefined
1674
+ ? undefined
1675
+ : await loadRNXAppConfig(resolveAppProject(linkProjectRoot ?? process.cwd())),
1676
+ )
1677
+ await dispatchAppLink(parsed, { device: linkDevice, settings })
1649
1678
  return
1650
1679
  }
1651
1680
 
@@ -1807,10 +1836,13 @@ async function openSim(
1807
1836
  : undefined
1808
1837
  const appConfig = await loadRNXAppConfig(project)
1809
1838
  const configuredRuntimeVersion = appConfig?.runtimeVersion
1839
+ const openSettings = resolveOpenSettings(appConfig)
1810
1840
  const runtimeConfig = mergePeachConfig(
1811
1841
  mergePeachConfig(
1812
1842
  mergePeachConfig(
1813
- appConfig ? { ...appConfig, runtimeVersion: undefined } : undefined,
1843
+ appConfig
1844
+ ? { ...appConfig, runtimeVersion: undefined, profiles: undefined }
1845
+ : undefined,
1814
1846
  baseUrlConfig,
1815
1847
  ),
1816
1848
  opts.runtimeConfig,
@@ -1931,17 +1963,6 @@ async function openSim(
1931
1963
  )
1932
1964
  peachExit(1)
1933
1965
  }
1934
- const predictiveTextArg = args.find((_, i) => args[i - 1] === '--predictive-text')
1935
- if (
1936
- args.includes('--predictive-text') &&
1937
- predictiveTextArg !== 'on' &&
1938
- predictiveTextArg !== 'off'
1939
- ) {
1940
- console.error(
1941
- ` peach open: --predictive-text must be on or off, got "${predictiveTextArg ?? ''}"`,
1942
- )
1943
- peachExit(1)
1944
- }
1945
1966
  const orientationFlag = args.find((_, i) => args[i - 1] === '--orientation')
1946
1967
  const orientationArg =
1947
1968
  orientationFlag === 'portrait' || orientationFlag === 'landscape'
@@ -2069,8 +2090,6 @@ async function openSim(
2069
2090
  posture: restArg ? foldBus.duoRestPosture(restArg) : undefined,
2070
2091
  rest: restArg,
2071
2092
  renderResolution: renderResolutionArg,
2072
- predictiveText:
2073
- predictiveTextArg === undefined ? undefined : predictiveTextArg === 'on',
2074
2093
  orientation:
2075
2094
  orientationArg ??
2076
2095
  (restArg
@@ -2078,7 +2097,7 @@ async function openSim(
2078
2097
  : undefined),
2079
2098
  windowSize,
2080
2099
  osVersion: osVersionArg,
2081
- theme: themeArg,
2100
+ settings: openSettings,
2082
2101
  // --target selects the Xcode application target on native opens; honor it
2083
2102
  // on dev-server opens too, where the multi-target error sends strangers
2084
2103
  iosTarget:
@@ -8,7 +8,7 @@ interface DesktopOptions {
8
8
  device?: string
9
9
  }
10
10
 
11
- const DESKTOP_VALUE_FLAGS = new Set(['--profile', '--channel'])
11
+ const DESKTOP_VALUE_FLAGS = new Set(['--storage-profile', '--channel'])
12
12
 
13
13
  function printHelp(): void {
14
14
  console.log(`
@@ -21,8 +21,8 @@ usage:
21
21
 
22
22
  options:
23
23
  --port <number> connect to a running dev server on this port
24
- --profile <id> launch with an isolated persistent storage profile
25
- --ephemeral launch with a temporary isolated storage profile
24
+ --storage-profile <id> launch with an isolated persistent storage profile
25
+ --ephemeral launch with a temporary isolated storage profile
26
26
  --electron launch Electron on Windows; native app on Mac and Linux
27
27
  --native launch (macOS arm64) or install (also Linux x64) the native host
28
28
  -y, --yes install without prompting