sootsim 0.1.138 → 0.1.140

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 (161) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-TD7SHXRH.js → agent-N767ME6M.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-H6JLLQAZ.js → agent-wrapper-ELHIUFZZ.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-JDQFGE3V.js → app-fonts-OZ3OSNAJ.js} +2 -2
  5. package/dist-cli/chunks/{assert-2XLXLJOD.js → assert-GGFUQBNB.js} +2 -2
  6. package/dist-cli/chunks/auto-bootstrap-L5E6XMCK.js +2 -0
  7. package/dist-cli/chunks/beta-D74SDA2L.js +2 -0
  8. package/dist-cli/chunks/camera-5PYEDLLB.js +20 -0
  9. package/dist-cli/chunks/chunk-4FBFOWV3.js +4 -0
  10. package/dist-cli/chunks/{chunk-7ELG4PYE.js → chunk-4FGNOWB6.js} +1 -1
  11. package/dist-cli/chunks/{chunk-ZSPUTLK7.js → chunk-5EP5RRNS.js} +35 -34
  12. package/dist-cli/chunks/{chunk-BA3QQ5B3.js → chunk-5VTYMBUK.js} +2 -2
  13. package/dist-cli/chunks/chunk-6KUVOSFF.js +79 -0
  14. package/dist-cli/chunks/{chunk-CTXIRBH2.js → chunk-77TL74AM.js} +1 -1
  15. package/dist-cli/chunks/{chunk-BDOLDROC.js → chunk-7SMEXHWJ.js} +1 -1
  16. package/dist-cli/chunks/{chunk-JFQVDRBK.js → chunk-AI65UVSN.js} +52 -4
  17. package/dist-cli/chunks/{chunk-XWHR6IKV.js → chunk-AOICEZCA.js} +2 -2
  18. package/dist-cli/chunks/chunk-AP2MOP44.js +2 -0
  19. package/dist-cli/chunks/chunk-BEA3AO36.js +5 -0
  20. package/dist-cli/chunks/{chunk-PILBWKNB.js → chunk-BGXNYXBC.js} +1 -1
  21. package/dist-cli/chunks/{chunk-FFVME5EQ.js → chunk-BLQBPN76.js} +2 -2
  22. package/dist-cli/chunks/{chunk-Q4J2SESV.js → chunk-BM7QWZRI.js} +2 -2
  23. package/dist-cli/chunks/{chunk-5N5MQQM5.js → chunk-C3FURRBF.js} +1 -1
  24. package/dist-cli/chunks/{chunk-RHU73TIJ.js → chunk-CQ3LV5VL.js} +2 -2
  25. package/dist-cli/chunks/chunk-EH6YDCSN.js +119 -0
  26. package/dist-cli/chunks/{chunk-T3HJHXXN.js → chunk-EMNVJOEL.js} +3 -3
  27. package/dist-cli/chunks/{chunk-C563J47N.js → chunk-FYUDIUFX.js} +2 -2
  28. package/dist-cli/chunks/{chunk-WHIZNJLR.js → chunk-GI43DDEI.js} +1 -1
  29. package/dist-cli/chunks/{chunk-KLFGCFE4.js → chunk-GL74P6NR.js} +1 -1
  30. package/dist-cli/chunks/{chunk-GYZ5ZZMH.js → chunk-GYZNLDBX.js} +2 -2
  31. package/dist-cli/chunks/chunk-HPTMLB7V.js +2 -0
  32. package/dist-cli/chunks/{chunk-NPUHFOSG.js → chunk-MRQRJINW.js} +1 -1
  33. package/dist-cli/chunks/{chunk-IEGRNKTT.js → chunk-N2XPC4Z7.js} +2 -2
  34. package/dist-cli/chunks/chunk-NQG4R5K2.js +1 -0
  35. package/dist-cli/chunks/{chunk-62DPZPFC.js → chunk-O2SQNUDP.js} +1 -1
  36. package/dist-cli/chunks/{chunk-I7RL227U.js → chunk-PBS47TD5.js} +2 -2
  37. package/dist-cli/chunks/chunk-Q5Z7P54I.js +2 -0
  38. package/dist-cli/chunks/{chunk-FBDOREAI.js → chunk-QOZ2Q4FH.js} +1 -1
  39. package/dist-cli/chunks/{chunk-SX6BVZL5.js → chunk-QRRBQE6M.js} +2 -2
  40. package/dist-cli/chunks/{chunk-KJOBH5CA.js → chunk-QXOZB7WD.js} +2 -2
  41. package/dist-cli/chunks/{chunk-3XBLSPSH.js → chunk-R5F7XGAO.js} +3 -3
  42. package/dist-cli/chunks/{chunk-VIZ5BLM2.js → chunk-RAY2DLSK.js} +1 -1
  43. package/dist-cli/chunks/{chunk-TP3NTZUM.js → chunk-REIC7HRW.js} +1 -1
  44. package/dist-cli/chunks/chunk-S7I6ZCT2.js +1 -0
  45. package/dist-cli/chunks/{chunk-GSGRNYPC.js → chunk-SSZBFWV7.js} +1 -1
  46. package/dist-cli/chunks/chunk-UHTE6FLK.js +69 -0
  47. package/dist-cli/chunks/{chunk-MZ7TYYP7.js → chunk-WGDXZMKT.js} +2 -2
  48. package/dist-cli/chunks/chunk-WN3WZEE5.js +1 -0
  49. package/dist-cli/chunks/{chunk-JEL7BQG7.js → chunk-X6AWKKL4.js} +2 -2
  50. package/dist-cli/chunks/{chunk-T6QPOIJN.js → chunk-XGYD25DJ.js} +1 -1
  51. package/dist-cli/chunks/{chunk-XV6XIC4J.js → chunk-ZGDJ5TFU.js} +2 -2
  52. package/dist-cli/chunks/{chunk-KBOMW6U3.js → chunk-ZN4Z2W7F.js} +2 -2
  53. package/dist-cli/chunks/{chunk-MNKYCXHQ.js → chunk-ZVQOEMXS.js} +52 -52
  54. package/dist-cli/chunks/cli-version-EZRTEUXF.js +2 -0
  55. package/dist-cli/chunks/{compat-6KRCWKBL.js → compat-U3772TUK.js} +3 -3
  56. package/dist-cli/chunks/{config-JGTLOWS6.js → config-6CZCIYKJ.js} +2 -2
  57. package/dist-cli/chunks/{control-3LHOESUK.js → control-NVA25O65.js} +2 -2
  58. package/dist-cli/chunks/{cpu-profile-KWE5IXBN.js → cpu-profile-WRLTZYO6.js} +2 -2
  59. package/dist-cli/chunks/{daemon-S5LNAQAU.js → daemon-QQPGLGS6.js} +2 -2
  60. package/dist-cli/chunks/{debug-KJ3TNXUN.js → debug-RKYLSDZV.js} +3 -3
  61. package/dist-cli/chunks/{detox-UJIPM47N.js → detox-ZRUQQU22.js} +2 -2
  62. package/dist-cli/chunks/{device-23SEWSUA.js → device-HXTOLEWY.js} +2 -2
  63. package/dist-cli/chunks/{diagnose-53JGSJF2.js → diagnose-QN4E4WA6.js} +2 -2
  64. package/dist-cli/chunks/drivers-EVK22AX5.js +2 -0
  65. package/dist-cli/chunks/{electron-F43274XT.js → electron-ZHRC4WQ5.js} +3 -3
  66. package/dist-cli/chunks/flow-ICCRVJVX.js +2 -0
  67. package/dist-cli/chunks/help-QMZ35MIQ.js +2 -0
  68. package/dist-cli/chunks/{hints-6EFUPUX6.js → hints-HCHKMDUE.js} +2 -2
  69. package/dist-cli/chunks/{home-paths-TAGKOEXO.js → home-paths-3OHKRAE4.js} +2 -2
  70. package/dist-cli/chunks/{inspect-UVBYBYJB.js → inspect-QXUBDKJJ.js} +3 -3
  71. package/dist-cli/chunks/install-JSDZIE2T.js +2 -0
  72. package/dist-cli/chunks/{install-desktop-M2QEFAIN.js → install-desktop-QCX44BGL.js} +7 -7
  73. package/dist-cli/chunks/{keys-IJNQHCGZ.js → keys-VEP2KPUF.js} +2 -2
  74. package/dist-cli/chunks/{launch-UK4I6UYE.js → launch-K4BPQLTP.js} +3 -3
  75. package/dist-cli/chunks/{login-OBLKQALN.js → login-UVC5XRKR.js} +4 -4
  76. package/dist-cli/chunks/{logout-HUOLFAU6.js → logout-3VW34IBA.js} +2 -2
  77. package/dist-cli/chunks/{maestro-B6JMWFEO.js → maestro-HTFXXMLR.js} +2 -2
  78. package/dist-cli/chunks/optional-demo-registry-5YYEAL46.js +2 -0
  79. package/dist-cli/chunks/{preview-TYICI3EN.js → preview-TZYJMLEJ.js} +2 -2
  80. package/dist-cli/chunks/{profile-NQO5HFFJ.js → profile-HDJRF7YB.js} +2 -2
  81. package/dist-cli/chunks/{react-WXEGMAH6.js → react-RLJR26M7.js} +2 -2
  82. package/dist-cli/chunks/{record-3DK7CCXV.js → record-2LDDHHUY.js} +2 -2
  83. package/dist-cli/chunks/runtime-QPYF2WQX.js +2 -0
  84. package/dist-cli/chunks/{runtime-delivery-QAHWI6JH.js → runtime-delivery-3F6O57E5.js} +2 -2
  85. package/dist-cli/chunks/{screenshot-SQ7ETUJY.js → screenshot-QAUSSEPK.js} +2 -2
  86. package/dist-cli/chunks/{screenshot-mode-YYIBQI6S.js → screenshot-mode-K6HEVK4K.js} +2 -2
  87. package/dist-cli/chunks/{screenshots-YH5P24GR.js → screenshots-TWMCGUBT.js} +2 -2
  88. package/dist-cli/chunks/{server-PVYHPTCD.js → server-ZPIZCBW5.js} +3 -3
  89. package/dist-cli/chunks/setup-repo-VHOZJEIV.js +2 -0
  90. package/dist-cli/chunks/{skills-2V2A7R4O.js → skills-NI3RH7CW.js} +2 -2
  91. package/dist-cli/chunks/{start-JKY3T6AY.js → start-G6CQL6HJ.js} +4 -4
  92. package/dist-cli/chunks/store-F6MJUJYW.js +2 -0
  93. package/dist-cli/chunks/telemetry-DM2Y7OQJ.js +2 -0
  94. package/dist-cli/chunks/{test-FVA5WGGM.js → test-V47D6EPK.js} +3 -3
  95. package/dist-cli/chunks/{three-mode-GVODLLP3.js → three-mode-G7N3LRHM.js} +2 -2
  96. package/dist-cli/chunks/{timeline-LCJYWJBG.js → timeline-EBUOILTJ.js} +2 -2
  97. package/dist-cli/chunks/{upgrade-4TVPQJRL.js → upgrade-OQJLTCQP.js} +2 -2
  98. package/dist-cli/chunks/upload-W3YCA65H.js +2 -0
  99. package/dist-cli/chunks/{version-2XWRCYTM.js → version-3YJPPUE5.js} +2 -2
  100. package/dist-cli/chunks/web-ZKUX5ICX.js +2 -0
  101. package/dist-cli/chunks/{what-happened-R57H6WK6.js → what-happened-HOY3TA42.js} +2 -2
  102. package/dist-cli/chunks/{whoami-YCVHJHIM.js → whoami-GOCSBVTG.js} +2 -2
  103. package/dist-lib/agent-daemon-client.cjs +1 -1
  104. package/dist-lib/agent-events.cjs +1 -1
  105. package/dist-lib/agent-sessions.cjs +1 -1
  106. package/dist-lib/attached-projects.cjs +42 -820
  107. package/dist-lib/auth/shared-session.cjs +1 -1
  108. package/dist-lib/backend-origin.cjs +1 -1
  109. package/dist-lib/beta.cjs +1 -1
  110. package/dist-lib/beta.mjs +1 -1
  111. package/dist-lib/bridge-constants.cjs +1 -1
  112. package/dist-lib/cli-constants.cjs +1 -1
  113. package/dist-lib/config.cjs +1 -1
  114. package/dist-lib/detox/index.cjs +1 -1
  115. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  116. package/dist-lib/home-paths.cjs +1 -1
  117. package/dist-lib/host/bridge-host.cjs +179 -956
  118. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  119. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  120. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  121. package/dist-lib/host/websocket-proxy.cjs +1 -1
  122. package/dist-lib/index.cjs +1 -1
  123. package/dist-lib/metro.cjs +1 -1
  124. package/dist-lib/profiles.cjs +1 -1
  125. package/dist-lib/render-mode.cjs +1 -1
  126. package/dist-lib/scripts/dev-server-scanner.cjs +29 -797
  127. package/dist-lib/sdk.cjs +1 -1
  128. package/dist-lib/sdk.mjs +1 -1
  129. package/dist-lib/skills.cjs +660 -1032
  130. package/dist-lib/vite.cjs +1 -1
  131. package/package.json +2 -6
  132. package/scripts/dev-server-scanner.ts +10 -2
  133. package/scripts/optional-demo-registry.ts +54 -0
  134. package/src/attached-projects.ts +6 -27
  135. package/dist-cli/chunks/auto-bootstrap-Q7Z5522T.js +0 -2
  136. package/dist-cli/chunks/beta-LW4TRSKL.js +0 -2
  137. package/dist-cli/chunks/chunk-3AVKOCIL.js +0 -5
  138. package/dist-cli/chunks/chunk-BXITI3GQ.js +0 -4
  139. package/dist-cli/chunks/chunk-DBJCMZX7.js +0 -1
  140. package/dist-cli/chunks/chunk-DV4DKAHB.js +0 -64
  141. package/dist-cli/chunks/chunk-KYAAYSMS.js +0 -2
  142. package/dist-cli/chunks/chunk-M6GZUJXH.js +0 -62
  143. package/dist-cli/chunks/chunk-N4DFR7UX.js +0 -79
  144. package/dist-cli/chunks/chunk-N7TXV2XT.js +0 -1
  145. package/dist-cli/chunks/chunk-SIKDBA2E.js +0 -119
  146. package/dist-cli/chunks/chunk-YB7NANNJ.js +0 -1
  147. package/dist-cli/chunks/chunk-ZS55UGAA.js +0 -2
  148. package/dist-cli/chunks/cli-version-ROECZHPK.js +0 -2
  149. package/dist-cli/chunks/demo-app-registry-SU74KYFQ.js +0 -2
  150. package/dist-cli/chunks/drivers-LQS4T2IT.js +0 -2
  151. package/dist-cli/chunks/flow-H4F2X23Y.js +0 -2
  152. package/dist-cli/chunks/help-BT5NJNJ5.js +0 -2
  153. package/dist-cli/chunks/install-P5R6747T.js +0 -2
  154. package/dist-cli/chunks/runtime-IFNZGBPZ.js +0 -2
  155. package/dist-cli/chunks/setup-repo-Y63FUXRC.js +0 -2
  156. package/dist-cli/chunks/store-KNRC4EGM.js +0 -2
  157. package/dist-cli/chunks/telemetry-HDSITSDA.js +0 -2
  158. package/dist-cli/chunks/upload-3AXP6K6R.js +0 -2
  159. package/dist-cli/chunks/web-4Z6SFQFV.js +0 -2
  160. package/dist-lib/scripts/demo-app-registry.cjs +0 -818
  161. package/scripts/demo-app-registry.ts +0 -1006
@@ -1,1006 +0,0 @@
1
- import { existsSync, readFileSync, writeFileSync } from 'node:fs'
2
- import { homedir } from 'node:os'
3
- import { dirname, join, resolve } from 'node:path'
4
- import type { SootSimConfig } from '../src/config.ts'
5
-
6
- export interface DemoApp {
7
- name: string
8
- label: string
9
- dir: string
10
- preferredPort: number
11
- framework: 'expo' | 'one' | 'rock'
12
- runtimeConfig?: SootSimConfig
13
- sidecars?: DemoSidecar[]
14
- // extra ports owned by the main demo command, derived from the chosen app
15
- // port. unlike sidecars, these are not independently reusable services; the
16
- // launcher clears/reserves them with the app command so stale child stacks
17
- // cannot leave the app talking to the wrong backend.
18
- managedPorts?: (port: number) => number[]
19
- prepare?: () => void | Promise<void>
20
- command: (port: number) => { cmd: string; env?: Record<string, string> }
21
- disabled?: boolean
22
- note?: string
23
- // override the dev-server readiness timeout (default 90s). use for stacks
24
- // like takeout's `bun lite` that bring up postgres + zero + minio + One
25
- // and need longer to settle on a cold start.
26
- readyTimeoutMs?: number
27
- // env vars this demo can consume for credentials/sign-in. the demo launcher
28
- // prints their presence/absence in its summary so you know whether an
29
- // app can auto-login. format: { HANDLE: 'natew.bsky.social' } to show a
30
- // known handle even when stored elsewhere.
31
- credentials?: {
32
- envVars?: string[]
33
- optionalEnvVars?: string[]
34
- known?: Record<string, string>
35
- note?: string
36
- }
37
- }
38
-
39
- export interface DemoSidecar {
40
- name: string
41
- port: number
42
- readyPath?: string
43
- command: () => { cmd: string; env?: Record<string, string> }
44
- }
45
-
46
- const HOME = homedir()
47
-
48
- function findWorkspaceRoot(startDir: string): string | null {
49
- let dir = startDir
50
- while (true) {
51
- if (
52
- existsSync(join(dir, 'pnpm-workspace.yaml')) ||
53
- existsSync(join(dir, 'turbo.json')) ||
54
- existsSync(join(dir, 'nx.json')) ||
55
- existsSync(join(dir, 'lerna.json'))
56
- ) {
57
- return dir
58
- }
59
-
60
- const packageJsonPath = join(dir, 'package.json')
61
- if (existsSync(packageJsonPath)) {
62
- try {
63
- const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {
64
- workspaces?: unknown
65
- }
66
- if (pkg.workspaces) return dir
67
- } catch {}
68
- }
69
-
70
- const parent = dirname(dir)
71
- if (parent === dir) return null
72
- dir = parent
73
- }
74
- }
75
-
76
- function resolveWorkspaceScriptPath(
77
- workspaceRelativePath: string,
78
- packageRelativePath: string,
79
- ): string {
80
- const workspaceRoot = findWorkspaceRoot(process.cwd())
81
- const candidates = [
82
- workspaceRoot ? resolve(workspaceRoot, workspaceRelativePath) : null,
83
- resolve(process.cwd(), workspaceRelativePath),
84
- resolve(process.cwd(), packageRelativePath),
85
- ].filter((candidate): candidate is string => Boolean(candidate))
86
-
87
- for (const candidate of candidates) {
88
- if (existsSync(candidate)) return candidate
89
- }
90
-
91
- return candidates[0] ?? resolve(process.cwd(), workspaceRelativePath)
92
- }
93
-
94
- const getExpensifyProxyScript = () =>
95
- resolveWorkspaceScriptPath(
96
- 'packages/sootsim-engine/scripts/expensify-web-proxy.ts',
97
- 'scripts/expensify-web-proxy.ts',
98
- )
99
- const getRainbowMetadataProxyScript = () =>
100
- resolveWorkspaceScriptPath(
101
- 'packages/sootsim-engine/scripts/rainbow-metadata-proxy.ts',
102
- 'scripts/rainbow-metadata-proxy.ts',
103
- )
104
- const getMattermostRNUtilsNativeModule = () =>
105
- resolveWorkspaceScriptPath(
106
- 'packages/compat/src/stubs/mattermost-rnutils-native.ts',
107
- '../compat/src/stubs/mattermost-rnutils-native.ts',
108
- )
109
- const getMattermostKeychainNativeModule = () =>
110
- resolveWorkspaceScriptPath(
111
- 'packages/compat/src/stubs/native-seams/react-native-keychain-manager.ts',
112
- '../compat/src/stubs/native-seams/react-native-keychain-manager.ts',
113
- )
114
- const getMattermostNetworkClientNativeModule = () =>
115
- resolveWorkspaceScriptPath(
116
- 'packages/compat/src/stubs/mattermost-network-client-native.ts',
117
- '../compat/src/stubs/mattermost-network-client-native.ts',
118
- )
119
- const getMattermostPreviewServerScript = () =>
120
- resolveWorkspaceScriptPath(
121
- 'packages/sootsim-engine/scripts/mattermost-preview-server.ts',
122
- 'scripts/mattermost-preview-server.ts',
123
- )
124
- const EXPENSIFY_NATIVE_PROXY_ENV = {
125
- USE_NGROK: 'true',
126
- NGROK_URL: 'http://localhost:9000/',
127
- SECURE_NGROK_URL: 'http://localhost:9000/',
128
- }
129
- const MATTERMOST_DIR = join(HOME, 'github/mattermost-mobile')
130
- const UNISWAP_REPO_DIR = join(HOME, 'github/uniswap-interface')
131
- const UNISWAP_APP_DIR = join(UNISWAP_REPO_DIR, 'apps/mobile')
132
- const UNISWAP_ENV_LOCAL_FILE = join(UNISWAP_REPO_DIR, '.env.defaults.local')
133
- const UNISWAP_PLACEHOLDER = 'stored-in-.env.local'
134
- const UNISWAP_DEMO_ENV_MARKER = '# sootsim demo env overrides'
135
- const UNISWAP_FORCE_UPGRADE_HOOK_FILE = join(
136
- UNISWAP_REPO_DIR,
137
- 'packages/uniswap/src/features/forceUpgrade/hooks/useForceUpgradeStatus.ts',
138
- )
139
- const UNISWAP_FORCE_UPGRADE_NOTIFICATION_FILE = join(
140
- UNISWAP_REPO_DIR,
141
- 'apps/mobile/src/notification-service/data-sources/createForceUpgradeNotificationDataSource.ts',
142
- )
143
- const UNISWAP_FORCE_UPGRADE_PATCH_MARKER = 'SOOTSIM_DEMO_DISABLE_FORCE_UPGRADE'
144
-
145
- function parseEnvFile(filePath: string): Record<string, string> {
146
- if (!existsSync(filePath)) return {}
147
-
148
- const env: Record<string, string> = {}
149
- const source = readFileSync(filePath, 'utf8')
150
- for (const rawLine of source.split(/\r?\n/)) {
151
- const line = rawLine.trim()
152
- if (!line || line.startsWith('#')) continue
153
-
154
- const match = line.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/)
155
- if (!match) continue
156
-
157
- let value = match[2].trim()
158
- if (
159
- (value.startsWith('"') && value.endsWith('"')) ||
160
- (value.startsWith("'") && value.endsWith("'"))
161
- ) {
162
- value = value.slice(1, -1)
163
- }
164
-
165
- env[match[1]] = value
166
- }
167
-
168
- return env
169
- }
170
-
171
- function isUsableUniswapEnvValue(value: string | undefined): value is string {
172
- if (!value) return false
173
- const trimmed = value.trim()
174
- if (!trimmed) return false
175
- if (trimmed.includes(UNISWAP_PLACEHOLDER)) return false
176
- if (trimmed === 'TRADING_API_KEY' || trimmed === 'UNISWAP_API_KEY') return false
177
- return true
178
- }
179
-
180
- function pickEnvValue(
181
- sources: Array<Record<string, string | undefined>>,
182
- keys: string[],
183
- ): string | undefined {
184
- for (const source of sources) {
185
- for (const key of keys) {
186
- const value = source[key]
187
- if (isUsableUniswapEnvValue(value)) return value.trim()
188
- }
189
- }
190
- return undefined
191
- }
192
-
193
- function resolveUniswapDemoEnv(): Record<string, string> {
194
- const localEnv = parseEnvFile(UNISWAP_ENV_LOCAL_FILE)
195
- const webEnv = parseEnvFile(join(UNISWAP_REPO_DIR, 'apps/web/.env'))
196
- const sources: Array<Record<string, string | undefined>> = [
197
- process.env as Record<string, string | undefined>,
198
- localEnv,
199
- webEnv,
200
- ]
201
-
202
- const env: Record<string, string> = {}
203
- const bindings: Array<[target: string, aliases: string[]]> = [
204
- ['AMPLITUDE_PROXY_URL_OVERRIDE', ['REACT_APP_AMPLITUDE_PROXY_URL']],
205
- ['QUICKNODE_ENDPOINT_NAME', ['REACT_APP_QUICKNODE_ENDPOINT_NAME']],
206
- ['QUICKNODE_ENDPOINT_TOKEN', ['REACT_APP_QUICKNODE_ENDPOINT_TOKEN']],
207
- ['INFURA_KEY', ['REACT_APP_INFURA_KEY']],
208
- ['STATSIG_API_KEY', ['REACT_APP_STATSIG_API_KEY']],
209
- ['STATSIG_PROXY_URL_OVERRIDE', ['REACT_APP_STATSIG_PROXY_URL']],
210
- ['WALLETCONNECT_PROJECT_ID', ['REACT_APP_WALLET_CONNECT_PROJECT_ID']],
211
- ['WALLETCONNECT_PROJECT_ID_BETA', ['REACT_APP_WALLET_CONNECT_PROJECT_ID']],
212
- ['WALLETCONNECT_PROJECT_ID_DEV', ['REACT_APP_WALLET_CONNECT_PROJECT_ID']],
213
- ['TRADING_API_KEY', ['REACT_APP_TRADING_API_KEY']],
214
- ['UNISWAP_API_KEY', []],
215
- ]
216
-
217
- for (const [target, aliases] of bindings) {
218
- const value = pickEnvValue(sources, [target, ...aliases])
219
- if (!value) continue
220
- env[target] = value
221
- for (const alias of aliases) {
222
- env[alias] = value
223
- }
224
- }
225
-
226
- const hasPrivateGatewayKeys =
227
- isUsableUniswapEnvValue(env.TRADING_API_KEY) &&
228
- isUsableUniswapEnvValue(env.UNISWAP_API_KEY)
229
-
230
- if (!hasPrivateGatewayKeys) {
231
- // fall back to the public web gateway family when private mobile gateway
232
- // keys are unavailable. this won't unlock every endpoint, but it avoids
233
- // the worst ios.wallet-specific failures in local sootsim demos.
234
- const publicGraphqlUrl =
235
- pickEnvValue(sources, ['GRAPHQL_URL_OVERRIDE', 'REACT_APP_AWS_API_ENDPOINT']) ||
236
- 'https://interface.gateway.uniswap.org/v1/graphql'
237
-
238
- env.API_BASE_URL_OVERRIDE = 'https://interface.gateway.uniswap.org'
239
- env.API_BASE_URL_V2_OVERRIDE = 'https://interface.gateway.uniswap.org/v2'
240
- env.GRAPHQL_URL_OVERRIDE = publicGraphqlUrl
241
- env.TRADING_API_URL_OVERRIDE =
242
- 'https://trading-api-labs.interface.gateway.uniswap.org'
243
- env.FOR_API_URL_OVERRIDE =
244
- 'https://for.interface.gateway.uniswap.org/v2/FOR.v1.FORService'
245
- }
246
-
247
- return env
248
- }
249
-
250
- function ensureUniswapDemoEnvLocal(): void {
251
- const existingSource = existsSync(UNISWAP_ENV_LOCAL_FILE)
252
- ? readFileSync(UNISWAP_ENV_LOCAL_FILE, 'utf8')
253
- : ''
254
-
255
- if (existingSource && !existingSource.includes(UNISWAP_DEMO_ENV_MARKER)) {
256
- return
257
- }
258
-
259
- const env = resolveUniswapDemoEnv()
260
- const lines = [UNISWAP_DEMO_ENV_MARKER]
261
- for (const [key, value] of Object.entries(env).sort(([a], [b]) => a.localeCompare(b))) {
262
- lines.push(`${key}=${JSON.stringify(value)}`)
263
- }
264
- lines.push('')
265
- writeFileSync(UNISWAP_ENV_LOCAL_FILE, `${lines.join('\n')}\n`)
266
- }
267
-
268
- function ensureUniswapForceUpgradePatched(): void {
269
- const hookNeedle = `export function useForceUpgradeStatus(): ForceUpgradeStatus {\n`
270
- const hookPatch =
271
- ` // sootsim demo: bypass the force-upgrade gate during local engine demos.\n` +
272
- ` return 'not-required'\n\n`
273
- const hookLegacyPatch =
274
- ` // sootsim demo: bypass the force-upgrade gate during local engine demos.\n` +
275
- ` if (process.env.${UNISWAP_FORCE_UPGRADE_PATCH_MARKER} === 'true') {\n` +
276
- ` return 'not-required'\n` +
277
- ` }\n\n`
278
-
279
- const notificationNeedle = ` const getForceUpgradeStatus = (): ForceUpgradeStatus => {\n`
280
- const notificationPatch =
281
- ` // sootsim demo: bypass the force-upgrade gate during local engine demos.\n` +
282
- ` return 'not-required'\n\n`
283
- const notificationLegacyPatch =
284
- ` // sootsim demo: bypass the force-upgrade gate during local engine demos.\n` +
285
- ` if (process.env.${UNISWAP_FORCE_UPGRADE_PATCH_MARKER} === 'true') {\n` +
286
- ` return 'not-required'\n` +
287
- ` }\n\n`
288
-
289
- const patchWithMigration = (
290
- filePath: string,
291
- needle: string,
292
- patch: string,
293
- legacyPatch: string,
294
- ) => {
295
- const source = readFileSync(filePath, 'utf8')
296
- if (source.includes(patch)) return
297
- if (source.includes(legacyPatch)) {
298
- writeFileSync(filePath, source.replace(legacyPatch, patch))
299
- return
300
- }
301
- if (!source.includes(needle)) {
302
- throw new Error(
303
- `uniswap demo patch failed: expected snippet not found in ${filePath}`,
304
- )
305
- }
306
- writeFileSync(filePath, source.replace(needle, `${needle}${patch}`))
307
- }
308
-
309
- patchWithMigration(
310
- UNISWAP_FORCE_UPGRADE_HOOK_FILE,
311
- hookNeedle,
312
- hookPatch,
313
- hookLegacyPatch,
314
- )
315
- patchWithMigration(
316
- UNISWAP_FORCE_UPGRADE_NOTIFICATION_FILE,
317
- notificationNeedle,
318
- notificationPatch,
319
- notificationLegacyPatch,
320
- )
321
- }
322
-
323
- const JOPLIN_DIR = join(HOME, 'github/joplin')
324
- const JOPLIN_APP_DIR = join(JOPLIN_DIR, 'packages/app-mobile')
325
- // joplin's metro.config.js adds every @joplin/* source dir as a metro
326
- // `watchFolders` entry. on machines where watchman has
327
- // `enforce_root_files: true` set globally (soot's setup), each watched
328
- // root must contain a `.watchmanconfig` or metro crash-exits before
329
- // serving its first bundle. upstream joplin only ships the file in
330
- // `app-mobile` and `whisper-voice-typing`; the other watched packages
331
- // don't have one, so we touch them ourselves. idempotent.
332
- const JOPLIN_WATCH_ROOTS = [
333
- 'packages/lib',
334
- 'packages/renderer',
335
- 'packages/turndown',
336
- 'packages/turndown-plugin-gfm',
337
- 'packages/editor',
338
- 'packages/tools',
339
- 'packages/utils',
340
- 'packages/fork-htmlparser2',
341
- 'packages/fork-uslug',
342
- 'packages/fork-sax',
343
- 'packages/htmlpack',
344
- 'packages/react-native-saf-x',
345
- 'packages/react-native-alarm-notification',
346
- ]
347
-
348
- function ensureJoplinWatchmanConfigs(): void {
349
- if (!existsSync(JOPLIN_DIR)) return
350
- for (const rel of JOPLIN_WATCH_ROOTS) {
351
- const dir = join(JOPLIN_DIR, rel)
352
- if (!existsSync(dir)) continue
353
- const cfg = join(dir, '.watchmanconfig')
354
- if (!existsSync(cfg)) writeFileSync(cfg, '{}\n')
355
- }
356
- }
357
-
358
- // joplin's metro consumes per-package tsc emit (.js next to .ts), rollup
359
- // output for `@joplin/turndown(-plugin-gfm)`, and gulp-generated
360
- // `pluginAssets/index.js` for KaTeX/Mermaid bundles. yarn's root postinstall
361
- // runs `gulp build` which is supposed to produce all of these, but it fails
362
- // silently when run on a fresh clone before workspace builds have completed
363
- // (turndown's `prepare` script doesn't fire in foreach mode). detect the
364
- // three sentinels and run `yarn buildParallel` if any are missing. one-time
365
- // cost (~2 minutes), idempotent thereafter.
366
- const JOPLIN_BUILD_SENTINELS = [
367
- 'packages/lib/models/Setting.js',
368
- 'packages/turndown/lib/turndown.cjs.js',
369
- 'packages/app-mobile/pluginAssets/index.js',
370
- ]
371
-
372
- function ensureJoplinBuilt(): void {
373
- if (!existsSync(JOPLIN_DIR)) return
374
- const missing = JOPLIN_BUILD_SENTINELS.filter(
375
- (rel) => !existsSync(join(JOPLIN_DIR, rel)),
376
- )
377
- if (missing.length === 0) return
378
-
379
- const { execSync } =
380
- require('node:child_process') as typeof import('node:child_process')
381
- // buildParallel walks the workspace topologically and runs `build` in each
382
- // package, then `yarn tsc`. NO_FLIPPER=1 matches joplin's documented
383
- // mobile build flag. unset CI so yarn workspaces foreach doesn't reduce
384
- // parallelism to 1.
385
- execSync('yarn buildParallel', {
386
- cwd: JOPLIN_DIR,
387
- stdio: 'inherit',
388
- env: { ...process.env, NO_FLIPPER: '1', CI: '' },
389
- })
390
-
391
- const stillMissing = JOPLIN_BUILD_SENTINELS.filter(
392
- (rel) => !existsSync(join(JOPLIN_DIR, rel)),
393
- )
394
- if (stillMissing.length > 0) {
395
- throw new Error(
396
- `joplin demo: yarn buildParallel did not produce: ${stillMissing.join(', ')}`,
397
- )
398
- }
399
- }
400
-
401
- const RAINBOW_DIR = join(HOME, 'github/rainbow')
402
- const RAINBOW_GRAPHQL_DIR = join(RAINBOW_DIR, 'src/graphql')
403
- const RAINBOW_GRAPHQL_CONFIG_FILE = join(RAINBOW_GRAPHQL_DIR, 'config.js')
404
- const RAINBOW_NETWORKS_FILE = join(RAINBOW_DIR, 'src/references/networks.json')
405
- const RAINBOW_METADATA_BASE_URL = 'https://metadata.p.rainbow.me'
406
- const RAINBOW_METADATA_PROXY_PORT = 9011
407
- const RAINBOW_DEMO_METADATA_BASE_URL = `http://127.0.0.1:${RAINBOW_METADATA_PROXY_PORT}`
408
- const RAINBOW_PUBLIC_ENS_GRAPHQL_URL =
409
- 'https://api.thegraph.com/subgraphs/name/ensdomains/ens'
410
- const RAINBOW_DEMO_QUOTE_SIGNER = '0x0000000000000000000000000000000000000000'
411
- const RAINBOW_DEMO_RELAY_URL = 'https://relay.rainbow.me'
412
- const RAINBOW_DEMO_MASTER_KEY =
413
- 'sootsim-rainbow-demo-master-key-do-not-use-for-real-wallets'
414
- const RAINBOW_DEMO_RPC_PROXY_BASE_URL = 'https://rpc.rainbow.me/v1'
415
- const RAINBOW_DEMO_RPC_API_KEY = ''
416
- const RAINBOW_DEMO_PUBLIC_RPC_URLS: Record<string, string> = {
417
- '1': 'https://ethereum-rpc.publicnode.com',
418
- }
419
- const RAINBOW_DEMO_SERVICE_API_KEY = 'sootsim-rainbow-demo-api-key'
420
- const RAINBOW_DEMO_SECURE_WALLET_HASH_KEY =
421
- '0x736f6f7473696d2d7261696e626f772d64656d6f2d686173682d6b6579000000'
422
- const RAINBOW_DEMO_WALLETCONNECT_PROJECT_ID = '00000000000000000000000000000000'
423
- const RAINBOW_GRAPHQL_SENTINELS = [
424
- 'src/graphql/__generated__/ens.ts',
425
- 'src/graphql/__generated__/metadata.ts',
426
- 'src/graphql/__generated__/metadataPOST.ts',
427
- ]
428
-
429
- function runRainbowSetupCommand(command: string, cwd: string): void {
430
- const { execSync } =
431
- require('node:child_process') as typeof import('node:child_process')
432
- execSync(command, {
433
- cwd,
434
- stdio: 'inherit',
435
- env: {
436
- ...process.env,
437
- METADATA_BASE_URL: RAINBOW_METADATA_BASE_URL,
438
- RAINBOW_RELAY_QUOTE_SIGNER:
439
- process.env.RAINBOW_RELAY_QUOTE_SIGNER ?? RAINBOW_DEMO_QUOTE_SIGNER,
440
- },
441
- })
442
- }
443
-
444
- function ensureRainbowGraphqlConfig(): void {
445
- if (!existsSync(RAINBOW_GRAPHQL_DIR)) return
446
-
447
- const source = existsSync(RAINBOW_GRAPHQL_CONFIG_FILE)
448
- ? readFileSync(RAINBOW_GRAPHQL_CONFIG_FILE, 'utf8')
449
- : ''
450
- if (
451
- source.includes(RAINBOW_PUBLIC_ENS_GRAPHQL_URL) &&
452
- source.includes(RAINBOW_METADATA_BASE_URL)
453
- ) {
454
- return
455
- }
456
-
457
- writeFileSync(
458
- RAINBOW_GRAPHQL_CONFIG_FILE,
459
- `exports.config = {
460
- ens: {
461
- __name: 'ens',
462
- document: './queries/ens.graphql',
463
- schema: {
464
- method: 'POST',
465
- url: '${RAINBOW_PUBLIC_ENS_GRAPHQL_URL}',
466
- },
467
- },
468
- metadata: {
469
- __name: 'metadata',
470
- document: './queries/metadata.graphql',
471
- schema: { method: 'GET', url: '${RAINBOW_METADATA_BASE_URL}/v1/graph' },
472
- },
473
- metadataPOST: {
474
- __name: 'metadataPOST',
475
- document: './queries/metadata.graphql',
476
- schema: { method: 'POST', url: '${RAINBOW_METADATA_BASE_URL}/v1/graph' },
477
- },
478
- arc: {
479
- __name: 'arc',
480
- document: './queries/arc.graphql',
481
- schema: {
482
- method: 'GET',
483
- url: 'https://arc-graphql.rainbow.me/graphql',
484
- headers: {
485
- 'x-api-key': 'ARC_GRAPHQL_API_KEY',
486
- },
487
- },
488
- },
489
- arcDev: {
490
- __name: 'arcDev',
491
- document: './queries/arc.graphql',
492
- schema: {
493
- method: 'GET',
494
- url: 'https://arc-graphql.rainbowdotme.workers.dev/graphql',
495
- headers: {},
496
- },
497
- },
498
- };
499
- `,
500
- )
501
- }
502
-
503
- function resolveRainbowDemoEnv(): Record<string, string> {
504
- const env: Record<string, string> = {
505
- ENABLE_DEV_MODE: '1',
506
- IS_TESTING: 'false',
507
- METADATA_BASE_URL:
508
- process.env.RAINBOW_METADATA_BASE_URL ?? RAINBOW_DEMO_METADATA_BASE_URL,
509
- ADDYS_API_KEY: process.env.ADDYS_API_KEY ?? RAINBOW_DEMO_SERVICE_API_KEY,
510
- ADDYS_BASE_URL: process.env.ADDYS_BASE_URL ?? RAINBOW_DEMO_METADATA_BASE_URL,
511
- PLATFORM_API_KEY: process.env.PLATFORM_API_KEY ?? RAINBOW_DEMO_SERVICE_API_KEY,
512
- PLATFORM_BASE_URL: process.env.PLATFORM_BASE_URL ?? RAINBOW_DEMO_METADATA_BASE_URL,
513
- RAINBOW_MASTER_KEY: process.env.RAINBOW_MASTER_KEY ?? RAINBOW_DEMO_MASTER_KEY,
514
- RAINBOW_RELAY_QUOTE_SIGNER:
515
- process.env.RAINBOW_RELAY_QUOTE_SIGNER ?? RAINBOW_DEMO_QUOTE_SIGNER,
516
- RAINBOW_RELAY_URL: process.env.RAINBOW_RELAY_URL ?? RAINBOW_DEMO_RELAY_URL,
517
- RPC_PROXY_API_KEY_PROD: RAINBOW_DEMO_RPC_API_KEY,
518
- RPC_PROXY_BASE_URL_PROD:
519
- process.env.RAINBOW_RPC_PROXY_BASE_URL ??
520
- process.env.RPC_PROXY_BASE_URL_PROD ??
521
- RAINBOW_DEMO_RPC_PROXY_BASE_URL,
522
- SECURE_WALLET_HASH_KEY:
523
- process.env.SECURE_WALLET_HASH_KEY ?? RAINBOW_DEMO_SECURE_WALLET_HASH_KEY,
524
- WC_PROJECT_ID:
525
- process.env.WC_PROJECT_ID ??
526
- process.env.RAINBOW_WALLETCONNECT_PROJECT_ID ??
527
- RAINBOW_DEMO_WALLETCONNECT_PROJECT_ID,
528
- }
529
-
530
- const optionalEnvVars = [
531
- 'ADDYS_API_KEY',
532
- 'ADDYS_BASE_URL',
533
- 'IMGIX_DOMAIN',
534
- 'IMGIX_TOKEN',
535
- 'PLATFORM_API_KEY',
536
- 'PLATFORM_BASE_URL',
537
- 'RAINBOW_TEST_WALLET',
538
- 'RAINBOW_RELAY_API_KEY',
539
- 'RAINBOW_RELAY_URL',
540
- 'SECURE_WALLET_HASH_KEY',
541
- 'TOKEN_SEARCH_URL',
542
- ]
543
-
544
- for (const key of optionalEnvVars) {
545
- const value = process.env[key]
546
- if (value) env[key] = value
547
- }
548
-
549
- return env
550
- }
551
-
552
- function ensureRainbowDemoNetworks(): void {
553
- if (!existsSync(RAINBOW_NETWORKS_FILE)) return
554
-
555
- const payload = JSON.parse(readFileSync(RAINBOW_NETWORKS_FILE, 'utf8')) as {
556
- networks?: Array<{
557
- id?: string
558
- defaultRPC?: {
559
- url?: string
560
- }
561
- }>
562
- }
563
- if (!Array.isArray(payload.networks)) return
564
-
565
- let changed = false
566
- for (const network of payload.networks) {
567
- const url = network.id ? RAINBOW_DEMO_PUBLIC_RPC_URLS[network.id] : undefined
568
- if (!url || !network.defaultRPC) continue
569
- if (network.defaultRPC.url === url) continue
570
-
571
- network.defaultRPC.url = url
572
- changed = true
573
- }
574
-
575
- if (changed) {
576
- writeFileSync(RAINBOW_NETWORKS_FILE, `${JSON.stringify(payload)}\n`)
577
- }
578
- }
579
-
580
- function ensureRainbowSetup(): void {
581
- if (!existsSync(RAINBOW_DIR)) return
582
-
583
- ensureRainbowGraphqlConfig()
584
-
585
- if (!existsSync(join(RAINBOW_GRAPHQL_DIR, 'node_modules/.bin/graphql-codegen'))) {
586
- runRainbowSetupCommand('fnm exec --using=22 yarn install', RAINBOW_GRAPHQL_DIR)
587
- }
588
-
589
- const missingGraphql = RAINBOW_GRAPHQL_SENTINELS.some(
590
- (rel) => !existsSync(join(RAINBOW_DIR, rel)),
591
- )
592
- if (missingGraphql) {
593
- runRainbowSetupCommand('fnm exec --using=22 yarn codegen', RAINBOW_GRAPHQL_DIR)
594
- }
595
-
596
- if (!existsSync(RAINBOW_NETWORKS_FILE)) {
597
- runRainbowSetupCommand('fnm exec --using=22 yarn fetch:networks', RAINBOW_DIR)
598
- }
599
- ensureRainbowDemoNetworks()
600
- }
601
-
602
- const ARTSY_DIR = join(HOME, 'github/eigen')
603
- const ARTSY_KEYS_FILE = join(ARTSY_DIR, 'keys.shared.json')
604
- const ARTSY_METAFLAGS_FILE = join(ARTSY_DIR, 'metaflags.json')
605
- const ARTSY_RELAY_SENTINEL = join(ARTSY_DIR, 'src/__generated__/.relay-complete')
606
-
607
- function readArtsyKeysPayload():
608
- | { secure?: Record<string, string>; public?: Record<string, unknown> }
609
- | undefined {
610
- if (!existsSync(ARTSY_KEYS_FILE)) return undefined
611
-
612
- try {
613
- const parsed = JSON.parse(readFileSync(ARTSY_KEYS_FILE, 'utf8')) as {
614
- secure?: Record<string, string>
615
- public?: Record<string, unknown>
616
- }
617
- if (!parsed || typeof parsed !== 'object') return undefined
618
-
619
- const secure =
620
- parsed.secure && typeof parsed.secure === 'object' ? parsed.secure : undefined
621
- const publicKeys =
622
- parsed.public && typeof parsed.public === 'object' ? parsed.public : undefined
623
-
624
- if (!secure && !publicKeys) return undefined
625
- return { secure, public: publicKeys }
626
- } catch {
627
- return undefined
628
- }
629
- }
630
-
631
- function resolveArtsyRuntimeConfig(): SootSimConfig | undefined {
632
- const email = process.env.SOOTSIM_ARTSY_EMAIL ?? process.env.MAESTRO_TEST_EMAIL
633
- const password = process.env.SOOTSIM_ARTSY_PASSWORD ?? process.env.MAESTRO_TEST_PASSWORD
634
- const keys = readArtsyKeysPayload()
635
-
636
- const env: Record<string, string> = {}
637
- if (email && password) {
638
- env.SOOTSIM_LAUNCH_ARGUMENTS = JSON.stringify({
639
- email,
640
- password,
641
- useMaestroInit: true,
642
- })
643
- }
644
- if (keys) {
645
- env.SOOTSIM_REACT_NATIVE_KEYS_JSON = JSON.stringify(keys)
646
- }
647
- if (Object.keys(env).length === 0) return undefined
648
-
649
- return {
650
- env,
651
- }
652
- }
653
-
654
- function ensureArtsySetup(): void {
655
- if (!existsSync(ARTSY_DIR)) return
656
- const { execSync } =
657
- require('node:child_process') as typeof import('node:child_process')
658
-
659
- // yarn 4.10.3's bundled git cloner passes `-c core.autocrlf=false` as a
660
- // single argv token, which git 2.53+ rejects with `invalid key: core.autocrlf`
661
- // (note the leading space git sees after stripping `-c`). older gits
662
- // silently tolerated the space. patch the release binary in-place to split
663
- // the token. idempotent: replacement is a no-op after the first run.
664
- const yarnRelease = join(ARTSY_DIR, '.yarn/releases/yarn-4.10.3.cjs')
665
- if (existsSync(yarnRelease)) {
666
- const src = readFileSync(yarnRelease, 'utf8')
667
- const needle = '["clone","-c core.autocrlf=false",'
668
- if (src.includes(needle)) {
669
- writeFileSync(
670
- yarnRelease,
671
- src.replace(needle, '["clone","-c","core.autocrlf=false",'),
672
- )
673
- }
674
- }
675
-
676
- // install deps if the yarn state file is missing. use
677
- // YARN_CHECKSUM_BEHAVIOR=update because the lockfile's hash for the
678
- // `react-native-launch-arguments` git dep won't match archives produced
679
- // after the clone-fix above (yarn recomputes tree hashes per fresh fetch).
680
- if (!existsSync(join(ARTSY_DIR, 'node_modules/.yarn-state.yml'))) {
681
- execSync('yarn install', {
682
- cwd: ARTSY_DIR,
683
- stdio: 'inherit',
684
- env: { ...process.env, YARN_CHECKSUM_BEHAVIOR: 'update' },
685
- })
686
- }
687
-
688
- // setup:oss creates keys.shared.json, metaflags.json, a phony
689
- // GoogleService-Info.plist, and pulls OSS fonts. the aws font fetch fails
690
- // without aws cli — harmless for a metro-only demo, fonts fall back.
691
- if (!existsSync(ARTSY_KEYS_FILE) || !existsSync(ARTSY_METAFLAGS_FILE)) {
692
- try {
693
- execSync('yarn setup:oss', { cwd: ARTSY_DIR, stdio: 'inherit' })
694
- } catch {
695
- // setup-oss-fonts exits non-zero when `aws` is missing. ensure the
696
- // two critical sentinel files exist before giving up.
697
- if (!existsSync(ARTSY_KEYS_FILE) || !existsSync(ARTSY_METAFLAGS_FILE)) {
698
- throw new Error('artsy demo: setup:oss did not create keys/metaflags')
699
- }
700
- }
701
- }
702
-
703
- // eigen pulls react-native-launch-arguments as a git dep. its package.json
704
- // points `main` at `dist/index.js`, which is produced by the package's
705
- // `prepare` tsc build — skipped because `.yarnrc.yml` sets
706
- // `enableScripts: false`. there's no shipped tsconfig either, so running
707
- // tsc post-hoc fails. simplest fix: point `main` at the TS source; metro
708
- // resolves `.ts` natively. idempotent.
709
- const rnlaPkgJson = join(
710
- ARTSY_DIR,
711
- 'node_modules/react-native-launch-arguments/package.json',
712
- )
713
- if (existsSync(rnlaPkgJson)) {
714
- const raw = readFileSync(rnlaPkgJson, 'utf8')
715
- if (raw.includes('"dist/index.js"')) {
716
- writeFileSync(rnlaPkgJson, raw.replace('"dist/index.js"', '"src/index.ts"'))
717
- }
718
- }
719
-
720
- // relay compiler generates src/__generated__/**. eigen's `yarn start`
721
- // script runs `relay-compiler --watch` via concurrently, but for the
722
- // demo we just need a one-shot generation before metro boots.
723
- if (!existsSync(ARTSY_RELAY_SENTINEL)) {
724
- execSync('yarn relay', { cwd: ARTSY_DIR, stdio: 'inherit' })
725
- writeFileSync(ARTSY_RELAY_SENTINEL, '')
726
- }
727
- }
728
-
729
- export const APPS: DemoApp[] = [
730
- {
731
- name: 'bluesky',
732
- label: 'Bluesky',
733
- dir: join(HOME, 'github/bluesky'),
734
- preferredPort: 8082,
735
- framework: 'expo',
736
- command: (p) => ({ cmd: `npx expo start --port ${p}` }),
737
- credentials: {
738
- envVars: ['SOOTSIM_BLUESKY_PASSWORD'],
739
- known: { HANDLE: 'natew.bsky.social' },
740
- },
741
- },
742
- {
743
- name: '3pc',
744
- label: '3PunchConvo',
745
- dir: join(HOME, 'lightstrike-labs/three-punch-convo-app/apps/one'),
746
- preferredPort: 8081,
747
- framework: 'one',
748
- command: (p) => ({ cmd: 'npx one dev', env: { ONE_PORT: String(p) } }),
749
- },
750
- {
751
- name: 'uniswap',
752
- label: 'Uniswap',
753
- dir: UNISWAP_APP_DIR,
754
- preferredPort: 8085,
755
- framework: 'expo',
756
- prepare: () => {
757
- ensureUniswapDemoEnvLocal()
758
- ensureUniswapForceUpgradePatched()
759
- },
760
- command: (p) => ({
761
- cmd: `npx expo start --clear --port ${p}`,
762
- // prefer the real local mobile env when present, otherwise fall back
763
- // to Uniswap's checked-in public web RPC settings so demo boots cleanly.
764
- env: resolveUniswapDemoEnv(),
765
- }),
766
- },
767
- {
768
- name: 'takeout',
769
- label: 'Takeout',
770
- dir: join(HOME, 'takeout'),
771
- preferredPort: 8086,
772
- framework: 'one',
773
- // takeout needs more than Metro for the demo to actually work: better-auth
774
- // (login), zero-cache (sync), and a postgres for both. `bun lite` brings
775
- // up the orez-backed stack (PG + zero + s3 in one binary) plus the One
776
- // dev server. takeout's env system shifts every port (web, pg, zero,
777
- // minio) uniformly by PORT_OFFSET, so we derive offset = port - 8081
778
- // (the base web port) to keep all backend ports clear of the default
779
- // dev stack while pinning One to the demo slot. OREZ_DATA_DIR is isolated
780
- // to a per-demo path so we don't fight a soot dev orez that may already
781
- // be holding pglite locks on ~/takeout/.orez (soot can attach takeout as
782
- // a project and spin up its own orez against the same data dir).
783
- readyTimeoutMs: 240_000,
784
- managedPorts: (p) => {
785
- const offset = p - 8081
786
- return [5433 + offset, 4848 + offset, 9200 + offset]
787
- },
788
- command: (p) => ({
789
- cmd: 'bun lite:demo',
790
- env: {
791
- TAKEOUT_ENV_MODE: 'development',
792
- PORT_OFFSET: String(p - 8081),
793
- OREZ_DATA_DIR: `${HOME}/.cache/sootsim-demo/takeout-orez`,
794
- VITE_DEMO_MODE: '1',
795
- ZERO_APP_ID: 'takeout',
796
- ZERO_APP_PUBLICATIONS: 'zero_takeout',
797
- ZERO_CVR_MAX_CONNS: '4',
798
- ZERO_NUM_SYNC_WORKERS: '2',
799
- ZERO_UPSTREAM_MAX_CONNS: '8',
800
- },
801
- }),
802
- },
803
- {
804
- name: 'expensify',
805
- label: 'Expensify',
806
- dir: join(HOME, 'github/expensify'),
807
- preferredPort: 8087,
808
- framework: 'rock',
809
- runtimeConfig: {
810
- env: EXPENSIFY_NATIVE_PROXY_ENV,
811
- },
812
- sidecars: [
813
- {
814
- name: 'web-proxy',
815
- port: 9000,
816
- readyPath: '/api/Ping',
817
- command: () => ({
818
- cmd: `bun ${JSON.stringify(getExpensifyProxyScript())}`,
819
- env: EXPENSIFY_NATIVE_PROXY_ENV,
820
- }),
821
- },
822
- ],
823
- command: (p) => ({
824
- cmd: `fnm exec --using=20.20.0 npx rock start --port ${p} --no-interactive`,
825
- env: EXPENSIFY_NATIVE_PROXY_ENV,
826
- }),
827
- },
828
- {
829
- name: 'artsy',
830
- label: 'Artsy',
831
- dir: ARTSY_DIR,
832
- preferredPort: 8088,
833
- framework: 'expo',
834
- runtimeConfig: resolveArtsyRuntimeConfig(),
835
- prepare: () => {
836
- ensureArtsySetup()
837
- },
838
- command: (p) => ({
839
- // eigen's `yarn start` wraps `react-native start` with a relay watcher
840
- // via concurrently; for the demo we run relay once in prepare and
841
- // invoke the metro server directly so --port is respected.
842
- cmd: `npx react-native start --port ${p}`,
843
- }),
844
- credentials: {
845
- envVars: ['SOOTSIM_ARTSY_EMAIL', 'SOOTSIM_ARTSY_PASSWORD'],
846
- note: 'auto-login reuses Artsy’s built-in Maestro launch-arguments hook',
847
- },
848
- },
849
- {
850
- name: 'rainbow',
851
- label: 'Rainbow',
852
- dir: RAINBOW_DIR,
853
- preferredPort: 8089,
854
- framework: 'rock',
855
- sidecars: [
856
- {
857
- name: 'metadata-proxy',
858
- port: RAINBOW_METADATA_PROXY_PORT,
859
- readyPath: '/health',
860
- command: () => ({
861
- cmd: `bun ${JSON.stringify(getRainbowMetadataProxyScript())}`,
862
- env: {
863
- PORT: String(RAINBOW_METADATA_PROXY_PORT),
864
- RAINBOW_PUBLIC_RPC_URLS: JSON.stringify(RAINBOW_DEMO_PUBLIC_RPC_URLS),
865
- RAINBOW_UPSTREAM_METADATA_BASE_URL: RAINBOW_METADATA_BASE_URL,
866
- },
867
- }),
868
- },
869
- ],
870
- prepare: () => {
871
- ensureRainbowSetup()
872
- },
873
- command: (p) => ({
874
- cmd: `fnm exec --using=22 yarn start --port ${p} --reset-cache`,
875
- env: resolveRainbowDemoEnv(),
876
- }),
877
- credentials: {
878
- envVars: ['RAINBOW_TEST_WALLET'],
879
- optionalEnvVars: [
880
- 'RAINBOW_WALLETCONNECT_PROJECT_ID',
881
- 'WC_PROJECT_ID',
882
- 'IMGIX_DOMAIN',
883
- 'IMGIX_TOKEN',
884
- ],
885
- note: 'launcher supplies demo encryption, public mainnet RPC, and a placeholder WalletConnect project id; use only a public throwaway mnemonic for RAINBOW_TEST_WALLET',
886
- },
887
- },
888
- {
889
- name: 'rocket-chat',
890
- label: 'Rocket.Chat',
891
- dir: join(HOME, 'github/Rocket.Chat.ReactNative'),
892
- preferredPort: 8093,
893
- framework: 'expo',
894
- command: (p) => ({
895
- cmd: `npx react-native start --port ${p}`,
896
- env: { RUNNING_E2E_TESTS: 'true' },
897
- }),
898
- credentials: {
899
- envVars: [
900
- 'ROCKET_CHAT_DEMO_SERVER',
901
- 'ROCKET_CHAT_DEMO_USERNAME',
902
- 'ROCKET_CHAT_DEMO_PASSWORD',
903
- ],
904
- known: { SERVER: 'https://mobile.qa.rocket.chat' },
905
- note: 'use packages/sootsim-engine/scripts/rocket-chat-demo-auth.ts to create/login a disposable QA user and print the rocketchat://auth deep link',
906
- },
907
- },
908
- {
909
- name: 'mattermost',
910
- label: 'Mattermost',
911
- dir: MATTERMOST_DIR,
912
- preferredPort: 8090,
913
- framework: 'expo',
914
- sidecars: [
915
- {
916
- name: 'preview-server',
917
- port: 8065,
918
- readyPath: '/api/v4/system/ping',
919
- command: () => ({
920
- cmd: `bun ${JSON.stringify(getMattermostPreviewServerScript())}`,
921
- }),
922
- },
923
- ],
924
- runtimeConfig: {
925
- modules: {
926
- // mattermost patches react-native-keychain's JS entry in its own
927
- // repo; run that package and provide only the native manager seam.
928
- 'react-native-keychain': false,
929
- 'dist/assets/config.json': {
930
- inline: {
931
- AuthUrlScheme: 'mmauth://',
932
- AuthUrlSchemeDev: 'mmauthbeta://',
933
- DefaultServerUrl: 'http://localhost:8065',
934
- DefaultServerName: 'Mattermost Demo',
935
- TestServerUrl: 'http://localhost:8065',
936
- AutoSelectServerUrl: true,
937
- WebsiteURL: 'https://mattermost.com',
938
- ServerNoticeURL:
939
- 'https://github.com/mattermost/mattermost-server/blob/master/NOTICE.txt',
940
- MobileNoticeURL:
941
- 'https://github.com/mattermost/mattermost-mobile/blob/master/NOTICE.txt',
942
- RudderApiKey: '',
943
- SentryEnabled: false,
944
- SentryDsnIos: '',
945
- SentryDsnAndroid: '',
946
- SentryOptions: {
947
- deactivateStacktraceMerging: true,
948
- autoBreadcrumbs: {
949
- xhr: false,
950
- console: true,
951
- },
952
- severityLevelFilter: ['fatal'],
953
- },
954
- ShowReview: false,
955
- ShowOnboarding: false,
956
- ExperimentalNormalizeMarkdownLinks: false,
957
- CustomRequestHeaders: {},
958
- CollectNetworkMetrics: false,
959
- },
960
- },
961
- },
962
- nativeModules: {
963
- RNKeychainManager: { file: getMattermostKeychainNativeModule() },
964
- RNUtils: { file: getMattermostRNUtilsNativeModule() },
965
- GenericClient: { file: getMattermostNetworkClientNativeModule() },
966
- ApiClient: { file: getMattermostNetworkClientNativeModule() },
967
- WebSocketClient: { file: getMattermostNetworkClientNativeModule() },
968
- },
969
- },
970
- command: (p) => ({
971
- cmd: `npx react-native start --host 127.0.0.1 --port ${p}`,
972
- }),
973
- credentials: {
974
- known: {
975
- SERVER: 'http://localhost:8065',
976
- USERNAME: 'demo',
977
- PASSWORD: 'DemoPassword1!',
978
- },
979
- note: 'local mattermost-preview seeded through the real REST API; no signup or OTP needed',
980
- },
981
- },
982
- {
983
- name: 'joplin',
984
- label: 'Joplin',
985
- dir: JOPLIN_APP_DIR,
986
- preferredPort: 8084,
987
- framework: 'expo',
988
- // joplin is local-first: sync.target defaults to 0 ("None") and the
989
- // mobile startup runs WelcomeUtils.install() on first launch, which
990
- // seeds a "Welcome!" folder + welcome notes. no login or external
991
- // credentials are needed for a usable demo — just boot it. tenant
992
- // bedrock SQLite (via react-native-sqlite-storage stub) carries the
993
- // seeded notes across reloads.
994
- prepare: () => {
995
- ensureJoplinWatchmanConfigs()
996
- ensureJoplinBuilt()
997
- },
998
- command: (p) => ({
999
- cmd: `npx expo start --port ${p}`,
1000
- env: { BROWSERSLIST_IGNORE_OLD_DATA: 'true' },
1001
- }),
1002
- credentials: {
1003
- note: 'no login required — sync.target=0 (None), seed via WelcomeUtils',
1004
- },
1005
- },
1006
- ]