rnxsim 0.0.0 → 0.1.313

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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +512 -0
  3. package/detox/colors.ts +54 -0
  4. package/detox/config-loader.ts +135 -0
  5. package/detox/element-types.ts +39 -0
  6. package/detox/expectations.ts +537 -0
  7. package/detox/gestures.ts +480 -0
  8. package/detox/index.ts +2118 -0
  9. package/detox/jest-preset.cjs +51 -0
  10. package/detox/jest-setup-after-env.cjs +18 -0
  11. package/detox/matchers.ts +30 -0
  12. package/detox/motion-change.cjs +109 -0
  13. package/detox/motion-change.d.cts +35 -0
  14. package/detox/navigation.ts +43 -0
  15. package/detox/screenshots/animated-color-test-rest-norngh.png +0 -0
  16. package/detox/screenshots/color-test-after-drag-norngh.png +0 -0
  17. package/detox/screenshots/color-test-rest-norngh.png +0 -0
  18. package/detox/screenshots/theme-blue-toggle.png +0 -0
  19. package/detox/screenshots/theme-blue.png +0 -0
  20. package/detox/screenshots/theme-red-toggle.png +0 -0
  21. package/detox/screenshots/theme-red.png +0 -0
  22. package/dist-cli/bin.js +15 -0
  23. package/dist-cli/chunks/agent-XZ2KTPCU.js +48 -0
  24. package/dist-cli/chunks/agent-wrapper-JJYYW2WH.js +17 -0
  25. package/dist-cli/chunks/app-fonts-IXRNQG6B.js +4 -0
  26. package/dist-cli/chunks/assert-54T5SK5F.js +49 -0
  27. package/dist-cli/chunks/auth-FI5UDI45.js +12 -0
  28. package/dist-cli/chunks/beta-JV6UKADW.js +4 -0
  29. package/dist-cli/chunks/camera-VL73YIKP.js +22 -0
  30. package/dist-cli/chunks/chunk-2D2UPBBR.js +4 -0
  31. package/dist-cli/chunks/chunk-2YR5BGA5.js +5 -0
  32. package/dist-cli/chunks/chunk-3NV2NCNX.js +4 -0
  33. package/dist-cli/chunks/chunk-46EUUFJ5.js +4 -0
  34. package/dist-cli/chunks/chunk-4NPPOV2N.js +5 -0
  35. package/dist-cli/chunks/chunk-5DHC6KHQ.js +7 -0
  36. package/dist-cli/chunks/chunk-5TEF3ET3.js +74 -0
  37. package/dist-cli/chunks/chunk-5TPRP5QT.js +4 -0
  38. package/dist-cli/chunks/chunk-5YJCOWCH.js +4 -0
  39. package/dist-cli/chunks/chunk-7GN3LVWB.js +4 -0
  40. package/dist-cli/chunks/chunk-BBULZ7CG.js +568 -0
  41. package/dist-cli/chunks/chunk-BTWORNNG.js +71 -0
  42. package/dist-cli/chunks/chunk-D4FFVGI5.js +5 -0
  43. package/dist-cli/chunks/chunk-DCEMHR2Y.js +4 -0
  44. package/dist-cli/chunks/chunk-DZS6WPUI.js +4 -0
  45. package/dist-cli/chunks/chunk-F5ZRSS3C.js +3 -0
  46. package/dist-cli/chunks/chunk-FSUYIVJ6.js +9 -0
  47. package/dist-cli/chunks/chunk-G2WW6L2C.js +23 -0
  48. package/dist-cli/chunks/chunk-GASE6UBA.js +4 -0
  49. package/dist-cli/chunks/chunk-GGRX24GF.js +142 -0
  50. package/dist-cli/chunks/chunk-HI5TFJWN.js +5 -0
  51. package/dist-cli/chunks/chunk-IJ5CAZZC.js +5 -0
  52. package/dist-cli/chunks/chunk-IJO63TDP.js +4 -0
  53. package/dist-cli/chunks/chunk-KTHV3RUS.js +26 -0
  54. package/dist-cli/chunks/chunk-LF2ZVT7O.js +6 -0
  55. package/dist-cli/chunks/chunk-MJRLLB4R.js +38 -0
  56. package/dist-cli/chunks/chunk-NFK7T35W.js +4 -0
  57. package/dist-cli/chunks/chunk-NMF2ZMZQ.js +15 -0
  58. package/dist-cli/chunks/chunk-OHAZNXLK.js +4 -0
  59. package/dist-cli/chunks/chunk-OVFJFXUD.js +101 -0
  60. package/dist-cli/chunks/chunk-OZSSI4WN.js +28 -0
  61. package/dist-cli/chunks/chunk-QKDWYITG.js +25 -0
  62. package/dist-cli/chunks/chunk-RSZWCKNT.js +30 -0
  63. package/dist-cli/chunks/chunk-RTN5C5RL.js +4 -0
  64. package/dist-cli/chunks/chunk-TIVZIMMW.js +4 -0
  65. package/dist-cli/chunks/chunk-TZFFR3SD.js +7 -0
  66. package/dist-cli/chunks/chunk-UC6U3MML.js +5 -0
  67. package/dist-cli/chunks/chunk-VFCMSYZK.js +6 -0
  68. package/dist-cli/chunks/chunk-VNQEB4L7.js +5 -0
  69. package/dist-cli/chunks/chunk-VZXWHRUZ.js +983 -0
  70. package/dist-cli/chunks/chunk-W6K4EFPH.js +107 -0
  71. package/dist-cli/chunks/chunk-WEXDAC74.js +4 -0
  72. package/dist-cli/chunks/chunk-WF3T4SVI.js +14 -0
  73. package/dist-cli/chunks/chunk-WINYQ44O.js +4 -0
  74. package/dist-cli/chunks/chunk-WMIIKMGK.js +10 -0
  75. package/dist-cli/chunks/chunk-WUSWBCWA.js +507 -0
  76. package/dist-cli/chunks/chunk-WWZIXIRD.js +4 -0
  77. package/dist-cli/chunks/chunk-XEVZYVIW.js +766 -0
  78. package/dist-cli/chunks/chunk-YDGQTMQL.js +4 -0
  79. package/dist-cli/chunks/chunk-YIFT42WN.js +4 -0
  80. package/dist-cli/chunks/chunk-ZMJD5GEC.js +125 -0
  81. package/dist-cli/chunks/cleanup-P27PA6JI.js +25 -0
  82. package/dist-cli/chunks/cli-version-WWLPBDQ7.js +4 -0
  83. package/dist-cli/chunks/compat-ZD65FED3.js +20 -0
  84. package/dist-cli/chunks/config-XMJRNM2A.js +13 -0
  85. package/dist-cli/chunks/control-KMIQT3QP.js +4 -0
  86. package/dist-cli/chunks/daemon-G2ME7NLB.js +4 -0
  87. package/dist-cli/chunks/debug-PT4HOP7N.js +200 -0
  88. package/dist-cli/chunks/desktop-S3FG72AK.js +31 -0
  89. package/dist-cli/chunks/detox-B3D4IFCN.js +52 -0
  90. package/dist-cli/chunks/device-XBNDSB2R.js +18 -0
  91. package/dist-cli/chunks/diagnose-HMQXJE5N.js +43 -0
  92. package/dist-cli/chunks/disk-cleanup-BLCZ5BSZ.js +4 -0
  93. package/dist-cli/chunks/drivers-LDECZGP2.js +4 -0
  94. package/dist-cli/chunks/film-BJGTBYZB.js +74 -0
  95. package/dist-cli/chunks/flow-UEQNVTU7.js +4 -0
  96. package/dist-cli/chunks/help-T5FYSVGB.js +4 -0
  97. package/dist-cli/chunks/hidden-runtime-alias-ANOYADHM.js +4 -0
  98. package/dist-cli/chunks/home-paths-GT3LFNOR.js +4 -0
  99. package/dist-cli/chunks/inspect-ZA6XF5LD.js +4 -0
  100. package/dist-cli/chunks/install-desktop-TIMUDHPL.js +4 -0
  101. package/dist-cli/chunks/login-FJ737MWG.js +28 -0
  102. package/dist-cli/chunks/logout-ZCNMMHMY.js +4 -0
  103. package/dist-cli/chunks/maestro-SZTNKLDF.js +104 -0
  104. package/dist-cli/chunks/maestro-generate-DCFAIZ4H.js +36 -0
  105. package/dist-cli/chunks/mode-GRMQCRXR.js +26 -0
  106. package/dist-cli/chunks/optional-demo-registry-W36EWFFB.js +4 -0
  107. package/dist-cli/chunks/perf-QYBAAUZG.js +48 -0
  108. package/dist-cli/chunks/permissions-3QCQ6VF4.js +13 -0
  109. package/dist-cli/chunks/record-QPPC2S4E.js +72 -0
  110. package/dist-cli/chunks/report-issue-7NMFP4HK.js +29 -0
  111. package/dist-cli/chunks/runtime-XOAXMSTU.js +4 -0
  112. package/dist-cli/chunks/screenshot-command-67AECJFB.js +159 -0
  113. package/dist-cli/chunks/screenshot-layers-ASWBYPJL.js +20 -0
  114. package/dist-cli/chunks/screenshots-capture-PXA3HFQK.js +42 -0
  115. package/dist-cli/chunks/serve-BI2NBAXG.js +44 -0
  116. package/dist-cli/chunks/setup-7DWPMRSB.js +32 -0
  117. package/dist-cli/chunks/skills-S3Y22TUA.js +50 -0
  118. package/dist-cli/chunks/storage-XUIMJWAJ.js +37 -0
  119. package/dist-cli/chunks/store-JTHEJLAZ.js +4 -0
  120. package/dist-cli/chunks/telemetry-ZYJGD2DB.js +4 -0
  121. package/dist-cli/chunks/timeline-TMPLQPSP.js +24 -0
  122. package/dist-cli/chunks/upgrade-7HDSIM7K.js +7 -0
  123. package/dist-cli/chunks/upload-GMSZPWM6.js +4 -0
  124. package/dist-cli/chunks/version-HOCHZ37L.js +6 -0
  125. package/dist-cli/chunks/web-DG3WBYD3.js +4 -0
  126. package/dist-cli/chunks/what-happened-XFVUTZR7.js +25 -0
  127. package/dist-lib/agent-daemon-client.cjs +468 -0
  128. package/dist-lib/agent-events.cjs +48 -0
  129. package/dist-lib/agent-identity.cjs +53 -0
  130. package/dist-lib/agent-sessions.cjs +725 -0
  131. package/dist-lib/attached-projects.cjs +526 -0
  132. package/dist-lib/auth/shared-session.cjs +195 -0
  133. package/dist-lib/backend-origin.cjs +70 -0
  134. package/dist-lib/beta.cjs +41 -0
  135. package/dist-lib/beta.mjs +13 -0
  136. package/dist-lib/bridge-constants.cjs +161 -0
  137. package/dist-lib/cli-constants.cjs +32 -0
  138. package/dist-lib/config.cjs +96 -0
  139. package/dist-lib/detox/index.cjs +2863 -0
  140. package/dist-lib/detox/jest-preset.cjs +51 -0
  141. package/dist-lib/dev-bundle-resolution.cjs +223 -0
  142. package/dist-lib/home-paths.cjs +421 -0
  143. package/dist-lib/host/bridge-host.cjs +5600 -0
  144. package/dist-lib/host/fetch-proxy-handler.cjs +373 -0
  145. package/dist-lib/host/fetch-proxy-overrides.cjs +63 -0
  146. package/dist-lib/host/fetch-proxy-overrides.mjs +37 -0
  147. package/dist-lib/host/websocket-proxy.cjs +214 -0
  148. package/dist-lib/index.cjs +513 -0
  149. package/dist-lib/jump-to-source-babel.cjs +93 -0
  150. package/dist-lib/menu.cjs +620 -0
  151. package/dist-lib/menu.mjs +581 -0
  152. package/dist-lib/metro.cjs +297 -0
  153. package/dist-lib/profiles.cjs +246 -0
  154. package/dist-lib/public-brand.cjs +39 -0
  155. package/dist-lib/render-mode.cjs +54 -0
  156. package/dist-lib/scripts/dev-server-scanner.cjs +1034 -0
  157. package/dist-lib/sdk.cjs +2333 -0
  158. package/dist-lib/sdk.mjs +2240 -0
  159. package/dist-lib/skills.cjs +23922 -0
  160. package/dist-lib/vite.cjs +358 -0
  161. package/package.json +189 -18
  162. package/scripts/dev-server-scanner.ts +941 -0
  163. package/scripts/optional-demo-registry.ts +113 -0
  164. package/scripts/postinstall.cjs +3 -0
  165. package/scripts/preuninstall.cjs +118 -0
  166. package/skills/contrast/SKILL.md +171 -0
  167. package/skills/rnx-debug/SKILL.md +425 -0
  168. package/skills/rnx-perf/SKILL.md +295 -0
  169. package/skills/rnx-setup/SKILL.md +160 -0
  170. package/skills/rnx-test/SKILL.md +292 -0
  171. package/skills/rnx-visual/SKILL.md +122 -0
  172. package/src/agent-daemon-client.ts +410 -0
  173. package/src/agent-events.ts +71 -0
  174. package/src/agent-identity.ts +23 -0
  175. package/src/agent-prompt.ts +71 -0
  176. package/src/agent-sessions.ts +573 -0
  177. package/src/attached-projects.ts +539 -0
  178. package/src/auth/shared-session.ts +204 -0
  179. package/src/backend-origin.ts +49 -0
  180. package/src/beta.ts +19 -0
  181. package/src/bridge-constants.ts +171 -0
  182. package/src/browser-cache.ts +16 -0
  183. package/src/cli-constants.ts +1 -0
  184. package/src/cli-version.ts +32 -0
  185. package/src/codex-client.ts +215 -0
  186. package/src/config.ts +134 -0
  187. package/src/dev-bundle-resolution.ts +236 -0
  188. package/src/disk-cleanup.ts +466 -0
  189. package/src/home-paths.ts +552 -0
  190. package/src/host/agent-host.ts +666 -0
  191. package/src/host/bridge-host.ts +2626 -0
  192. package/src/host/fetch-proxy-handler.ts +397 -0
  193. package/src/host/fetch-proxy-overrides.ts +51 -0
  194. package/src/host/open-url.ts +89 -0
  195. package/src/host/websocket-proxy.ts +210 -0
  196. package/src/index.ts +12 -705
  197. package/src/jump-to-source-babel.ts +135 -0
  198. package/src/menu.ts +734 -0
  199. package/src/metro-plugin.ts +139 -0
  200. package/src/native-dev-bundle-url.ts +96 -0
  201. package/src/native-seam-manifest.ts +341 -0
  202. package/src/plist.ts +27 -0
  203. package/src/poll-until.ts +92 -0
  204. package/src/profiles.ts +179 -0
  205. package/src/public-brand.ts +9 -0
  206. package/src/render-mode.ts +27 -0
  207. package/src/runtime-assets.ts +228 -0
  208. package/src/runtime-delivery.ts +54 -0
  209. package/src/screenshots/compose.ts +422 -0
  210. package/src/screenshots/frame-compose.ts +454 -0
  211. package/src/screenshots/orchestrate.ts +256 -0
  212. package/src/screenshots/org-deck.ts +91 -0
  213. package/src/screenshots/registry.ts +58 -0
  214. package/src/screenshots/schema.ts +364 -0
  215. package/src/sdk.ts +7 -0
  216. package/src/settings-bundle.ts +418 -0
  217. package/src/skills/builtin/a11y-review.ts +132 -0
  218. package/src/skills/builtin/compat-check.ts +71 -0
  219. package/src/skills/builtin/maestro-test.ts +121 -0
  220. package/src/skills/builtin/perf-profile.ts +90 -0
  221. package/src/skills/builtin/screenshot-all.ts +52 -0
  222. package/src/skills/builtin/visual-diff.ts +100 -0
  223. package/src/skills/registry.ts +107 -0
  224. package/src/skills/types.ts +41 -0
  225. package/src/team-machine-prompt.ts +73 -0
  226. package/src/vite-plugin-one.ts +190 -0
  227. package/src/vite-plugin.ts +1750 -0
  228. package/src/worklets-babel.ts +134 -0
@@ -0,0 +1,113 @@
1
+ // optional, best-effort access to the INTERNAL demo-app registry
2
+ // (`./demo-app-registry.ts`). that file is repo-internal dev tooling: it pins
3
+ // real demo apps to fixed ports (e.g. 3pc on 8081) and is consumed only by
4
+ // `bun run demo` + the in-repo electron/vite discovery paths, which run from
5
+ // the typescript source where the registry is always present.
6
+ //
7
+ // the PUBLISHED `sootsim` npm package must know nothing about those internal
8
+ // apps — shipping the registry once matched a brand-new user's `expo start` on
9
+ // the default port 8081 against the 3pc `one` entry and crashed their metro
10
+ // (repo-agnostic-pipeline violation). so the registry is NOT in the package
11
+ // `files` list, and the `import()` below is resolved to an absolute path at
12
+ // runtime: it finds the source registry in-repo and nothing (empty list) on a
13
+ // published install. no bundler can see through that, so it never inlines.
14
+ //
15
+ // one path, no env toggle: every consumer goes through this loader; whether the
16
+ // registry resolves is purely a function of whether the file exists on disk.
17
+
18
+ import { existsSync } from 'node:fs'
19
+ import { basename, dirname, join } from 'node:path'
20
+ import { fileURLToPath, pathToFileURL } from 'node:url'
21
+
22
+ // this module is emitted at three different depths — the source at
23
+ // packages/sootsim/scripts/, the built CLI at packages/sootsim/dist-cli/chunks/,
24
+ // and the electron main bundle at packages/sootsim-engine/dist-electron/ — so a
25
+ // relative './demo-app-registry.ts' is only correct from the source copy. from
26
+ // the other two it points at a file that does not exist, the catch below
27
+ // swallows that, and every demo app then boots with no runtimeConfig at all
28
+ // (mattermost stops on the server-select screen because AutoSelectServerUrl
29
+ // never reaches it). the one description that holds from every emit site is the
30
+ // ancestor that holds the registry at its repo path, which in-repo is the
31
+ // monorepo root.
32
+ const REGISTRY_REPO_PATH = 'packages/sootsim/scripts/demo-app-registry.ts'
33
+
34
+ // the walk must never leave the installed package. `sootsim` publishes this
35
+ // loader's source, so on a published install it runs from
36
+ // node_modules/sootsim/scripts/ (or dist-cli/chunks/) with the consumer's whole
37
+ // filesystem above it — and consumers include this repo's own templates and
38
+ // examples, which install sootsim while sitting inside the monorepo. an
39
+ // unbounded walk from there reaches the real registry and hands a user's
40
+ // `expo start` on port 8081 the internal 3pc entry, which is the exact incident
41
+ // the header describes. a node_modules ancestor means "installed as a
42
+ // dependency", so the search stops there and the registry stays absent.
43
+ const MAX_ANCESTOR_STEPS = 8
44
+
45
+ /** absolute path to the internal registry, or null when this copy is running
46
+ * outside the monorepo (a published install) and must not have one. */
47
+ export function findInternalDemoRegistry(startDir: string): string | null {
48
+ let dir = startDir
49
+ for (let step = 0; step < MAX_ANCESTOR_STEPS; step++) {
50
+ if (basename(dir) === 'node_modules') return null
51
+ const candidate = join(dir, REGISTRY_REPO_PATH)
52
+ if (existsSync(candidate)) return candidate
53
+ const parent = dirname(dir)
54
+ if (parent === dir) return null
55
+ dir = parent
56
+ }
57
+ return null
58
+ }
59
+
60
+ export interface OptionalDemoApp {
61
+ name: string
62
+ label: string
63
+ dir: string
64
+ preferredPort: number
65
+ framework: 'expo' | 'one' | 'rock'
66
+ runtimeConfig?: import('../src/config.ts').SootSimConfig
67
+ }
68
+
69
+ let cached: OptionalDemoApp[] | null = null
70
+
71
+ /** load the internal demo registry if it's present on disk (in-repo only).
72
+ * returns [] on a published install where the registry was not shipped. */
73
+ export async function loadOptionalDemoApps(): Promise<OptionalDemoApp[]> {
74
+ if (cached) return cached
75
+ const registryPath = findInternalDemoRegistry(dirname(fileURLToPath(import.meta.url)))
76
+ if (!registryPath) {
77
+ cached = []
78
+ return cached
79
+ }
80
+ try {
81
+ const mod = (await import(/* @vite-ignore */ pathToFileURL(registryPath).href)) as {
82
+ APPS?: OptionalDemoApp[]
83
+ }
84
+ cached = Array.isArray(mod.APPS) ? mod.APPS : []
85
+ } catch {
86
+ cached = []
87
+ }
88
+ return cached
89
+ }
90
+
91
+ /** synchronous view of the registry — empty until `loadOptionalDemoApps()` has
92
+ * resolved at least once. every caller that builds a result from the registry
93
+ * awaits the load first. */
94
+ export function optionalDemoAppsSync(): OptionalDemoApp[] {
95
+ return cached ?? []
96
+ }
97
+
98
+ /** replace the registry with a fixed list, and restore it on the returned
99
+ * handle. what the real registry holds depends on which third-party app
100
+ * checkouts and credential files happen to exist on the machine, so a test
101
+ * that reads it asserts on the developer's home directory rather than on the
102
+ * code. it passes on the box that has them and fails everywhere else. */
103
+ export function __withOptionalDemoAppsForTests(apps: OptionalDemoApp[]): {
104
+ restore: () => void
105
+ } {
106
+ const previous = cached
107
+ cached = apps
108
+ return {
109
+ restore: () => {
110
+ cached = previous
111
+ },
112
+ }
113
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ // npm installs package code only. `sootsim setup` owns runtime and machine
3
+ // changes so installs never download a runtime or register a service implicitly.
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+ // preuninstall — runs before `npm rm -g sootsim` actually removes the bin.
3
+ //
4
+ // without this hook the user is left with a 79MB ghost: a launchd/systemd
5
+ // service still ENABLED + actively running (with ExecStart pointing at the
6
+ // now-missing binary), ~/.sootsim/ (cache + runtimes + electron + profiles +
7
+ // daemon.json), and the user's first instinct (`sootsim daemon uninstall`)
8
+ // is gone with the package. so we tear it all down here, while the bin still
9
+ // exists.
10
+ //
11
+ // reliability: npm preuninstall hooks are best-effort — they don't fire when
12
+ // the package wasn't installed by npm (yarn/bun/pnpm have their own lifecycle
13
+ // rules), and they don't run as part of `npm cache verify` cleanup or manual
14
+ // dir removal. that's why `sootsim daemon uninstall` is also documented as
15
+ // the manual teardown path.
16
+ //
17
+ // strategy: spawn the bundled bin to run `daemon uninstall` (single source of
18
+ // truth — the same logic the user invokes manually). if that fails for any
19
+ // reason — node version mismatch, the bin already removed by a previous
20
+ // half-completed run, missing $HOME — do a best-effort raw fs cleanup so the
21
+ // machine isn't left in a broken state.
22
+
23
+ const { spawnSync } = require('child_process')
24
+ const fs = require('fs')
25
+ const os = require('os')
26
+ const path = require('path')
27
+
28
+ if (process.env.SOOTSIM_SKIP_PREUNINSTALL === '1') {
29
+ process.exit(0)
30
+ }
31
+
32
+ // dev / workspace installs (running inside the Contrast monorepo, not in a
33
+ // node_modules tree) — don't tear anything down. the developer is rebuilding
34
+ // the workspace, not actually uninstalling.
35
+ const pkgDir = path.resolve(__dirname, '..')
36
+ if (!pkgDir.includes(`${path.sep}node_modules${path.sep}`)) {
37
+ process.exit(0)
38
+ }
39
+
40
+ // skipped under sudo for the same reason as postinstall: $HOME would be /root,
41
+ // but the user who needs cleanup is the one who installed sootsim. they can
42
+ // run `sootsim daemon uninstall` themselves before `sudo npm rm -g sootsim`
43
+ // to clean their own home.
44
+ const isRoot = typeof process.getuid === 'function' && process.getuid() === 0
45
+ if (isRoot && process.env.SUDO_USER) {
46
+ console.log(
47
+ 'rnx: preuninstall skipped under sudo — run `rnxsim daemon uninstall` ' +
48
+ 'as your user first to remove ~/.sootsim and the bridge daemon',
49
+ )
50
+ process.exit(0)
51
+ }
52
+
53
+ const bin = path.join(pkgDir, 'dist-cli', 'bin.js')
54
+ let unifiedOk = false
55
+ if (fs.existsSync(bin)) {
56
+ const res = spawnSync(process.execPath, [bin, 'daemon', 'uninstall'], {
57
+ stdio: 'inherit',
58
+ timeout: 30_000,
59
+ })
60
+ unifiedOk = res.status === 0
61
+ }
62
+
63
+ if (!unifiedOk) {
64
+ // raw fallback. mirrors teardownDaemonService + teardownSootsimHome from
65
+ // cli/commands/daemon.ts. idempotent: each entry is checked before remove.
66
+ console.log('rnx: bin path failed — running raw cleanup fallback')
67
+ rawCleanup()
68
+ }
69
+
70
+ process.exit(0)
71
+
72
+ function rawCleanup() {
73
+ const home = sootsimHomeDir()
74
+ if (process.platform === 'darwin') {
75
+ safeSpawn('launchctl', ['bootout', `gui/${getuid()}/dev.sootsim.daemon`])
76
+ safeSpawn('launchctl', ['bootout', `gui/${getuid()}/dev.sootsim.server`])
77
+ safeRemove(path.join(os.homedir(), 'Library/LaunchAgents/dev.sootsim.daemon.plist'))
78
+ safeRemove(path.join(os.homedir(), 'Library/LaunchAgents/dev.sootsim.server.plist'))
79
+ safeRemove(path.join(os.homedir(), 'Library/Logs/sootsim'), {
80
+ recursive: true,
81
+ })
82
+ } else if (process.platform === 'linux') {
83
+ safeSpawn('systemctl', ['--user', 'disable', '--now', 'sootsim-daemon'])
84
+ safeSpawn('systemctl', ['--user', 'daemon-reload'])
85
+ safeSpawn('systemctl', ['--user', 'reset-failed', 'sootsim-daemon'])
86
+ safeRemove(path.join(os.homedir(), '.config/systemd/user/sootsim-daemon.service'))
87
+ safeRemove(path.join(os.homedir(), '.local/state/sootsim'), { recursive: true })
88
+ }
89
+ // ~/.sootsim is the same on every platform; honor $SOOTSIM_HOME.
90
+ safeRemove(home, { recursive: true })
91
+ }
92
+
93
+ function sootsimHomeDir() {
94
+ const env = process.env.SOOTSIM_HOME
95
+ if (env && env.length > 0) return path.resolve(env)
96
+ return path.join(os.homedir(), '.sootsim')
97
+ }
98
+
99
+ function safeRemove(p, opts) {
100
+ try {
101
+ if (fs.existsSync(p)) {
102
+ fs.rmSync(p, { force: true, ...(opts || {}) })
103
+ console.log(` removed ${p}`)
104
+ }
105
+ } catch (err) {
106
+ console.log(` could not remove ${p}: ${err && err.message}`)
107
+ }
108
+ }
109
+
110
+ function safeSpawn(cmd, args) {
111
+ try {
112
+ spawnSync(cmd, args, { stdio: 'ignore' })
113
+ } catch {}
114
+ }
115
+
116
+ function getuid() {
117
+ return typeof process.getuid === 'function' ? process.getuid() : 0
118
+ }
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: contrast
3
+ description: >-
4
+ index of all Contrast and rnx agent skills and CLI commands.
5
+ auto-generated from the CLI info registry — do not edit by hand.
6
+ ---
7
+
8
+ # contrast
9
+
10
+ overview of all available skills and CLI commands in this repo.
11
+
12
+ > this file is auto-generated by `bun scripts/generate-contrast-skill.ts`.
13
+ > to update, edit the source registries and re-run the generator.
14
+
15
+ ## rnx CLI commands
16
+
17
+ the `rnxsim` CLI is the operational surface for booting shells, driving
18
+ automation, inspecting the render tree, and managing sims.
19
+
20
+ | command | description |
21
+ | --- | --- |
22
+ | `rnxsim maestro` | author, generate, and run Maestro YAML flows against rnx |
23
+ | `rnxsim detox` | run existing Detox suites against rnx on headless Chromium |
24
+ | `rnxsim cleanup` | inspect and reclaim local rnx disk usage |
25
+ | `rnxsim record` | capture the live sim as webm/mp4/gif, or sample N png frames (--frames) |
26
+ | `rnxsim film` | record a flow on the flat canvas, replay it on the 3d device stage under a camera cinematic, save a clip |
27
+ | `rnxsim storage` | manage guest app storage and launch profiles |
28
+ | `rnxsim permissions` | inspect and change simulated operating-system permissions |
29
+ | `rnxsim perf` | CPU, React render, shell frame, and scroll-layer profiling |
30
+ | `rnxsim describe` | curated human-readable UI summary (default inspection tool) |
31
+ | `rnxsim find` | locate nodes by text / testID / role / type / predicate |
32
+ | `rnxsim assert` | run any read verb and convert its output into an exit code |
33
+ | `rnxsim screenshot` | capture PNGs and manage App Store screenshot assets |
34
+ | `rnxsim get` | read runtime state (tree, a11y, layout, url, count, errors, …) |
35
+ | `rnxsim do` | drive the app (tap, type, scroll, swipe, key, reload, …) |
36
+ | `rnxsim wait` | block until the runtime reaches a known state |
37
+ | `rnxsim shell` | drive shell state and simulator chrome |
38
+ | `rnxsim mode` | toggle screenshot and 3D display modes |
39
+ | `rnxsim device` | inspect or change the live device preset for a sim |
40
+ | `rnxsim inspect` | query, describe, and drive the running rnx instance |
41
+ | `rnxsim network` | inspect live network traffic from the running rnx worker |
42
+ | `rnxsim logs` | inspect live console output from the running rnx worker |
43
+ | `rnxsim debug` | drive __sootsimDebug: channels, snapshots, and inspectors |
44
+ | `rnxsim what-happened` | show recent semantic events: toasts, keyboards, screens, alerts, fetches, errors |
45
+ | `rnxsim timeline` | control the semantic event timeline (enable opt-in kinds, clear, dump) |
46
+ | `rnxsim open` | load a target into the current sim or open a new one |
47
+ | `rnxsim list` | list connected sims or available launch drivers |
48
+ | `rnxsim use` | select a connected sim |
49
+ | `rnxsim skill` | install and inspect bundled rnx agent skills |
50
+ | `rnxsim claim` | take an exclusive lease on a sim |
51
+ | `rnxsim agent` | attached projects + local agent sessions (codex/claude) |
52
+ | `rnxsim close` | close a connected sim |
53
+ | `rnxsim setup` | check local setup and install the recommended bridge daemon |
54
+ | `rnxsim compat` | check package compatibility |
55
+ | `rnxsim report-issue` | send an explicitly approved compatibility report |
56
+ | `rnxsim desktop` | launch or install the desktop companion |
57
+ | `rnxsim daemon` | manage the optional background bridge service |
58
+ | `rnxsim version` | show the CLI + engine runtime versions you are running |
59
+ | `rnxsim upgrade` | update the rnxsim CLI and engine runtime to the latest |
60
+ | `rnxsim serve` | run the rnx bridge in the foreground |
61
+ | `rnxsim runtime` | manage engine runtimes under ~/.sootsim/runtimes/ |
62
+ | `rnxsim auth` | inspect active CLI auth |
63
+ | `rnxsim login` | sign in for preview uploads |
64
+ | `rnxsim logout` | clear the local desktop auth session |
65
+ | `rnxsim config` | manage local CLI preferences |
66
+
67
+ ### runtime verb groups
68
+
69
+ every runtime verb is organized under one of these grouping prefixes.
70
+ run `rnxsim --help` to see the full list under each group.
71
+
72
+ - `rnxsim describe` — summarize the current UI
73
+ - `rnxsim find <...>` — unified finder (bare text, --testid, --role, --type, --pressable, --visible)
74
+ - `rnxsim get <noun>` — read runtime state (tree, a11y, url, count, errors, warnings, requests, globals, layout, node)
75
+ - `rnxsim do <action>` — drive the app (tap, tap-text, tap-id, type, type-into, key, dismiss, scroll, drag, swipe, pinch, reload, shell, sleep, settle, wait)
76
+ - `rnxsim debug <tool>` — instrumentation (state, js, eval, perf, sample-color, enable/disable channels, snapshots, diff, record, recent)
77
+
78
+ ### global flags
79
+
80
+ - `-h, --help` — show help
81
+ - `-V, --version` — show version
82
+ - `-v, --verbose` — verbose output
83
+ - `-p, --port <number>` — bridge port, depending on command
84
+ - `-d, --device <model>` — override the simulated device model
85
+ - `-t, --theme <scheme>` — override light, dark, or auto color scheme
86
+ - `--headless` — run browser automation without a visible window where supported
87
+
88
+ ## bundled rnx agent skills
89
+
90
+ skills for working with the rnx native preview engine:
91
+
92
+ | skill | description |
93
+ | --- | --- |
94
+ | `/rnx-debug` | Debug rendering, animation, gesture, performance, and accessibility issues in a React Native app running under rnx. Reach for this whenever an animation looks wrong (janky, stutters, snaps, only updates once, or doesn't move at all), a swipe/transition/gesture misbehaves or feels broken, scrolling drops frames or feels slow, the UI renders the wrong tree/props, or a screen reader can't reach something — and drive the rnxsim CLI debug tooling first, not screenshots or ad-hoc logging. |
95
+ | `/rnx-perf` | Optimize rnx engine and app performance — scroll jank, dropped frames, slow animation, idle CPU, memory growth, and "smooth normally but laggy under load" (video calls, busy machines). Covers measuring on the right thread with the right browser, proving each perf tier actually engages via its counters, a CPU-contention test harness, and the map of existing perf machinery so you improve it instead of reinventing it. For general app debugging load /rnx-debug first. |
96
+ | `/rnx-setup` | Get rnx connected to your React Native app — from `rnxsim setup` to a driveable sim |
97
+ | `/rnx-test` | Run automated tests against your React Native app under rnx with Maestro YAML or Detox/Jest |
98
+ | `/rnx-visual` | Pixel-level rendering comparison between rnx and native iOS — fonts, gradients, shadows, image fidelity |
99
+
100
+ ## automatic settling
101
+
102
+ every CLI command already waits at the right moment — **do not wrap
103
+ commands in your own `sleep` or chain `do settle` "just to be safe"**.
104
+
105
+ - **before read commands** (`describe`, `find`, `get`, `tree`, `node`,
106
+ `layout`, `screenshot`, `capture`, `a11y`, `sample-color`, `count`,
107
+ and every gesture — `tap`, `tap-id`, `tap-text`, `type-into`,
108
+ `touch`, `swipe`, `drag`, `scroll`, `pinch`, `long-press`,
109
+ `double-tap`, `gesture`) the CLI waits up to **1800 ms** for any
110
+ in-flight screen transition to actually start, so the tree you read is
111
+ never mid-flip.
112
+ - **after write commands** (`tap`, `tap-text`, `tap-id`, `type`,
113
+ `type-into`, `key`, `key-sequence`, `keycode`, `drag`, `swipe`,
114
+ `long-press`, `touch`, `gesture`, `pinch`, `scroll`, `shell`)
115
+ the CLI polls the layout hash until it is stable for two consecutive
116
+ frames. budget: **400 ms for agents** (`SOOTSIM_AGENT=1`, set by the
117
+ harness), 200 ms for humans.
118
+
119
+ what this means:
120
+
121
+ - `rnxsim do tap-id login` then `rnxsim find "Welcome"` Just Works™.
122
+ - you only need `rnxsim do settle <seconds>` or `rnxsim wait idle
123
+ --max-ms <N>` when the CLI explicitly prints
124
+ `⚠ auto-wait timed out after Nms — next command may see mid-animation
125
+ state`, or when the transition you care about lasts longer than ~400 ms
126
+ (full stack navigation, crossfades, video load).
127
+ - opt-out: `--no-wait` on a single command, `SOOTSIM_NO_AUTO_WAIT=1`
128
+ for a whole lane.
129
+ - if a read keeps racing its write, the fix is **never** a blind `sleep` —
130
+ prefer `wait selector`, `wait ready`, `wait idle`, or a longer
131
+ explicit `do settle`, and investigate whether the app's animation
132
+ completion signal is actually firing.
133
+
134
+ ## quick reference
135
+
136
+ ### dev workflow
137
+
138
+ ```sh
139
+ bun dev # start everything
140
+ rnxsim dev -- pnpm dev # wrap a bundler
141
+ rnxsim open 8081 # load an app
142
+ rnxsim describe # inspect the UI tree
143
+ ```
144
+
145
+ ### debugging
146
+
147
+ ```sh
148
+ rnxsim get errors 5 # recent console errors
149
+ rnxsim get requests 5 # recent failed requests
150
+ rnxsim debug snapshot before # capture state
151
+ rnxsim debug diff before after # compare snapshots
152
+ rnxsim debug state shell # runtime state dump
153
+ ```
154
+
155
+ ### testing
156
+
157
+ ```sh
158
+ rnxsim maestro test .maestro/ # run Maestro YAML flows
159
+ rnxsim maestro generate "login" # generate and run a Maestro flow
160
+ rnxsim detox # run Detox/Jest suites
161
+ ```
162
+
163
+ ### inspection
164
+
165
+ ```sh
166
+ rnxsim describe # visible elements
167
+ rnxsim find "Sign in" # find by text
168
+ rnxsim find --testid loginButton # find by testID
169
+ rnxsim do tap-text "Submit" # tap by text
170
+ rnxsim do type "hello" # type text
171
+ ```