rnxsim 0.0.0 → 0.1.312
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.
- package/LICENSE +21 -0
- package/README.md +512 -0
- package/detox/colors.ts +54 -0
- package/detox/config-loader.ts +135 -0
- package/detox/element-types.ts +39 -0
- package/detox/expectations.ts +537 -0
- package/detox/gestures.ts +480 -0
- package/detox/index.ts +2118 -0
- package/detox/jest-preset.cjs +51 -0
- package/detox/jest-setup-after-env.cjs +18 -0
- package/detox/matchers.ts +30 -0
- package/detox/motion-change.cjs +109 -0
- package/detox/motion-change.d.cts +35 -0
- package/detox/navigation.ts +43 -0
- package/detox/screenshots/animated-color-test-rest-norngh.png +0 -0
- package/detox/screenshots/color-test-after-drag-norngh.png +0 -0
- package/detox/screenshots/color-test-rest-norngh.png +0 -0
- package/detox/screenshots/theme-blue-toggle.png +0 -0
- package/detox/screenshots/theme-blue.png +0 -0
- package/detox/screenshots/theme-red-toggle.png +0 -0
- package/detox/screenshots/theme-red.png +0 -0
- package/dist-cli/bin.js +15 -0
- package/dist-cli/chunks/agent-NXVDDCFG.js +48 -0
- package/dist-cli/chunks/agent-wrapper-DXJCFKL3.js +17 -0
- package/dist-cli/chunks/app-fonts-W5AJZQJF.js +4 -0
- package/dist-cli/chunks/assert-3LOJEUDT.js +49 -0
- package/dist-cli/chunks/auth-MFTYYPNX.js +12 -0
- package/dist-cli/chunks/beta-GT3NN67B.js +4 -0
- package/dist-cli/chunks/camera-6EAK7CUL.js +22 -0
- package/dist-cli/chunks/chunk-274UD5FD.js +4 -0
- package/dist-cli/chunks/chunk-2SA2VTGP.js +5 -0
- package/dist-cli/chunks/chunk-33FKQH54.js +5 -0
- package/dist-cli/chunks/chunk-37I5AIS7.js +3 -0
- package/dist-cli/chunks/chunk-3D57IBPC.js +4 -0
- package/dist-cli/chunks/chunk-4BXCZHAU.js +4 -0
- package/dist-cli/chunks/chunk-5OX7ANRA.js +5 -0
- package/dist-cli/chunks/chunk-66NF2KNG.js +9 -0
- package/dist-cli/chunks/chunk-6UKJB2VC.js +125 -0
- package/dist-cli/chunks/chunk-7INBNA3U.js +26 -0
- package/dist-cli/chunks/chunk-7VWOSTD5.js +5 -0
- package/dist-cli/chunks/chunk-AY47WKS5.js +23 -0
- package/dist-cli/chunks/chunk-B7KMNHX7.js +4 -0
- package/dist-cli/chunks/chunk-BKNOLP3J.js +4 -0
- package/dist-cli/chunks/chunk-BRIZOR4K.js +28 -0
- package/dist-cli/chunks/chunk-DM6KUAOZ.js +4 -0
- package/dist-cli/chunks/chunk-EUAVBTKU.js +4 -0
- package/dist-cli/chunks/chunk-FTC4M26Q.js +4 -0
- package/dist-cli/chunks/chunk-FWYYCUAZ.js +4 -0
- package/dist-cli/chunks/chunk-G74YIEVS.js +7 -0
- package/dist-cli/chunks/chunk-GZDHEONW.js +507 -0
- package/dist-cli/chunks/chunk-HG7ORJMT.js +5 -0
- package/dist-cli/chunks/chunk-HMDOLCKG.js +15 -0
- package/dist-cli/chunks/chunk-JG6S4RSH.js +4 -0
- package/dist-cli/chunks/chunk-KR5BGMBZ.js +4 -0
- package/dist-cli/chunks/chunk-KZW5WBGU.js +983 -0
- package/dist-cli/chunks/chunk-L24Z3CRS.js +30 -0
- package/dist-cli/chunks/chunk-LDQ7HVCW.js +4 -0
- package/dist-cli/chunks/chunk-MENV7VLD.js +4 -0
- package/dist-cli/chunks/chunk-MNGQ42QE.js +568 -0
- package/dist-cli/chunks/chunk-N6A3SXMR.js +4 -0
- package/dist-cli/chunks/chunk-NLEMQ4PY.js +6 -0
- package/dist-cli/chunks/chunk-NPVGMH2N.js +101 -0
- package/dist-cli/chunks/chunk-OR3XTXEB.js +107 -0
- package/dist-cli/chunks/chunk-PEPUGJVI.js +4 -0
- package/dist-cli/chunks/chunk-Q3RGLERJ.js +142 -0
- package/dist-cli/chunks/chunk-SI3BUTQR.js +4 -0
- package/dist-cli/chunks/chunk-T4FT6CM7.js +4 -0
- package/dist-cli/chunks/chunk-TBMVBI26.js +7 -0
- package/dist-cli/chunks/chunk-TCWQJILS.js +5 -0
- package/dist-cli/chunks/chunk-TGQNQ6XT.js +766 -0
- package/dist-cli/chunks/chunk-TYE3WBSR.js +5 -0
- package/dist-cli/chunks/chunk-U4PN6JOT.js +6 -0
- package/dist-cli/chunks/chunk-VUFRB347.js +4 -0
- package/dist-cli/chunks/chunk-VZBLFMYC.js +10 -0
- package/dist-cli/chunks/chunk-WBT32R6N.js +25 -0
- package/dist-cli/chunks/chunk-XRGEEPJ5.js +38 -0
- package/dist-cli/chunks/chunk-Y2FSZSO7.js +71 -0
- package/dist-cli/chunks/chunk-YRV7HR3P.js +74 -0
- package/dist-cli/chunks/chunk-YZRFF4YA.js +14 -0
- package/dist-cli/chunks/chunk-ZMZTHU7V.js +4 -0
- package/dist-cli/chunks/cleanup-H3GWQB63.js +25 -0
- package/dist-cli/chunks/cli-version-3QPAJ3LC.js +4 -0
- package/dist-cli/chunks/compat-5WG2XJV7.js +20 -0
- package/dist-cli/chunks/config-ANMBVVLL.js +13 -0
- package/dist-cli/chunks/control-NSGNQFJG.js +4 -0
- package/dist-cli/chunks/daemon-JHF4BJ3U.js +4 -0
- package/dist-cli/chunks/debug-CHV2O2KF.js +200 -0
- package/dist-cli/chunks/desktop-FIPIK4CH.js +31 -0
- package/dist-cli/chunks/detox-CVUJP7K6.js +52 -0
- package/dist-cli/chunks/device-6WCUM4W6.js +18 -0
- package/dist-cli/chunks/diagnose-I6EMWEII.js +43 -0
- package/dist-cli/chunks/disk-cleanup-P27CYFTN.js +4 -0
- package/dist-cli/chunks/drivers-HQ6AKZT6.js +4 -0
- package/dist-cli/chunks/film-UOQFFYNF.js +74 -0
- package/dist-cli/chunks/flow-N27MRRNL.js +4 -0
- package/dist-cli/chunks/help-SF6FEGEE.js +4 -0
- package/dist-cli/chunks/hidden-runtime-alias-NJYFSJKZ.js +4 -0
- package/dist-cli/chunks/home-paths-XOV44JEF.js +4 -0
- package/dist-cli/chunks/inspect-CWFRFQTY.js +4 -0
- package/dist-cli/chunks/install-desktop-KLQDNXZQ.js +4 -0
- package/dist-cli/chunks/login-BPFQENCX.js +28 -0
- package/dist-cli/chunks/logout-5A45ZGY7.js +4 -0
- package/dist-cli/chunks/maestro-E4CSDMLM.js +104 -0
- package/dist-cli/chunks/maestro-generate-CKMOJQX2.js +36 -0
- package/dist-cli/chunks/mode-SZYNMIQF.js +26 -0
- package/dist-cli/chunks/optional-demo-registry-FRH4SFVG.js +4 -0
- package/dist-cli/chunks/perf-VXU2XJAX.js +48 -0
- package/dist-cli/chunks/permissions-IRIAOVND.js +13 -0
- package/dist-cli/chunks/record-RY7FPLLH.js +72 -0
- package/dist-cli/chunks/report-issue-KNWXOE53.js +29 -0
- package/dist-cli/chunks/runtime-AR3GJTGK.js +4 -0
- package/dist-cli/chunks/screenshot-command-QLALR6GY.js +159 -0
- package/dist-cli/chunks/screenshot-layers-OQFMFVRL.js +20 -0
- package/dist-cli/chunks/screenshots-capture-6TSRJFGB.js +42 -0
- package/dist-cli/chunks/serve-F54J2NQO.js +44 -0
- package/dist-cli/chunks/setup-7V6UKX4U.js +32 -0
- package/dist-cli/chunks/skills-QQBOSETH.js +50 -0
- package/dist-cli/chunks/storage-TAPMKK5O.js +37 -0
- package/dist-cli/chunks/store-7NX3S43H.js +4 -0
- package/dist-cli/chunks/telemetry-E7BUK6RA.js +4 -0
- package/dist-cli/chunks/timeline-IAM564NA.js +24 -0
- package/dist-cli/chunks/upgrade-CD55QXIX.js +7 -0
- package/dist-cli/chunks/upload-GZ6LIMYM.js +4 -0
- package/dist-cli/chunks/version-3DYJ5AS3.js +6 -0
- package/dist-cli/chunks/web-6NW6YLPI.js +4 -0
- package/dist-cli/chunks/what-happened-CZZDOOVG.js +25 -0
- package/dist-lib/agent-daemon-client.cjs +468 -0
- package/dist-lib/agent-events.cjs +48 -0
- package/dist-lib/agent-identity.cjs +53 -0
- package/dist-lib/agent-sessions.cjs +725 -0
- package/dist-lib/attached-projects.cjs +526 -0
- package/dist-lib/auth/shared-session.cjs +195 -0
- package/dist-lib/backend-origin.cjs +70 -0
- package/dist-lib/beta.cjs +41 -0
- package/dist-lib/beta.mjs +13 -0
- package/dist-lib/bridge-constants.cjs +161 -0
- package/dist-lib/cli-constants.cjs +32 -0
- package/dist-lib/config.cjs +96 -0
- package/dist-lib/detox/index.cjs +2863 -0
- package/dist-lib/detox/jest-preset.cjs +51 -0
- package/dist-lib/dev-bundle-resolution.cjs +223 -0
- package/dist-lib/home-paths.cjs +421 -0
- package/dist-lib/host/bridge-host.cjs +5600 -0
- package/dist-lib/host/fetch-proxy-handler.cjs +373 -0
- package/dist-lib/host/fetch-proxy-overrides.cjs +63 -0
- package/dist-lib/host/fetch-proxy-overrides.mjs +37 -0
- package/dist-lib/host/websocket-proxy.cjs +214 -0
- package/dist-lib/index.cjs +513 -0
- package/dist-lib/jump-to-source-babel.cjs +93 -0
- package/dist-lib/menu.cjs +620 -0
- package/dist-lib/menu.mjs +581 -0
- package/dist-lib/metro.cjs +297 -0
- package/dist-lib/profiles.cjs +246 -0
- package/dist-lib/public-brand.cjs +39 -0
- package/dist-lib/render-mode.cjs +54 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1034 -0
- package/dist-lib/sdk.cjs +2333 -0
- package/dist-lib/sdk.mjs +2240 -0
- package/dist-lib/skills.cjs +23911 -0
- package/dist-lib/vite.cjs +358 -0
- package/package.json +189 -18
- package/scripts/dev-server-scanner.ts +941 -0
- package/scripts/optional-demo-registry.ts +113 -0
- package/scripts/postinstall.cjs +3 -0
- package/scripts/preuninstall.cjs +118 -0
- package/skills/contrast/SKILL.md +171 -0
- package/skills/rnx-debug/SKILL.md +425 -0
- package/skills/rnx-perf/SKILL.md +295 -0
- package/skills/rnx-setup/SKILL.md +160 -0
- package/skills/rnx-test/SKILL.md +292 -0
- package/skills/rnx-visual/SKILL.md +122 -0
- package/src/agent-daemon-client.ts +410 -0
- package/src/agent-events.ts +71 -0
- package/src/agent-identity.ts +23 -0
- package/src/agent-prompt.ts +71 -0
- package/src/agent-sessions.ts +573 -0
- package/src/attached-projects.ts +539 -0
- package/src/auth/shared-session.ts +204 -0
- package/src/backend-origin.ts +49 -0
- package/src/beta.ts +19 -0
- package/src/bridge-constants.ts +171 -0
- package/src/browser-cache.ts +16 -0
- package/src/cli-constants.ts +1 -0
- package/src/cli-version.ts +32 -0
- package/src/codex-client.ts +215 -0
- package/src/config.ts +134 -0
- package/src/dev-bundle-resolution.ts +236 -0
- package/src/disk-cleanup.ts +466 -0
- package/src/home-paths.ts +552 -0
- package/src/host/agent-host.ts +666 -0
- package/src/host/bridge-host.ts +2626 -0
- package/src/host/fetch-proxy-handler.ts +397 -0
- package/src/host/fetch-proxy-overrides.ts +51 -0
- package/src/host/open-url.ts +89 -0
- package/src/host/websocket-proxy.ts +210 -0
- package/src/index.ts +12 -705
- package/src/jump-to-source-babel.ts +135 -0
- package/src/menu.ts +734 -0
- package/src/metro-plugin.ts +139 -0
- package/src/native-dev-bundle-url.ts +96 -0
- package/src/native-seam-manifest.ts +341 -0
- package/src/plist.ts +27 -0
- package/src/poll-until.ts +92 -0
- package/src/profiles.ts +179 -0
- package/src/public-brand.ts +9 -0
- package/src/render-mode.ts +27 -0
- package/src/runtime-assets.ts +228 -0
- package/src/runtime-delivery.ts +54 -0
- package/src/screenshots/compose.ts +422 -0
- package/src/screenshots/frame-compose.ts +454 -0
- package/src/screenshots/orchestrate.ts +256 -0
- package/src/screenshots/org-deck.ts +91 -0
- package/src/screenshots/registry.ts +58 -0
- package/src/screenshots/schema.ts +364 -0
- package/src/sdk.ts +7 -0
- package/src/settings-bundle.ts +418 -0
- package/src/skills/builtin/a11y-review.ts +132 -0
- package/src/skills/builtin/compat-check.ts +71 -0
- package/src/skills/builtin/maestro-test.ts +121 -0
- package/src/skills/builtin/perf-profile.ts +90 -0
- package/src/skills/builtin/screenshot-all.ts +52 -0
- package/src/skills/builtin/visual-diff.ts +100 -0
- package/src/skills/registry.ts +107 -0
- package/src/skills/types.ts +41 -0
- package/src/team-machine-prompt.ts +73 -0
- package/src/vite-plugin-one.ts +190 -0
- package/src/vite-plugin.ts +1750 -0
- package/src/worklets-babel.ts +134 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{c as E,d as O,f as L,g as R,h as P}from"./chunk-MNGQ42QE.js";import"./chunk-BRIZOR4K.js";import"./chunk-2SA2VTGP.js";import{b as k}from"./chunk-KZW5WBGU.js";import"./chunk-LDQ7HVCW.js";import{a as S}from"./chunk-Q3RGLERJ.js";import"./chunk-Y2FSZSO7.js";import{b as $,c as F,d as T,e as M}from"./chunk-NPVGMH2N.js";import{a as A}from"./chunk-BKNOLP3J.js";import"./chunk-HMDOLCKG.js";import"./chunk-SI3BUTQR.js";import"./chunk-274UD5FD.js";import"./chunk-XRGEEPJ5.js";import"./chunk-TGQNQ6XT.js";import"./chunk-GZDHEONW.js";import"./chunk-G74YIEVS.js";import"./chunk-T4FT6CM7.js";import"./chunk-YZRFF4YA.js";import"./chunk-4BXCZHAU.js";import"./chunk-FWYYCUAZ.js";import"./chunk-AY47WKS5.js";import"./chunk-3D57IBPC.js";import"./chunk-7INBNA3U.js";import"./chunk-PEPUGJVI.js";import"./chunk-N6A3SXMR.js";import"./chunk-TCWQJILS.js";import"./chunk-B7KMNHX7.js";import"./chunk-U4PN6JOT.js";import"./chunk-HG7ORJMT.js";import"./chunk-TYE3WBSR.js";import"./chunk-5OX7ANRA.js";import"./chunk-33FKQH54.js";import"./chunk-7VWOSTD5.js";import"./chunk-6UKJB2VC.js";import"./chunk-66NF2KNG.js";import"./chunk-ZMZTHU7V.js";import"./chunk-MENV7VLD.js";import*as n from"fs";import*as a from"path";var I=[".maestro","maestro"];function W(){console.log(`
|
|
5
|
+
rnxsim maestro \u2014 author and run Maestro YAML flows against rnx
|
|
6
|
+
|
|
7
|
+
usage:
|
|
8
|
+
rnxsim maestro # discover .maestro/ or maestro/ in cwd, run all
|
|
9
|
+
rnxsim maestro test <flow-or-dir> # mirrors "maestro test"
|
|
10
|
+
rnxsim maestro test .maestro/ # every *.yaml / *.yml in a directory
|
|
11
|
+
rnxsim maestro generate "<goal>" # generate, run, and upload a Maestro flow
|
|
12
|
+
rnxsim maestro start|keep|end # author a flow from live CLI actions
|
|
13
|
+
rnxsim maestro validate <flow> # validate a Maestro YAML file
|
|
14
|
+
rnxsim maestro init # scaffold .maestro/login.yaml
|
|
15
|
+
rnxsim maestro --list-compat # print supported/unsupported verbs
|
|
16
|
+
|
|
17
|
+
options:
|
|
18
|
+
--env KEY=VALUE set env vars for \${KEY} interpolation (repeatable)
|
|
19
|
+
--continuous re-run the flow on file changes (alias for --watch)
|
|
20
|
+
--format <fmt> accepted for maestro cli compat (not used)
|
|
21
|
+
--new force a fresh browser window for this run
|
|
22
|
+
--headed force a fresh, VISIBLE window (implies --new,
|
|
23
|
+
overrides --headless) \u2014 watch the flow run live
|
|
24
|
+
--record record a webm while the flow runs
|
|
25
|
+
--preview record events+video, upload, and print /preview/<id>
|
|
26
|
+
--preview-open open the uploaded preview link after a successful run
|
|
27
|
+
--preview-origin <url> upload target for --preview
|
|
28
|
+
--preview-public-origin <url>
|
|
29
|
+
public link origin for --preview
|
|
30
|
+
--slow <ms> delay between steps for natural pacing
|
|
31
|
+
|
|
32
|
+
examples:
|
|
33
|
+
rnxsim maestro test .maestro/login.yaml
|
|
34
|
+
rnxsim maestro test .maestro/
|
|
35
|
+
rnxsim maestro generate "log in and verify the welcome screen"
|
|
36
|
+
rnxsim maestro start
|
|
37
|
+
rnxsim maestro end --output .maestro/login.yaml --validate
|
|
38
|
+
rnxsim maestro --env USERNAME=alice test .maestro/login.yaml
|
|
39
|
+
rnxsim maestro init
|
|
40
|
+
`)}function D(){console.log(`
|
|
41
|
+
rnxsim maestro \u2014 compatibility matrix
|
|
42
|
+
|
|
43
|
+
supported verbs:
|
|
44
|
+
launchApp, stopApp, clearState, clearKeychain (warn-only),
|
|
45
|
+
tapOn, tapAtCoords, longPressOn,
|
|
46
|
+
inputText, pressKey, dispatchKey, hideKeyboard, eraseText,
|
|
47
|
+
assertVisible, assertNotVisible, assertTreeContains,
|
|
48
|
+
waitFor, extendedWaitUntil, waitForAnimationToEnd,
|
|
49
|
+
scroll, scrollUntilVisible, scrollTo, swipe, pinch,
|
|
50
|
+
takeScreenshot, dumpTree, back,
|
|
51
|
+
repeat (times), runFlow (file / inline commands / env / when),
|
|
52
|
+
runScript (maestro JS: http, json(), output, env vars, console.log),
|
|
53
|
+
evalScript, copyTextFrom (\${maestro.copiedText}), openLink,
|
|
54
|
+
when: (visible / notVisible / platform / true),
|
|
55
|
+
optional:, label:, onFlowStart, onFlowComplete,
|
|
56
|
+
\${...} JS-expression interpolation at step execution time
|
|
57
|
+
(env vars as globals, output.*, maestro.*, \${EXPR || 'default'}).
|
|
58
|
+
|
|
59
|
+
workspace mode (directory runs):
|
|
60
|
+
config.yaml / config.yml discovery, flows: inclusion globs,
|
|
61
|
+
includeTags / excludeTags against flow frontmatter tags.
|
|
62
|
+
|
|
63
|
+
partial:
|
|
64
|
+
clearKeychain \u2014 warn-only, rnx has no keychain surface.
|
|
65
|
+
when.platform \u2014 rnx reports iOS.
|
|
66
|
+
openLink \u2014 dispatched into the app via the Linking emulation
|
|
67
|
+
(react-navigation deep links work); no OS-level Safari fallback.
|
|
68
|
+
launchApp.arguments \u2014 ignored; rnx has no native process.
|
|
69
|
+
launchApp.resetRuntime \u2014 sootsim-only extension for recorded benchmarks:
|
|
70
|
+
keep tenant storage/auth, but soft-reload the guest app inside launchApp.
|
|
71
|
+
takeScreenshot \u2014 maestro string form works unchanged; rnx also accepts
|
|
72
|
+
{ path, withFrame } for framed export.
|
|
73
|
+
env \u2014 rnx seeds the JS env from the full shell environment, not just
|
|
74
|
+
MAESTRO_* (so \${SOOTSIM_*} credentials resolve); a bare \${NAME} that is
|
|
75
|
+
undefined fails the step loudly instead of typing "undefined".
|
|
76
|
+
|
|
77
|
+
not yet implemented (will throw "unsupported maestro verb"):
|
|
78
|
+
travel, setLocation, setAirplaneMode, killApp, faker,
|
|
79
|
+
addMedia, startRecording, stopRecording (use --record flag),
|
|
80
|
+
repeat.while (only repeat.times is supported).
|
|
81
|
+
`)}function U(t){return t.startsWith("-")}function Y(t){let s=[];for(let e=0;e<t.length;e++){if(t[e]==="--env"||t[e]==="-e"){let r=t[e+1];if(!r||!r.includes("="))throw new Error(`--env expects KEY=VALUE (got ${JSON.stringify(r??"")})`);let i=r.indexOf("="),c=r.slice(0,i),u=r.slice(i+1);process.env[c]=u,e+=1;continue}s.push(t[e])}return s}function J(t){let s=[];for(let e=0;e<t.length;e++){let r=t[e];if(r==="--format"||r==="--output"||r==="--device"||r==="-d"){e+=1;continue}if(r==="--continuous"){console.warn(" warn: --continuous is not yet implemented in rnx \u2014 running once");continue}s.push(r)}return s}function j(t){for(let s of I){let e=a.join(t,s);if(n.existsSync(e)&&n.statSync(e).isDirectory())return e}return null}function N(t){let s=n.statSync(t);if(s.isFile())return[t];if(!s.isDirectory())throw new Error(`not a file or directory: ${t}`);let e={},r=["config.yaml","config.yml"].map(l=>a.join(t,l)).find(l=>n.existsSync(l));if(r){let l=S.parse(n.readFileSync(r,"utf8"));l&&typeof l=="object"&&(e=l)}let i=Array.isArray(e.flows)&&e.flows.length>0?e.flows:["*"],c=l=>{let p=a.basename(l);return!(p.startsWith(".")||!p.endsWith(".yaml")&&!p.endsWith(".yml")||p==="config.yaml"||p==="config.yml")},u=new Set;for(let l of i)for(let p of n.globSync(l,{cwd:t})){if(!c(p))continue;let d=a.join(t,p);n.existsSync(d)&&n.statSync(d).isFile()&&u.add(d)}let m=[...u].sort(),y=Array.isArray(e.includeTags)?e.includeTags:[],w=Array.isArray(e.excludeTags)?e.excludeTags:[];return(y.length>0||w.length>0)&&(m=m.filter(l=>{let{frontmatter:p}=k(n.readFileSync(l,"utf8")),d=Array.isArray(p.tags)?p.tags:[];return!(y.length>0&&!d.some(h=>y.includes(h))||d.some(h=>w.includes(h)))})),m}async function _(t){let s=a.join(t,".maestro");n.mkdirSync(s,{recursive:!0});let e=a.join(s,"login.yaml");return n.existsSync(e)?(console.error(` error: ${e} already exists`),1):(n.writeFileSync(e,`# rnxsim maestro starter flow \u2014 drop-in compatible with the maestro cli.
|
|
82
|
+
# run: rnxsim maestro test .maestro/login.yaml
|
|
83
|
+
appId: com.example.app
|
|
84
|
+
---
|
|
85
|
+
- launchApp
|
|
86
|
+
- tapOn:
|
|
87
|
+
id: "email"
|
|
88
|
+
- inputText: "user@example.com"
|
|
89
|
+
- tapOn:
|
|
90
|
+
id: "password"
|
|
91
|
+
- inputText: "secret123"
|
|
92
|
+
- tapOn: "Sign in"
|
|
93
|
+
- assertVisible: "Welcome"
|
|
94
|
+
`,"utf8"),console.log(` + wrote ${e}`),console.log(" next: rnxsim maestro test .maestro/login.yaml"),0)}async function Q(t,s={}){if(t.includes("--help")||t.includes("-h"))return W(),0;if(t.includes("--list-compat"))return D(),0;let e;try{e=Y(t)}catch(o){return console.error(` error: ${o.message}`),1}e=R(e);let r=process.cwd(),i=e[0];if(i==="init")return _(r);if(i==="generate"){let{runMaestroGenerate:o}=await import("./maestro-generate-CKMOJQX2.js");return o(e.slice(1))}if(i==="start"||i==="keep"||i==="good"||i==="end"||i==="validate")return P(e);e=J(e);let c=null,u;if(i==="test"){let o=e.slice(1).find(f=>!U(f));o?(c=a.resolve(r,o),u=e.slice(1).filter(f=>f!==o)):(c=j(r),u=e.slice(1))}else i&&!U(i)?(c=a.resolve(r,i),u=e.slice(1)):(c=j(r),u=e);if(!c)return console.error(`
|
|
95
|
+
error: no maestro flows found.
|
|
96
|
+
expected one of: ${I.map(o=>`./${o}/`).join(", ")}
|
|
97
|
+
or pass a flow explicitly: rnxsim maestro test path/to/flow.yaml
|
|
98
|
+
or scaffold a starter flow: rnxsim maestro init
|
|
99
|
+
`),1;if(!n.existsSync(c))return console.error(` error: ${c} not found`),1;let m;try{m=N(c)}catch(o){return console.error(` error: ${o.message}`),1}if(m.length===0)return console.error(` error: no *.yaml or *.yml files found in ${c}`),1;console.log(`
|
|
100
|
+
rnxsim maestro \u2014 ${m.length} flow${m.length===1?"":"s"}
|
|
101
|
+
root: ${a.relative(r,c)||"."}
|
|
102
|
+
`);let y=A(),w=o=>{let f=u.indexOf(o);return f>=0?u[f+1]:void 0},l=null,p=()=>l??=M(w("--preview-origin")??w("--origin")),d=0,h=[];for(let o of m){console.log(`
|
|
103
|
+
\u25B6 ${a.relative(r,o)}`);let f=[o,...u];s.port&&f.push("--port",String(s.port));let g=0,V=Date.now();try{g=await L(f)}catch(x){console.error(` x ${x.message}`),g=1}h.push({file:o,exit:g}),g!==0&&d===0&&(d=g);let b=E();if(F({uploadedShare:!!b,auth:y})){let x=O(),C=x.find(K=>K.status==="failure"),v=await T({origin:await p(),kind:"maestro",name:a.relative(r,o),status:g===0?"passed":"failed",failureMessage:g===0?null:C?.error??"flow playback failed",previewShareId:b?.shareId??null,owner:w("--owner")??null,repo:w("--repo")??null,durationMs:Date.now()-V,...$(x),auth:y});v&&console.log(` run: ${v.id}${v.traceUrl?` \xB7 replay: ${v.traceUrl}`:""}`)}}if(m.length>1){console.log(`
|
|
104
|
+
maestro summary:`);for(let f of h){let g=f.exit===0?"pass":"fail";console.log(` ${g} ${a.relative(r,f.file)}`)}let o=h.filter(f=>f.exit===0).length;console.log(` ${o}/${h.length} passed`)}return d}export{N as collectFlowFiles,Q as runMaestro};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a as x}from"./chunk-Q3RGLERJ.js";import{b as O,d as A,e as E}from"./chunk-NPVGMH2N.js";import{a as S,b as T}from"./chunk-BKNOLP3J.js";import{f as y}from"./chunk-TGQNQ6XT.js";import"./chunk-T4FT6CM7.js";import"./chunk-YZRFF4YA.js";import"./chunk-FWYYCUAZ.js";import"./chunk-3D57IBPC.js";import{h as b,j as v}from"./chunk-7INBNA3U.js";import"./chunk-N6A3SXMR.js";import"./chunk-TCWQJILS.js";import"./chunk-33FKQH54.js";import"./chunk-7VWOSTD5.js";import"./chunk-66NF2KNG.js";import"./chunk-ZMZTHU7V.js";import"./chunk-MENV7VLD.js";import{mkdtempSync as B,writeFileSync as N}from"fs";import{tmpdir as C}from"os";import{join as k}from"path";var J=process.env.SOOTSIM_TEST_MODEL||"deepseek-v4-flash",_=18e3,j=18e4;function f(e,t){let r=e.indexOf(t);return r>=0?e[r+1]:void 0}function V(e,t){for(let r of t){let o=f(e,r);if(o)return o}}var F=new Set(["--origin","--preview-origin","--public-origin","--preview-public-origin","--owner","--repo","--url","--driver","--sim","--device","--slow","--tail-wait","--remap","--replace"]);function G(e){for(let t=0;t<e.length;t++){let r=e[t];if(r){if(F.has(r)){t+=1;continue}if(!r.startsWith("-"))return{prompt:r,index:t}}}return null}function H(e,t){return e.filter((r,o)=>o!==t)}async function Y(e,t){let r=H(e,t),o=b(r,{stripBooleanFlags:["--new","--headless","--headed","--electron","--preview-open"],stripValueFlags:[...F]}),i=v(o);try{let n=await y(i,{describe:!0,verbose:!1,filter:"",compact:!0,hideXy:!0}),s=[n.shell?`shell: ${JSON.stringify(n.shell)}`:"",n.keyboard?`keyboard: ${JSON.stringify(n.keyboard)}`:"",typeof n.nodeCount=="number"?`nodes: ${n.nodeCount}`:"",n.tree||""].filter(Boolean).join(`
|
|
5
|
+
`);return s.length>_?s.slice(0,_)+`
|
|
6
|
+
[tree truncated]`:s}finally{i.close()}}var K=`
|
|
7
|
+
You write Maestro-compatible rnx YAML flows from a user's plain-language test goal.
|
|
8
|
+
Return only JSON, no markdown, with this exact shape:
|
|
9
|
+
{"summary":"short human-readable result goal","steps":[{"waitFor":{"text":"...","timeout":10000}}]}
|
|
10
|
+
|
|
11
|
+
Use only these flow commands:
|
|
12
|
+
- waitFor: { "text"?: string, "id"?: string, "timeout"?: number }
|
|
13
|
+
- assertVisible: string or { "text"?: string, "id"?: string }
|
|
14
|
+
- assertNotVisible: string or { "text"?: string, "id"?: string }
|
|
15
|
+
- tapOn: string or { "text"?: string, "id"?: string, "index"?: number }
|
|
16
|
+
- inputText: string
|
|
17
|
+
- pressKey: string
|
|
18
|
+
- hideKeyboard: true
|
|
19
|
+
- swipe: { "direction": "UP" | "DOWN" | "LEFT" | "RIGHT", "duration"?: number }
|
|
20
|
+
- waitForAnimationToEnd: true
|
|
21
|
+
- takeScreenshot: "label"
|
|
22
|
+
|
|
23
|
+
Prefer ids/testIDs from the tree. Prefer visible text when no id exists.
|
|
24
|
+
Do not invent app-specific data that is not visible. Keep the flow short.
|
|
25
|
+
End with an assertion or wait that proves the user's goal.
|
|
26
|
+
`.trim();function X(e,t){return`
|
|
27
|
+
User goal:
|
|
28
|
+
${e}
|
|
29
|
+
|
|
30
|
+
Current rnx visible tree:
|
|
31
|
+
${t||"[no tree available]"}
|
|
32
|
+
|
|
33
|
+
Generate the shortest replayable flow that verifies the goal from this current state.
|
|
34
|
+
`.trim()}async function z(e){let t=await fetch(`${e.origin.replace(/\/$/,"")}/api/llm`,{method:"POST",headers:{"content-type":"application/json",authorization:e.authHeader},body:JSON.stringify({modelId:J,context:{systemPrompt:K,messages:[{role:"user",content:X(e.prompt,e.describe),timestamp:Date.now()}]},options:{maxTokens:1800,temperature:.2},threadId:null}),signal:AbortSignal.timeout(j)});if(!t.ok||!t.body){let a=await t.text().catch(()=>"");throw new Error(`/api/llm ${t.status}${a?`: ${a}`:""}`)}let r=t.body.getReader(),o=new TextDecoder,i=[],n="",c=a=>{let l=a.trim();if(!l)return;let u=JSON.parse(l);if(u.type==="text_delta"&&u.delta)i.push(u.delta);else if(u.type==="error")throw new Error(u.errorMessage||"llm error")};for(;;){let{value:a,done:l}=await r.read();if(l)break;n+=o.decode(a,{stream:!0});let u;for(;(u=n.indexOf(`
|
|
35
|
+
`))>=0;)c(n.slice(0,u)),n=n.slice(u+1)}n+=o.decode(),n.trim()&&c(n);let s=i.join("").trim();if(!s)throw new Error("llm returned an empty test flow");return s}function W(e){let t=e.match(/```(?:json)?\s*([\s\S]*?)```/i),r=t?t[1]:e.slice(e.indexOf("{"),e.lastIndexOf("}")+1);return JSON.parse(r)}function P(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function q(e){let t=W(e);if(!P(t))throw new Error("llm did not return a JSON object");let r=typeof t.summary=="string"&&t.summary.trim()?t.summary.trim().slice(0,500):"rnx generated test",o=t.steps;if(!Array.isArray(o)||o.length===0)throw new Error("llm returned no flow steps");let i=o.map((n,c)=>{if(!P(n))throw new Error(`flow step ${c+1} is not an object`);return n});return{summary:r,steps:i,yamlText:x.stringify(i)}}function Q(e,t,r,o){let i=[r,"--preview","--preview-origin",o,"--billing-kind","test_run"],n=new Set(["--public-origin","--preview-public-origin","--owner","--repo","--url","--driver","--sim","--device","--slow","--tail-wait","--remap","--replace"]),c=new Set(["--new","--headless","--headed","--electron","--preview-open","--no-shell","--shell-only"]);for(let s=0;s<e.length;s++){if(s===t)continue;let a=e[s];if(a==="--origin"||a==="--preview-origin"){s+=1;continue}if(a==="--public-origin"){let l=e[s+1];l&&i.push("--preview-public-origin",l),s+=1;continue}if(n.has(a)){let l=e[s+1];l&&i.push(a,l),s+=1;continue}c.has(a)&&i.push(a)}return i}async function le(e){let t=G(e);if(!t)return console.error(' usage: rnxsim maestro generate "test goal"'),1;let{prompt:r,index:o}=t,i=S();if(!i||i.kind==="github")return console.error(' rnxsim maestro generate "<goal>" needs a login or RNX_API_KEY.'),console.error(" API keys must include preview_upload and llm scopes."),1;let n=T(i),c=await E(V(e,["--origin","--preview-origin"]));console.log(" inspecting current sim\u2026");let s=await Y(e,o);console.log(" generating Maestro flow\u2026");let a=await z({prompt:r,describe:s,origin:c,authHeader:n}),l=q(a),u=B(k(C(),"sootsim-maestro-generate-")),p=k(u,"flow.yaml");N(p,l.yamlText),console.log(` flow: ${p}`);let M=Date.now(),{runFlowPlayback:I,getLastFlowPreviewUploadResult:$,getLastFlowTraceSteps:D}=await import("./flow-N27MRRNL.js"),L=Q(e,o,p,c),w=await I(L),m=$(),h=D(),R=h.find(U=>U.status==="failure"),g=w===0?"passed":"failed",d=await A({origin:c,kind:"maestro",prompt:r,summary:l.summary,status:g,failureMessage:g==="failed"?R?.error??"flow playback failed":null,previewShareId:m?.shareId??null,owner:f(e,"--owner")??null,repo:f(e,"--repo")??null,durationMs:Date.now()-M,flowYamlSizeBytes:Buffer.byteLength(l.yamlText,"utf8"),...O(h),auth:i});return console.log(`
|
|
36
|
+
result: ${g}`),d&&console.log(` run: ${d.id}`),m?.previewUrl&&console.log(` preview: ${m.previewUrl}`),d?.traceUrl&&console.log(` replay: ${d.traceUrl}`),w}export{le as runMaestroGenerate};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a as s,b as r}from"./chunk-OR3XTXEB.js";import"./chunk-7INBNA3U.js";import"./chunk-33FKQH54.js";import"./chunk-7VWOSTD5.js";import"./chunk-66NF2KNG.js";import"./chunk-MENV7VLD.js";async function i(e,o){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
5
|
+
rnxsim mode screenshot \u2014 toggle the screenshot-mode chrome overlay
|
|
6
|
+
|
|
7
|
+
usage:
|
|
8
|
+
rnxsim mode screenshot [on|off|toggle]
|
|
9
|
+
|
|
10
|
+
arguments:
|
|
11
|
+
on enable screenshot mode (enables showFrame if needed)
|
|
12
|
+
off disable screenshot mode
|
|
13
|
+
toggle flip the current state (default)
|
|
14
|
+
|
|
15
|
+
examples:
|
|
16
|
+
rnxsim mode screenshot
|
|
17
|
+
rnxsim mode screenshot on
|
|
18
|
+
rnxsim mode screenshot off
|
|
19
|
+
`),process.exit(0)),await s(e,o,{modeKey:"screenshotMode",displayName:"screenshot-mode",actionId:"toggle-screenshot-mode"})}var m=new Set(["--sim","--port","-p"]),c=new Set(["screenshot","three"]);function d(e){for(let o=0;o<e.length;o++){let n=e[o];if(n.startsWith("-")){m.has(n)&&o++;continue}return c.has(n)?{name:n,index:o}:null}return null}function h(e,o){return[...e.slice(0,o),...e.slice(o+1)]}function l(){console.log(`
|
|
20
|
+
rnxsim mode \u2014 toggle live display modes
|
|
21
|
+
|
|
22
|
+
usage:
|
|
23
|
+
rnxsim mode screenshot [on|off|toggle]
|
|
24
|
+
rnxsim mode three [on|off|toggle]
|
|
25
|
+
rnxsim mode three configure [options]
|
|
26
|
+
`)}async function g(e,o){if(e.includes("--help")||e.includes("-h")){l();return}let n=d(e);n||(l(),process.exit(1));let t=h(e,n.index);if(n.name==="screenshot"){await i(t,o);return}await r(t,o)}export{g as runMode};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a,b,c,d}from"./chunk-FWYYCUAZ.js";import"./chunk-MENV7VLD.js";export{d as __withOptionalDemoAppsForTests,a as findInternalDemoRegistry,b as loadOptionalDemoApps,c as optionalDemoAppsSync};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{j as N}from"./chunk-KZW5WBGU.js";import"./chunk-LDQ7HVCW.js";import"./chunk-Q3RGLERJ.js";import"./chunk-Y2FSZSO7.js";import"./chunk-HMDOLCKG.js";import"./chunk-SI3BUTQR.js";import"./chunk-274UD5FD.js";import"./chunk-XRGEEPJ5.js";import"./chunk-TGQNQ6XT.js";import"./chunk-GZDHEONW.js";import"./chunk-G74YIEVS.js";import"./chunk-T4FT6CM7.js";import"./chunk-YZRFF4YA.js";import"./chunk-4BXCZHAU.js";import"./chunk-FWYYCUAZ.js";import"./chunk-AY47WKS5.js";import"./chunk-3D57IBPC.js";import{h as P,j as R,m as d,n as x}from"./chunk-7INBNA3U.js";import"./chunk-PEPUGJVI.js";import"./chunk-B7KMNHX7.js";import"./chunk-U4PN6JOT.js";import"./chunk-HG7ORJMT.js";import"./chunk-TYE3WBSR.js";import"./chunk-5OX7ANRA.js";import"./chunk-33FKQH54.js";import"./chunk-7VWOSTD5.js";import"./chunk-6UKJB2VC.js";import"./chunk-66NF2KNG.js";import"./chunk-ZMZTHU7V.js";import"./chunk-MENV7VLD.js";import{mkdirSync as D,writeFileSync as W}from"fs";import{dirname as A,resolve as J}from"path";import{WebSocket as B}from"ws";var C=e=>new Promise(o=>setTimeout(o,e)),S=class{ws;nextId=1;pending=new Map;listeners=new Set;ready;constructor(o){this.ws=new B(o,{maxPayload:1<<28}),this.ready=new Promise((r,n)=>{this.ws.once("open",()=>r()),this.ws.once("error",n)}),this.ws.on("message",r=>{let n=JSON.parse(r.toString());if(n.id&&this.pending.has(n.id)){let{res:t,rej:s}=this.pending.get(n.id);this.pending.delete(n.id),n.error?s(new Error(JSON.stringify(n.error))):t(n.result)}else if(n.method)for(let t of this.listeners)t(n.method,n.params)})}waitOpen(){return this.ready}on(o){this.listeners.add(o)}send(o,r={},n){let t=this.nextId++;return new Promise((s,a)=>{this.pending.set(t,{res:s,rej:a}),this.ws.send(JSON.stringify({id:t,method:o,params:r,...n?{sessionId:n}:{}}))})}close(){try{this.ws.close()}catch{}}};async function O(e,o){let r=Number(h(e,"--duration")??"5");if(!Number.isFinite(r)||r<=0)return console.error(" --duration must be a positive number (seconds)"),1;let n=Number(h(e,"--sample-interval")??"0.1"),t=Number(h(e,"--cdp-port")??process.env.SOOTSIM_CDP_PORT??"9222"),s=h(e,"--match")??"/rn/",a=h(e,"--output")??h(e,"-o"),i=J(process.cwd(),a??"/tmp/sootsim.cpuprofile"),l=[];try{l=await(await fetch(`http://localhost:${t}/json/list`)).json()}catch{return E(t),1}let f=l.find(m=>m.type==="page"&&m.url.includes(s));if(!f)return console.error(` no page target matching "${s}" on CDP :${t}`),console.error(` open targets: ${l.map(m=>m.url).join(", ")||"(none)"}`),1;let u=new S(f.webSocketDebuggerUrl);await u.waitOpen();try{let m=new Map;if(u.on((c,p)=>{c==="Target.attachedToTarget"&&p.targetInfo?.type==="worker"&&m.set(p.sessionId,p.targetInfo.url),c==="Target.detachedFromTarget"&&m.delete(p.sessionId)}),await u.send("Target.setAutoAttach",{autoAttach:!0,waitForDebuggerOnStart:!1,flatten:!0}),await C(500),m.size===0)return console.error(" no worker targets attached \u2014 is the app loaded in this tab?"),1;for(let c of m.keys())await u.send("Profiler.enable",{},c),await u.send("Profiler.setSamplingInterval",{interval:n*1e3},c),await u.send("Profiler.start",{},c);console.log(` recording ${r}s across ${m.size} worker(s) \u2014 interact now\u2026`),await C(r*1e3);let b=[];for(let[c,p]of m){let{profile:y}=await u.send("Profiler.stop",{},c);b.push({url:p,profile:y})}return b.sort((c,p)=>p.profile.samples.length-c.profile.samples.length),D(A(i),{recursive:!0}),b.forEach((c,p)=>{let y=p===0?i:i.replace(/(\.[^.]+)?$/,`.worker${p}$1`);if(W(y,JSON.stringify(c.profile)),console.log(` ${v(c.url)}: ${c.profile.samples.length} samples \u2192 ${y}`),o.verbose&&c.profile.samples.length>0)for(let $ of U(c.profile,12))console.log(` ${$.pct.toFixed(1).padStart(5)}% ${$.name} ${$.url}`)}),console.log(" open in chrome devtools \u2192 Performance \u2192 Load profile to inspect."),0}finally{u.close()}}function E(e){console.error(` perf cpu needs a CDP-enabled browser on :${e}.`),console.error(" the tenant worker can't be profiled via the JS Self-Profiler API (F28),"),console.error(" so the sim must expose Chrome remote debugging. easiest path \u2014"),console.error(" open the sim with a CDP port (it stays driveable over the bridge,"),console.error(" so you can scroll/navigate while profiling):"),console.error(""),console.error(` rnxsim open <metro-port> --new --driver playwright --cdp-port ${e}`),console.error(` rnxsim perf cpu --cdp-port ${e} --match <metro-port>`),console.error(""),console.error(" or launch a standalone CDP Chrome (not bridge-driveable):"),console.error(""),console.error(' "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \\'),console.error(` --remote-debugging-port=${e} --user-data-dir=/tmp/sootsim-cdp \\`),console.error(" --no-sandbox --disable-gpu-sandbox \\"),console.error(" --use-gl=angle --use-angle=metal \\"),console.error(' "http://localhost:5173/rn/<metro-port>" &'),console.error(""),console.error(" override the port with --cdp-port or $SOOTSIM_CDP_PORT.")}function v(e){return e?e.replace(/^https?:\/\/[^/]+/,"").replace(/\?.*$/,"").slice(-50):"(native)"}function U(e,o){let r=e.samples.length||1,n=new Map;for(let t of e.nodes){let s=t.callFrame,a=`${s.functionName||"(anonymous)"}@${v(s.url)}:${s.lineNumber}`,i=n.get(a)??{self:0,name:s.functionName||"(anonymous)",url:`${v(s.url)}:${s.lineNumber}`};i.self+=t.hitCount??0,n.set(a,i)}return[...n.values()].map(t=>({...t,pct:t.self/r*100})).sort((t,s)=>s.self-t.self).slice(0,o)}function h(e,o){let r=e.indexOf(o);if(!(r<0||r===e.length-1))return e[r+1]}function j(){console.log(`
|
|
5
|
+
rnxsim perf react \u2014 inspect React component render cost in the tenant worker
|
|
6
|
+
|
|
7
|
+
usage:
|
|
8
|
+
rnxsim perf react profile start [--include-props] [--max-commits N]
|
|
9
|
+
rnxsim perf react profile stop
|
|
10
|
+
rnxsim perf react summary [--limit 10] [--json]
|
|
11
|
+
rnxsim perf react slow [--limit 5] [--json]
|
|
12
|
+
rnxsim perf react rerenders [--limit 5] [--json]
|
|
13
|
+
rnxsim perf react tree [--depth 3] [--find <name>] [--json]
|
|
14
|
+
rnxsim perf react why <fiber-id> [--json]
|
|
15
|
+
|
|
16
|
+
\`react summary\` is the demo-friendly shortcut: it runs both slow and
|
|
17
|
+
rerenders in one round-trip, prints them as a single table per side,
|
|
18
|
+
and surfaces the duration-zero warning prominently when the bundle is
|
|
19
|
+
running without React profiler timers.
|
|
20
|
+
|
|
21
|
+
examples:
|
|
22
|
+
rnxsim perf react profile start
|
|
23
|
+
rnxsim do tap-text Inbox
|
|
24
|
+
rnxsim perf react profile stop
|
|
25
|
+
rnxsim perf react summary --limit 10
|
|
26
|
+
rnxsim perf react slow --limit 10
|
|
27
|
+
rnxsim perf react rerenders --json
|
|
28
|
+
`)}function F(e,o){let r=e.indexOf(o);if(r>=0&&r+1<e.length)return e[r+1];let n=`${o}=`,t=e.find(s=>s.startsWith(n));return t?t.slice(n.length):void 0}function w(e,o,r){let n=F(e,o);if(n===void 0)return r;let t=Number(n);return Number.isFinite(t)&&t>0?Math.round(t):r}function M(e,o){let r=e.map((t,s)=>Math.max(t.length,...o.map(a=>a[s]?.length??0))),n=t=>t.map((s,a)=>s.padEnd(r[a])).join(" ").trimEnd();return[n(e),n(e.map(t=>"-".repeat(t.length))),...o.map(n)].map(t=>` ${t}`).join(`
|
|
29
|
+
`)}function g(e){console.log(JSON.stringify(e,null,2))}function T(e){e.error&&console.error(` warning: ${e.error}`),e.durationWarning&&console.error(` warning: ${e.durationWarning}`);let o=e.rows??[];if(o.length===0){console.log(` no React render samples yet (${e.commits??0} commit(s))`);return}console.log(M(["component","total","avg","commits","slowest"],o.map(r=>[r.displayName,`${r.totalMs.toFixed(2)}ms`,`${r.avgMs.toFixed(2)}ms`,String(r.commitCount),`#${r.slowestCommit} ${r.slowestMs.toFixed(2)}ms`])))}function k(e){e.error&&console.error(` warning: ${e.error}`);let o=e.rows??[];if(o.length===0){console.log(` no React render samples yet (${e.commits??0} commit(s))`);return}console.log(M(["component","renders","causes"],o.map(r=>{let n=Object.entries(r.causes??{}).filter(([,t])=>t>0).sort((t,s)=>s[1]-t[1]).slice(0,4).map(([t,s])=>`${t}:${s}`).join(", ");return[r.displayName,String(r.renders??r.count),n||"-"]})))}function _(e){e.error&&console.error(` warning: ${e.error}`);let o=e.rows??[];if(o.length===0){console.log(` no React tree data yet (${e.roots??0} root(s))`);return}for(let r of o){let n=" ".repeat(r.depth);console.log(` ${n}@${r.id} ${r.displayName} [${r.kind}] children=${r.childCount}`)}}function z(e){if(e.error){console.error(` ${e.error}`);return}let o=e.sample;if(!o){console.log(" no sample");return}if(console.log(` @${o.fiberId} ${o.displayName}`),console.log(` duration: ${Number(o.actualDuration??0).toFixed(2)}ms`),console.log(` causes: ${(o.causes??[]).join(", ")||"-"}`),o.propDiffs?.length){console.log(" props:");for(let r of o.propDiffs){let n="old"in r||"new"in r?` ${JSON.stringify(r.old)} \u2192 ${JSON.stringify(r.new)}`:"";console.log(` ${r.key}${n}`)}}o.parentChain?.length&&console.log(` parents: ${o.parentChain.join(" \u2190 ")}`)}async function I(e,o){let r=P(e,{port:o.port,stripBooleanFlags:["--json","--include-props","--help","-h"],stripValueFlags:["--limit","--depth","--find","--max-commits"]});if(e.includes("--help")||e.includes("-h"))return j(),0;let[n,t]=r.positional,s=e.includes("--json"),a=R(r);try{if(n==="profile"&&t==="start"){let i=await x(a,"SootSim.bridges.reactProfile.start",{includeProps:e.includes("--include-props"),maxCommits:w(e,"--max-commits",2e3)});return s?g(i):console.log(" React profile started"),0}if(n==="profile"&&t==="stop"){let i=await x(a,"SootSim.bridges.reactProfile.stop");return s?g(i):(console.log(` React profile stopped (${i.commits??0} commit(s))`),i.error&&console.error(` warning: ${i.error}`)),i.error?1:0}if(n==="summary"){let i=w(e,"--limit",10),[l,f]=await Promise.all([d(a,"SootSim.bridges.reactProfile.slow",{limit:i}),d(a,"SootSim.bridges.reactProfile.rerenders",{limit:i})]);if(s)return g({commits:l.commits??f.commits??0,slow:l,rerenders:f}),0;let u=l.commits??f.commits??0;console.log(` React profile summary (${u} commit(s)):`),l.error&&console.error(` warning: ${l.error}`),l.durationWarning&&console.error(` warning: ${l.durationWarning}`),f.error&&console.error(` warning: ${f.error}`),console.log(`
|
|
30
|
+
slowest renders:`),T(l),console.log(`
|
|
31
|
+
most rerenders:`),k(f);let m=l.rows?.[0];return(l.rows&&l.rows.length>0?l.rows.every(c=>c.totalMs<=0&&c.slowestMs<=0):!1)&&!l.durationWarning&&console.error(`
|
|
32
|
+
warning: every commit reports actualDuration=0ms \u2014 the React profiler timer is disabled in this bundle (rerender counts are still accurate; ${m?.displayName?`top-listed: ${m.displayName}`:"no slow signal"}).`),0}if(n==="slow"){let i=await d(a,"SootSim.bridges.reactProfile.slow",{limit:w(e,"--limit",10)});return s?g(i):T(i),0}if(n==="rerenders"){let i=await d(a,"SootSim.bridges.reactProfile.rerenders",{limit:w(e,"--limit",10)});return s?g(i):k(i),0}if(n==="tree"){let i=await d(a,"SootSim.bridges.reactProfile.tree",{depth:w(e,"--depth",3),find:F(e,"--find")});return s?g(i):_(i),0}if(n==="why"){let i=Number(t);if(!Number.isFinite(i)||i<=0)return console.error(" usage: rnxsim perf react why <fiber-id>"),1;let l=await d(a,"SootSim.bridges.reactProfile.why",Math.round(i));return s?g(l):z(l),l.error?1:0}return j(),n?1:0}finally{a.close()}}var G=new Set(["--sim","--port","-p"]),L=new Set(["cpu","react","shell","scroll"]);function H(e){for(let o=0;o<e.length;o++){let r=e[o];if(r.startsWith("-")){G.has(r)&&o++;continue}return L.has(r)?{name:r,index:o}:null}return null}function V(e,o){return[...e.slice(0,o),...e.slice(o+1)]}function Z(){console.log(`
|
|
33
|
+
rnxsim perf \u2014 performance profiling tools
|
|
34
|
+
|
|
35
|
+
usage:
|
|
36
|
+
rnxsim perf cpu [options]
|
|
37
|
+
rnxsim perf react <subcommand> [options]
|
|
38
|
+
rnxsim perf shell <start|stop|transition> [options]
|
|
39
|
+
rnxsim perf scroll <start|stop> [options]
|
|
40
|
+
|
|
41
|
+
examples:
|
|
42
|
+
rnxsim perf cpu --duration 5 --output /tmp/trace.cpuprofile
|
|
43
|
+
rnxsim perf react summary --limit 10
|
|
44
|
+
rnxsim perf shell start
|
|
45
|
+
rnxsim perf shell stop --json
|
|
46
|
+
rnxsim perf scroll start
|
|
47
|
+
rnxsim perf scroll stop --json
|
|
48
|
+
`)}async function te(e,o){let r=H(e);if(!r)return Z(),e.includes("--help")||e.includes("-h")?0:1;let n=V(e,r.index);if(r.name==="cpu")return O(n,o);if(r.name==="react")return I(n,o);let t=n.includes("--help")||n.includes("-h")?[]:n;return await N(["debug","perf",...t],{...o,internalPerfCommand:r.name==="scroll"?"scroll":"shell"}),typeof process.exitCode=="number"?process.exitCode:0}export{te as runPerf};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{h,j as w,m as l,n as u}from"./chunk-7INBNA3U.js";import"./chunk-33FKQH54.js";import"./chunk-7VWOSTD5.js";import"./chunk-66NF2KNG.js";import"./chunk-MENV7VLD.js";var A=["not-determined","restricted","denied","authorized","limited","provisional","ephemeral","unavailable"],E=["app-tracking-transparency","bluetooth","calendars","camera","contacts","face-id","local-network","location-always","location-when-in-use","media-library","microphone","motion","notifications","photo-library","photo-library-add-only","reminders","siri","speech-recognition"];function b(){console.log(`
|
|
5
|
+
rnxsim permissions \u2014 inspect and change simulated operating-system permissions
|
|
6
|
+
|
|
7
|
+
usage:
|
|
8
|
+
rnxsim permissions list [--json]
|
|
9
|
+
rnxsim permissions get <app-id> [--json]
|
|
10
|
+
rnxsim permissions set <app-id> <kind> <status> [--once] [--accuracy full|reduced] [--json]
|
|
11
|
+
rnxsim permissions reset <app-id> [kind] [--json]
|
|
12
|
+
`)}function S(n,i){console.log(i?JSON.stringify(n,null,2):n)}function $(n,i){let s=n.indexOf(i);return s>=0?n[s+1]:void 0}function P(n){return E.find(i=>i===n)??null}function j(n){return A.find(i=>i===n)??null}function x(n,i,s){switch(n){case"authorized":return{status:n,...i?{authorizationScope:"once"}:null,...s?{locationAccuracy:s}:null};case"not-determined":case"restricted":case"denied":case"limited":case"provisional":case"ephemeral":case"unavailable":return{status:n}}}async function B(n,i){if(n.includes("--help")||n.includes("-h"))return b(),0;let s=h(n,{port:i.port,stripBooleanFlags:["--json","--once"],stripValueFlags:["--accuracy"]}),[e,o,r,f]=s.positional;if(!e)return b(),1;let c=n.includes("--json"),t=w(s);try{if(e==="list"){let p=await l(t,"SootSim.bridges.test.permissionListApps");return S(c?p:p.map(m=>`${m.appId} ${m.displayName}`).join(`
|
|
13
|
+
`),c),0}if(!o)throw new Error(`${e} requires an app id`);if(e==="get"){let p=await l(t,"SootSim.bridges.test.permissionGetAppSettings",o);return S(p,c),0}if(e==="reset"){if(r){let m=P(r);if(!m)throw new Error(`unknown permission kind: ${r}`);await u(t,"SootSim.bridges.test.permissionSetAppPermission",o,m,{status:"not-determined"})}else await u(t,"SootSim.bridges.test.permissionResetApp",o);let p=await l(t,"SootSim.bridges.test.permissionGetAppSettings",o);return S(p,c),0}if(e!=="set")throw new Error(`unknown permissions command: ${e}`);if(!r||!f)throw new Error("set requires an app id, permission kind, and status");let a=P(r);if(!a)throw new Error(`unknown permission kind: ${r}`);let g=j(f);if(!g)throw new Error(`unknown permission status: ${f}`);let d=$(n,"--accuracy"),y=d==="full"||d==="reduced"?d:void 0;if(d&&!y)throw new Error(`unknown location accuracy: ${d}`);let k=await u(t,"SootSim.bridges.test.permissionSetAppPermission",o,a,x(g,n.includes("--once"),y));return S(k,c),0}catch(a){return console.error(` permissions failed: ${a instanceof Error?a.message:a}`),1}finally{t.close()}}export{B as runPermissions};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a as W}from"./chunk-BRIZOR4K.js";import{a as oe}from"./chunk-NPVGMH2N.js";import{a as Z,c as ee}from"./chunk-BKNOLP3J.js";import{d as Y}from"./chunk-T4FT6CM7.js";import"./chunk-YZRFF4YA.js";import"./chunk-FWYYCUAZ.js";import"./chunk-3D57IBPC.js";import{h as v,j as y,k as Q}from"./chunk-7INBNA3U.js";import"./chunk-N6A3SXMR.js";import"./chunk-TCWQJILS.js";import{f as X}from"./chunk-33FKQH54.js";import"./chunk-7VWOSTD5.js";import"./chunk-66NF2KNG.js";import"./chunk-ZMZTHU7V.js";import"./chunk-MENV7VLD.js";import{existsSync as he,mkdirSync as E,readdirSync as be,readFileSync as ve,rmSync as q,writeFileSync as I}from"fs";import{homedir as ye,tmpdir as Se}from"os";import{dirname as z,extname as re,join as F,resolve as $e}from"path";var J=24e4,Re=9e4,xe=3e4;async function D(e,r,o,i){let t=Math.max(2e4,i+xe);try{return await e.send({type:"evaluate",code:r},{timeoutMs:t})}catch(n){let s=n instanceof Error?n.message:String(n);/^command timed out after \d+s$/.test(s)&&(console.error(` ${o} stalled \u2014 the render host did not finish within ${Math.round(t/1e3)}s; it is likely contended or wedged.
|
|
5
|
+
the capture lock auto-releases, so simply retry the recording.
|
|
6
|
+
if it persists, recover the sim with \`rnxsim close --sim <id>\`.`),process.exit(1)),/render host not available|already streaming|already recording|lock already held/i.test(s)&&(console.error(` ${o} failed: ${s}
|
|
7
|
+
a prior recording was abandoned and its capture is still
|
|
8
|
+
releasing. the lock self-heals in ~${Math.round((i+2e4)/1e3)}s \u2014 retry then, or recover now with
|
|
9
|
+
\`rnxsim close --sim <id>\` and reopen the sim.`),process.exit(1)),console.error(` ${o} failed: ${s}`),process.exit(1)}}var _e=new Set(["--sim","--port","-p","--mode","--duration","--fps","--format","--output","-o","--frames","--max-width","--origin","--owner","--repo"]),ke=new Set(["start","stop","cancel","status","prelude-start","upload"]);function Oe(e){for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("-")){_e.has(o)&&r++;continue}return ke.has(o)?{name:o,index:r}:null}return null}function te(e){let r=u(e,"--owner")?.trim(),o=u(e,"--repo")?.trim();return(r&&!o||!r&&o)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),r&&o?{owner:r,repo:o}:null}async function He(e,r){let o=Oe(e);if(o){let d=[...e.slice(0,o.index),...e.slice(o.index+1)];if(o.name==="start"){await Te(d,r);return}if(o.name==="prelude-start"){await Ie(d,r);return}if(o.name==="upload"){let{runUpload:S}=await import("./upload-GZ6LIMYM.js");await S(d,r);return}if(o.name==="stop"){await Pe(d,r);return}if(o.name==="cancel"){await Ne(d,r);return}await Ae(d,r);return}let i=v(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open","--lockstep"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width","--origin","--owner","--repo"]}),t=se(u(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=u(e,"--format");s&&!["webm","mp4","gif","png"].includes(s)&&(console.error(` invalid --format "${s}" \u2014 expected webm | mp4 | gif | png`),process.exit(1));let c=u(e,"--output"),a=Number(u(e,"--duration")??"10");(!Number.isFinite(a)||a<=0)&&(console.error(` invalid --duration "${u(e,"--duration")}" \u2014 expected a positive number of seconds`),process.exit(1));let l=600;a>l&&(console.error(` invalid --duration "${u(e,"--duration")}" \u2014 exceeds the ${l}s (10m) maximum`),process.exit(1));let m=Number(u(e,"--fps")??"30"),p=u(e,"--frames");if(p!==void 0){let d=Number(p);(!Number.isInteger(d)||d<=0)&&(console.error(` invalid --frames "${p}" \u2014 expected a positive integer count`),process.exit(1))}let _=e.includes("--open"),k=u(e,"--max-width")?Number(u(e,"--max-width")):void 0;e.includes("--lockstep")&&(console.error(" --lockstep works with `record start` / `record stop` (stateful mode) \u2014 atomic --duration is wall-clock and cannot bound a virtual-time capture"),process.exit(1));let w=Math.max(100,Math.round(a*1e3)),K=u(e,"--origin"),fe=te(e);if(t==="live"||t==="combined"){c&&console.log(` note: --output is ignored for --mode ${t} \u2014 the recording uploads to /preview/<id>`),n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await W("record",{originOverride:K,allowGitHubAuth:!0});let d=y({...i,commandTimeoutMs:6e4});try{await H(d),await de(d,t),t==="combined"&&await B(d),await ce(d,K,fe);let S=await le(d,t,t==="combined"?n:void 0);S.ok||(console.error(` start failed: recording store refused to start (${t})`+(S.error?`: ${S.error}`:"")),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(f=>setTimeout(f,w)),await ue(d);let O=await me(d);pe(O,_,t)}finally{d.close()}return}let A=p?Number(p):null,R=Be(s,c,A);_&&console.log(" note: --open is ignored for local-file capture \u2014 it applies to --mode live/combined");let b=y({...i,commandTimeoutMs:6e4});try{if(await ne(b),await B(b),R==="png"){let x=A??10,h=T(c,`sootsim-frames-${C()}`);c&&re(c)&&console.log(` note: --frames writes multiple pngs, so --output "${c}" is a directory \u2014 frame-NNN.png files land inside it`),E(h,{recursive:!0});for(let g of be(h))/^frame-\d+\.png$/.test(g)&&q(F(h,g),{force:!0});console.log(` sampling ${x} frames over ${a}s \u2192 ${h}`);let $=await b.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${x}, durationMs: ${w}${n?`, layers: ${JSON.stringify(n)}`:""} })`});(!$.ok||!$.requestId)&&(console.error(` frame capture start failed: ${$.error??"unknown error"}`),process.exit(1)),await new Promise(g=>setTimeout(g,w));let ge=Date.now()+Math.max(5e3,w),N=null;for(;;){let g=await b.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${$.requestId})`});if(g||(console.error(" frame capture result missing"),process.exit(1)),g.done){g.ok||(console.error(` frame capture failed: ${g.error??"unknown error"}`),process.exit(1)),N=g.frames??[];break}Date.now()>=ge&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(P=>setTimeout(P,100))}N.forEach((g,P)=>{let we=`${h}/frame-${String(P+1).padStart(3,"0")}.png`;I(we,Buffer.from(g.data,"base64"))}),console.log(` saved ${N.length} frames`);return}if(R==="gif"){let x=A??Math.max(10,Math.round(a*m/3)),h=T(c,`sootsim-${C()}.gif`);E(z(h),{recursive:!0}),console.log(` encoding gif: ${x} frames over ${a}s \u2192 ${h}`);let $=await D(b,`window.__sootsimRecorder.captureGif({ frames: ${x}, durationMs: ${w}${k?`, maxWidth: ${k}`:""}${n?`, layers: ${JSON.stringify(n)}`:""} })`,"gif encode",w);$||(console.error(" gif capture returned no frames"),process.exit(1)),I(h,Buffer.from($.data,"base64")),console.log(` saved: ${h} (${L($.size)})`);return}let d=T(c,`sootsim-${C()}.${R}`);E(z(d),{recursive:!0});let S={format:R,fps:m,durationMs:w};n&&(S.layers=n);let O=await D(b,`window.__sootsimRecorder.start(${JSON.stringify(S)})`,`${R} start`,w);O.ok||(console.error(` start failed: ${O.error??"unknown error"}`),/render host not available|already streaming|already recording|lock already held/i.test(O.error??"")&&console.error(" a prior recording was abandoned and its capture is still\n releasing. retry in ~20s, or recover now with\n `rnxsim close --sim <id>` then reopen the sim."),process.exit(1)),console.log(` recording ${R} for ${a}s \u2192 ${d}`),await new Promise(x=>setTimeout(x,w));let f=await D(b,"window.__sootsimRecorder.stop()",`${R} encode/flush`,w);f.ok||(console.error(` stop failed: ${f.error??"unknown error"}`),process.exit(1)),f.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await ie(b,d),console.log(` saved: ${d} (${L(f.size)})`),f.durationMs&&f.frameCount!==void 0&&console.log(` source frames: ${f.frameCount} over ${(f.durationMs/1e3).toFixed(2)}s (${(f.frameCount/(f.durationMs/1e3)).toFixed(1)}fps)`)}finally{b.close()}}var Me=6e3;async function V(e,r){try{return await e.send({type:"evaluate",code:r},{timeoutMs:Me})}catch(o){let i=o instanceof Error?o.message:String(o);throw/^command timed out after \d+s$/.test(i)&&(console.error(" sim did not respond \u2014 it is connected to the bridge but has not\n loaded an app (or its page is unresponsive). run `rnxsim list`\n and target a sim with a loaded app via --sim <id>."),process.exit(1)),o}}async function ne(e){await V(e,'typeof window.__sootsimRecorder !== "undefined"')||(console.error(" window.__sootsimRecorder missing \u2014 is rnx engine running in this sim?"),process.exit(1))}async function B(e){let{hidden:r}=await Q(e);r&&(console.error(` refusing to record: the rnx tab is hidden, so frame capture
|
|
10
|
+
would be throttled to ~1fps and produce a frozen-looking file.
|
|
11
|
+
bring the chrome window to the foreground (un-minimize / switch to
|
|
12
|
+
its tab) or run the recording in headless playwright, then retry.`),process.exit(1))}async function ie(e,r){let o=[],i=0;for(;;){let t=await e.send({type:"evaluate",code:`window.__sootsimRecorder.getBlobBase64({ offset: ${i}, chunk: 2097152 })`});if(!t)throw new Error("no blob available on recorder");if(o.push(Buffer.from(t.data,"base64")),i=t.offset,t.done)break}I(r,Buffer.concat(o))}function u(e,r){let o=e.indexOf(r);if(!(o<0||o===e.length-1))return e[o+1]}function Ee(e){if(!e)return;let r=re(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function Be(e,r,o){return e||(o!=null?"png":Ee(r)??"webm")}function C(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function Ue(){let e=F(ye(),".sootsim","recordings");return E(e,{recursive:!0}),e}function T(e,r){return e?$e(process.cwd(),e):F(Ue(),r)}function L(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function se(e){if(!e)return"video";if(e==="video"||e==="live"||e==="combined")return e;console.error(` invalid --mode "${e}" \u2014 expected video | live | combined`),process.exit(1)}function G(){return F(Se(),`sootsim-recording-${X()}.json`)}function U(){let e=G();if(!he(e))return null;try{return{mode:"video",...JSON.parse(ve(e,"utf8"))}}catch{return q(e,{force:!0}),null}}function Ce(e){I(G(),JSON.stringify(e,null,2))}function M(){q(G(),{force:!0})}function j(e,r){e&&r.simId&&e!==r.simId&&console.log(` note: the tracked recording session is on sim ${r.simId}, not the
|
|
13
|
+
requested sim ${e}. record state is global (not per-sim);
|
|
14
|
+
this command acts on that session regardless of --sim.`)}async function Te(e,r){let o=U();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`rnxsim record stop\` first, or \`rnxsim record cancel\` to discard.`),process.exit(1));let i=v(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--lockstep"],stripValueFlags:["--mode","--fps","--format","--max-width","--origin","--owner","--repo"]}),t=se(u(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=u(e,"--format"),c=s==="mp4"?"mp4":"webm";s&&c!==s&&(console.error(` record start only supports webm or mp4 (got: ${s}). for gif/png use atomic mode: rnxsim record --format ${s} --duration <s>`),process.exit(1));let a=Number(u(e,"--fps")??"30"),l=te(e),m=y({...i,commandTimeoutMs:t==="live"||t==="combined"?Re:15e3});try{if(t==="live"||t==="combined"){n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await W("record",{originOverride:u(e,"--origin"),allowGitHubAuth:!0}),await H(m),await de(m,t),t==="combined"&&await B(m),await ce(m,u(e,"--origin"),l);let p=await le(m,t,t==="combined"?n:void 0);p.ok||(console.error(` start failed: recording store refused to start (${t})`+(p.error?`: ${p.error}`:"")),process.exit(1))}else{await ne(m),await B(m);let p=e.includes("--lockstep");p&&c!=="mp4"&&(console.error(" --lockstep requires --format mp4 (webm is realtime-clocked)"),process.exit(1));let _={format:c,fps:a};n&&(_.layers=n),p&&(_.lockstep=!0);let k=await m.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(_)})`});k.ok||(console.error(` start failed: ${k.error??"unknown error"}`),process.exit(1))}Ce({simId:i.simId??null,mode:t,format:c,fps:a,layers:n,startedAt:new Date().toISOString()}),console.log(t==="video"?` recording ${c} @ ${a}fps${n?` (${n})`:""} \u2014 run \`rnxsim record stop --output <path>\` when done`:` recording ${t} \u2014 run \`rnxsim record stop\` when done (add --open to launch the preview URL)`)}finally{m.close()}}async function Ie(e,r){let o=U();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`rnxsim record stop\` first, or \`rnxsim record cancel\` to discard.`),process.exit(1));let i=v(e,{port:r.port,stripBooleanFlags:[],stripValueFlags:["--origin"]}),t=y({...i,commandTimeoutMs:15e3});try{if(await H(t),await B(t),!await t.send({type:"evaluate",code:`(() => {
|
|
15
|
+
const start = window.SootSim?.bridges?.startRecordingPrelude
|
|
16
|
+
if (typeof start !== 'function') return false
|
|
17
|
+
return Promise.resolve(start()).then((value) => value === true)
|
|
18
|
+
})()`})){let s=await t.send({type:"evaluate",code:`(() => {
|
|
19
|
+
const getError = window.SootSim?.bridges?.getRecordingStartError
|
|
20
|
+
return typeof getError === 'function' ? getError() : null
|
|
21
|
+
})()`}).catch(()=>null);console.error(` prelude start failed: recording store refused to start${typeof s=="string"&&s?` (${s})`:""}`),process.exit(1)}console.log(" recording preview prelude \u2014 run `rnxsim record start --mode combined` when the visible proof segment is ready")}finally{t.close()}}async function ae(e){try{let r=await e.send({type:"evaluate",code:`(() => {
|
|
22
|
+
const store = window.SootSim?.bridges?.getRecordingState?.();
|
|
23
|
+
const headless = window.__sootsimRecorder?.state?.();
|
|
24
|
+
const eventRecorder = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder;
|
|
25
|
+
const eventRecording =
|
|
26
|
+
typeof eventRecorder?.isRecording === 'function'
|
|
27
|
+
? eventRecorder.isRecording() === true
|
|
28
|
+
: false;
|
|
29
|
+
return { store: store ? store.state : undefined, headless, eventRecording };
|
|
30
|
+
})()`});return r?r.store==="recording"||r.headless==="recording"?"recording":r.store==="processing"?"processing":r.eventRecording?"prelude":r.store==="idle"||r.headless==="idle"?"idle":null:null}catch{return null}}async function Fe(e){let r=await e.send({type:"evaluate",code:`(() => {
|
|
31
|
+
const store = window.SootSim?.bridges?.getRecordingState?.();
|
|
32
|
+
const eventRecorder = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder;
|
|
33
|
+
const hadStoreRecording = store && store.state !== 'idle';
|
|
34
|
+
const hadEventRecording =
|
|
35
|
+
typeof eventRecorder?.isRecording === 'function'
|
|
36
|
+
? eventRecorder.isRecording() === true
|
|
37
|
+
: false;
|
|
38
|
+
const cancel = window.SootSim?.bridges?.cancelRecording;
|
|
39
|
+
if (typeof cancel === 'function') cancel();
|
|
40
|
+
return Boolean(hadStoreRecording || hadEventRecording);
|
|
41
|
+
})()`}).catch(()=>!1),o=await e.send({type:"evaluate",code:`(async () => {
|
|
42
|
+
const r = window.__sootsimRecorder;
|
|
43
|
+
if (r && typeof r.forceRelease === 'function') return await r.forceRelease();
|
|
44
|
+
return false;
|
|
45
|
+
})()`}).catch(()=>!1);return{store:r,headless:o}}async function Ae(e,r){let o=U();if(o){j(v(e,{port:r.port}).simId,o),o.mode==="video"?console.log(` recording ${o.mode} (${o.format} @ ${o.fps}fps) on sim ${o.simId??"?"} since ${o.startedAt}`):console.log(` recording ${o.mode} on sim ${o.simId??"?"} since ${o.startedAt}`);return}let i=v(e,{port:r.port}),t=y({...i,commandTimeoutMs:8e3});try{let n=await ae(t);if(n==="recording"||n==="processing"||n==="prelude"){if(n==="prelude"){console.log(" a recording preview prelude is active. hidden setup is being\n captured for the next live/combined preview recording. finish\n it with `rnxsim record start --mode combined`, or discard it\n with `rnxsim record cancel`.");return}console.log(` a recording is in progress (engine state: ${n}), but not via
|
|
46
|
+
\`record start\` \u2014 it was started by an atomic \`record --duration\`
|
|
47
|
+
run or the in-browser record button, which own their own lifecycle.
|
|
48
|
+
if that controlling run is still alive it will finish on its own
|
|
49
|
+
(atomic \`--mode video/gif/png\` writes a local file from that
|
|
50
|
+
process; live/combined upload to /preview/<id>). if the run was
|
|
51
|
+
killed, the recording is abandoned and will NOT finish \u2014 reclaim
|
|
52
|
+
it now with \`rnxsim record cancel\`, or it auto-reclaims when the
|
|
53
|
+
abandoned capture's deadline lapses.`)}else console.log(" no recording in progress")}finally{t.close()}}async function Ne(e,r){let o=U();if(!o){let s=v(e,{port:r.port}),c=y({...s,commandTimeoutMs:8e3});try{let a=await ae(c);if(a==="recording"||a==="processing"||a==="prelude"){let l=await Fe(c);l.store&&a==="prelude"?console.log(" recording preview prelude cancelled"):l.store||l.headless?console.log(" reclaimed an abandoned recording (started by an atomic\n `record --duration` run or the record button whose owner is\n gone). the recorder is idle again \u2014 live/combined can start."):console.log(" a recording is in progress and still owned by a live atomic\n `record --duration` run or the in-browser record button \u2014 it\n will finish on its own and nothing was reclaimed.")}else console.log(" no recording in progress")}finally{c.close()}return}let i=v(e,{port:r.port});j(i.simId,o);let t=o.simId??i.simId??void 0,n=y({...i,simId:t,commandTimeoutMs:15e3});try{o.mode==="live"||o.mode==="combined"?await n.send({type:"evaluate",code:"void window.SootSim?.bridges?.cancelRecording?.()"}):await n.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"})}catch{}finally{M(),n.close()}console.log(" recording cancelled")}async function Pe(e,r){let o=U();o||(console.error(" no recording in progress. start one with `rnxsim record start`."),process.exit(1));let i=v(e,{port:r.port,stripBooleanFlags:["--open"],stripValueFlags:["--output"]});j(i.simId,o);let t=o.simId??i.simId??void 0,n=e.includes("--open"),s=y({...i,simId:t,commandTimeoutMs:o.mode==="live"||o.mode==="combined"?J:6e4});try{if(o.mode==="live"||o.mode==="combined"){await ue(s);let m=await me(s);M(),pe(m,n,o.mode);return}let c=u(e,"--output"),a=T(c,`sootsim-${C()}.${o.format}`);E(z(a),{recursive:!0});let l=await s.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});l.ok||(console.error(` stop failed: ${l.error??"unknown error"}`),M(),process.exit(1)),l.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),M(),process.exit(1)),await ie(s,a),M(),console.log(` saved: ${a} (${L(l.size)})`),l.durationMs&&l.frameCount!==void 0&&console.log(` source frames: ${l.frameCount} over ${(l.durationMs/1e3).toFixed(2)}s (${(l.frameCount/(l.durationMs/1e3)).toFixed(1)}fps)`)}finally{s.close()}}async function H(e){await V(e,'typeof window.SootSim?.bridges?.startRecording === "function" && typeof window.SootSim?.bridges?.stopRecording === "function"')||(console.error(" SootSim.bridges.startRecording missing \u2014 is rnx engine running in this sim?"),process.exit(1))}async function de(e,r){await V(e,`(() => {
|
|
54
|
+
const fn = window.__sootsimCaptureBundle
|
|
55
|
+
if (typeof fn !== 'function') return false
|
|
56
|
+
const snap = fn()
|
|
57
|
+
return !!(snap && snap.bundleUrl)
|
|
58
|
+
})()`)||(console.error(` --mode ${r} needs a guest app bundle to upload to /preview/<id>,
|
|
59
|
+
but this sim has no bundle loaded (a built-in shell screen like
|
|
60
|
+
photos/settings/home has none). open a metro/guest app first, or
|
|
61
|
+
use \`--mode video\` for a local screen recording with no upload.`),process.exit(1))}async function ce(e,r,o){let i=Z();if(!i)return;let t=i.kind==="api-key"?i.secret:i.token,n=oe(),s={branch:n.branch??void 0,commitSha:n.commitSha??void 0,githubUsername:n.githubUsername??void 0,pullRequestNumber:n.pullRequestNumber??void 0,pullRequestTitle:n.pullRequestTitle??void 0},c=i.kind==="github"?{...ee(i),owner:o?.owner,repo:o?.repo,...s}:o?{owner:o.owner,repo:o.repo,...s}:null,a=r?r.replace(/\/$/,""):null;await e.send({type:"evaluate",code:`(() => {
|
|
62
|
+
const set = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.setSession
|
|
63
|
+
if (typeof set !== 'function') return false
|
|
64
|
+
set({ token: ${JSON.stringify(t)}, user: null })
|
|
65
|
+
window.__sootsimPreviewUploadIdentity = ${JSON.stringify(c)}
|
|
66
|
+
window.__sootsimPreviewUseInjectedBearer = true
|
|
67
|
+
${a?`window.__sootsimUploadOrigin = ${JSON.stringify(a)}`:"delete window.__sootsimUploadOrigin"}
|
|
68
|
+
return true
|
|
69
|
+
})()`})||(console.error(" SootSim.bridges.setSession missing \u2014 this sim is running an engine\n build without CLI-injected preview auth. reload the sim or open a\n fresh one (`rnxsim open --new`); if it persists, update rnx."),process.exit(1))}async function le(e,r,o){let i=o?JSON.stringify(o):"undefined";return await e.send({type:"evaluate",code:`window.SootSim.bridges.startRecording(${JSON.stringify(r)}, ${i}, { skipEntitlement: true })`})===!0?{ok:!0,error:null}:{ok:!1,error:await e.send({type:"evaluate",code:"(window.SootSim?.bridges?.getRecordingStartError?.() ?? null)"}).catch(()=>null)??null}}async function ue(e){await e.send({type:"evaluate",code:"void window.SootSim.bridges.stopRecording()"})}async function me(e){let r=Date.now()+J;for(;Date.now()<r;){let o=await e.send({type:"evaluate",code:"(() => { const s = window.SootSim?.bridges?.getRecordingState?.(); return s ? { state: s.state, lastUpload: s.lastUpload, uploadError: s.uploadError } : null })()"});if(o&&o.state==="idle"){if(o.uploadError)return{uploadError:o.uploadError};if(o.lastUpload?.previewUrl)return{previewUrl:o.lastUpload.previewUrl,eventCount:o.lastUpload.eventCount}}await new Promise(i=>setTimeout(i,300))}return{uploadError:`upload did not settle within ${J/1e3}s`}}function pe(e,r,o){e.uploadError&&(console.error(` upload failed: ${e.uploadError}`),process.exit(1)),e.previewUrl||(console.error(" upload returned no preview URL"),process.exit(1)),console.log(` preview: ${e.previewUrl}`),console.log(` note: this URL is content-addressed \u2014 re-recording the same bundle
|
|
70
|
+
replaces this capture at the same /preview/<id>.`),(o==="live"||o==="combined")&&typeof e.eventCount=="number"&&console.log(` captured ${e.eventCount} event${e.eventCount===1?"":"s"}`),(o==="live"||o==="combined")&&e.eventCount===0&&console.log(o==="combined"?` note: this combined recording captured no events \u2014 the Live tab has
|
|
71
|
+
nothing to replay. Video will play the captured screen recording.`:` note: this live recording captured no events \u2014 the preview has nothing
|
|
72
|
+
to replay and will boot a fresh interactive session instead.`),r&&Y(e.previewUrl)}export{Ee as extToFormat,Be as resolveFormat,He as runRecord,u as valueOf};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a as m,b as f}from"./chunk-BKNOLP3J.js";import{a as d}from"./chunk-VUFRB347.js";import"./chunk-TCWQJILS.js";import{H as p}from"./chunk-66NF2KNG.js";import{a as l}from"./chunk-EUAVBTKU.js";import"./chunk-ZMZTHU7V.js";import"./chunk-MENV7VLD.js";import{existsSync as h,readFileSync as w}from"node:fs";import{resolve as b}from"node:path";var R="https://contrast.dev",g=8e3;function v(){return{request:(t,e)=>fetch(t,e),confirmSubmission:d,isInteractive:process.stdin.isTTY===!0,now:()=>new Date,stdout:t=>process.stdout.write(t),stderr:t=>process.stderr.write(t)}}function I(t,e){let n=t.indexOf(e);if(n===-1)return null;let r=t[n+1];if(!r||r.startsWith("-"))throw new Error(`${e} requires a value`);return r}function D(t,e=process.cwd()){let n=I(t,"--app"),r=new Set,s=t.indexOf("--app");s!==-1&&(r.add(s),r.add(s+1));let a=[];for(let c=0;c<t.length;c+=1){if(r.has(c))continue;let u=t[c];if(!(u==="--yes"||u==="-y"||u==="--dry-run")){if(u.startsWith("-"))throw new Error(`unknown flag: ${u}`);a.push(u)}}let i=a.join(" ").trim();if(!i)throw new Error("describe the missing or broken compatibility behavior");if(i.length>g)throw new Error(`description is too long (maximum ${g} characters)`);return{appDir:b(e,n??"."),description:i,dryRun:t.includes("--dry-run"),yes:t.includes("--yes")||t.includes("-y")}}function y(t){if(!t||typeof t!="object")return;let e={};for(let n of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,n)?.value;typeof r=="string"&&(e[n]=r)}return e}function O(t){let e=b(t,"package.json");if(!h(e))return null;let n;try{n=JSON.parse(w(e,"utf8"))}catch{throw new Error(`could not parse ${e}`)}if(!n||typeof n!="object")throw new Error(`${e} must contain a JSON object`);let r=Object.getOwnPropertyDescriptor(n,"name")?.value,s=Object.getOwnPropertyDescriptor(n,"dependencies")?.value,a=Object.getOwnPropertyDescriptor(n,"devDependencies")?.value,i=y(s),c=y(a);return{...typeof r=="string"?{name:r}:{},...i?{dependencies:i}:{},...c?{devDependencies:c}:{}}}async function S(t,e=new Date){let n=O(t.appDir),r=n?(await import("./web-6NW6YLPI.js")).scanDeps(n):null,s=l(),a=p();return{note:t.description,timestamp:e.toISOString(),sootsim_version:a,cli_version:s,bundle:{activeApp:r&&r.projectName!=="unknown"?{appName:r.projectName}:null,reportSource:"cli",runtimeVersion:a,cliVersion:s,platform:process.platform,arch:process.arch,compatibility:r}}}function $(){let t=m(),e=t?.kind==="session"?t.origin.replace(/\/+$/,""):R,n=t&&t.kind!=="github"?f(t):null;return{url:`${e}/api/sootsim/report-issue`,authorization:n}}function k(t){if(!t)return"no package.json found; no compatibility scan attached";let e=t.packages.filter(n=>n.status!=="full"&&n.status!=="not-relevant").length;return`${t.packages.length} React Native ecosystem packages, ${e} needing attention`}function P(t){if(!t||typeof t!="object")return null;let e=Object.getOwnPropertyDescriptor(t,"id")?.value;return typeof e=="string"&&e?e:null}async function V(t,e=v()){let n;try{n=D(t)}catch(o){return e.stderr(` ${o instanceof Error?o.message:String(o)}
|
|
5
|
+
usage: rnxsim report-issue [--app <dir>] [--dry-run] [--yes] "<description>"
|
|
6
|
+
`),1}if(!h(n.appDir))return e.stderr(` directory not found: ${n.appDir}
|
|
7
|
+
`),1;let r;try{r=await S(n,e.now())}catch(o){return e.stderr(` could not prepare the issue report: ${o instanceof Error?o.message:String(o)}
|
|
8
|
+
`),1}if(e.stdout(`
|
|
9
|
+
rnxsim issue report preview
|
|
10
|
+
|
|
11
|
+
description: ${r.note}
|
|
12
|
+
compatibility: ${k(r.bundle.compatibility)}
|
|
13
|
+
environment: CLI ${r.bundle.cliVersion}, runtime ${r.bundle.runtimeVersion??"not installed"}, ${r.bundle.platform}/${r.bundle.arch}
|
|
14
|
+
|
|
15
|
+
Includes only the description, compatibility scan, and the version/platform details above.
|
|
16
|
+
It does not include source files, environment variables, terminal output, logs, screenshots, or app data.
|
|
17
|
+
`),n.dryRun)return e.stdout(`
|
|
18
|
+
dry run: nothing was sent.
|
|
19
|
+
`),0;if(!n.yes){if(!e.isInteractive)return e.stderr(`
|
|
20
|
+
not sent: ask the user for explicit approval, then rerun with --yes.
|
|
21
|
+
`),2;if(!await e.confirmSubmission("send this compatibility report to the rnx team?",!1))return e.stdout(`
|
|
22
|
+
not sent.
|
|
23
|
+
`),2}let s=$(),a={"content-type":"application/json"};s.authorization&&(a.authorization=s.authorization);let i;try{i=await e.request(s.url,{method:"POST",headers:a,body:JSON.stringify(r),signal:AbortSignal.timeout(15e3)})}catch(o){return e.stderr(` report failed: ${o instanceof Error?o.message:String(o)}
|
|
24
|
+
`),1}if(!i.ok){let o=(await i.text().catch(()=>"")).slice(0,240);return e.stderr(` report failed: ${i.status} ${i.statusText}${o?` \u2014 ${o}`:""}
|
|
25
|
+
`),1}let c=await i.json().catch(()=>null),u=P(c);return e.stdout(u?`
|
|
26
|
+
sent. Report id: ${u}
|
|
27
|
+
`:`
|
|
28
|
+
sent. Thank you.
|
|
29
|
+
`),0}export{S as createReportIssuePayload,D as parseReportIssueOptions,V as runReportIssue};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{c as a}from"./chunk-L24Z3CRS.js";import"./chunk-AY47WKS5.js";import"./chunk-3D57IBPC.js";import"./chunk-7INBNA3U.js";import"./chunk-U4PN6JOT.js";import"./chunk-33FKQH54.js";import"./chunk-7VWOSTD5.js";import"./chunk-66NF2KNG.js";import"./chunk-ZMZTHU7V.js";import"./chunk-MENV7VLD.js";export{a as runRuntime};
|