xcobra 0.0.6 → 0.0.7

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 (3) hide show
  1. package/README.md +112 -1
  2. package/dist/index.js +138 -119
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -12,6 +12,7 @@ A toolkit for **iOS simulator automation** and development. Build apps, capture
12
12
  - **Heap Analysis**: Chrome DevTools-like heap snapshots
13
13
  - **Log Streaming**: Real-time simulator logs with app filtering
14
14
  - **Crash Reports**: Parse and display iOS crash reports with symbolicated backtraces
15
+ - **Expo/React Native Debugging**: CDP-based debugging for Expo and React Native apps
15
16
  - **Zero Config**: Works as a drop-in replacement for xcodebuild
16
17
 
17
18
  ## Prerequisites
@@ -93,7 +94,7 @@ npx xcobra sim record-video --output recording.mp4 --codec hevc
93
94
 
94
95
  ### View Hierarchy (LLDB)
95
96
 
96
- #### `sim hierarchy` — Get UIKit View Hierarchy
97
+ #### `sim hierarchy` (or `sim xml`) — Get UIKit View Hierarchy
97
98
 
98
99
  Get the full UIKit view hierarchy via LLDB, similar to Xcode's view debugger:
99
100
 
@@ -220,6 +221,100 @@ The formatted output includes:
220
221
 
221
222
  ---
222
223
 
224
+ ## Expo Commands (`expo`)
225
+
226
+ Debug Expo and React Native apps via Chrome DevTools Protocol (CDP). All commands connect to the Metro dev server (default port 8081).
227
+
228
+ ### Quick Start
229
+
230
+ ```sh
231
+ # List connected apps
232
+ npx xcobra expo list
233
+
234
+ # Evaluate JavaScript in the app
235
+ npx xcobra expo eval "1 + 1"
236
+ npx xcobra expo eval "expo.modules.FileSystem"
237
+
238
+ # Stream console output
239
+ npx xcobra expo console
240
+
241
+ # Monitor network requests
242
+ npx xcobra expo network
243
+ ```
244
+
245
+ ### `expo eval` — Evaluate JavaScript
246
+
247
+ Evaluate JavaScript expressions in the running app. Objects are automatically inspected, and promises are awaited:
248
+
249
+ ```sh
250
+ # Simple expressions
251
+ npx xcobra expo eval "1 + 1" # => 2
252
+ npx xcobra expo eval "Object.keys(global)" # => ["__DEV__", ...]
253
+
254
+ # Inspect objects (shows all properties including functions)
255
+ npx xcobra expo eval "expo.modules.FileSystem"
256
+
257
+ # Async functions work automatically
258
+ npx xcobra expo eval "expo.modules.FileSystem.info(expo.modules.FileSystem.documentDirectory)"
259
+ ```
260
+
261
+ ### `expo network` — Monitor Network Requests
262
+
263
+ Monitor HTTP requests from the app in real-time:
264
+
265
+ ```sh
266
+ # Monitor all network traffic
267
+ npx xcobra expo network
268
+
269
+ # Monitor and trigger a request in the same connection
270
+ npx xcobra expo network --eval "fetch('https://httpbin.org/get').then(r => r.json())"
271
+ ```
272
+
273
+ The `--eval` flag is useful because CDP only allows one debugger connection per target. Using `--eval` triggers the request from the same connection that's monitoring.
274
+
275
+ ### `expo proxy` — Connection Sharing
276
+
277
+ Start a CDP proxy to share connections between multiple commands:
278
+
279
+ ```sh
280
+ # Start the proxy (runs in foreground)
281
+ npx xcobra expo proxy
282
+
283
+ # Now other commands share the connection
284
+ npx xcobra expo eval "1 + 1" # Uses proxy
285
+ npx xcobra expo network # Uses proxy, won't disconnect eval
286
+ npx xcobra expo console # Uses proxy
287
+ ```
288
+
289
+ **Multiple Projects**: Each Metro port gets its own proxy, so you can run xcobra in multiple projects simultaneously:
290
+
291
+ ```sh
292
+ # Terminal 1 - Project A on port 8081
293
+ npx xcobra expo proxy &
294
+ npx xcobra expo eval "1 + 1"
295
+
296
+ # Terminal 2 - Project B on port 8082
297
+ npx xcobra expo proxy --port 8082 &
298
+ npx xcobra expo eval "2 + 2" --port 8082
299
+ ```
300
+
301
+ ### Source Inspection
302
+
303
+ Inspect the JavaScript bundle loaded in the app:
304
+
305
+ ```sh
306
+ # List all loaded scripts
307
+ npx xcobra expo src scripts
308
+
309
+ # Get source code of a specific script
310
+ npx xcobra expo src source 42
311
+
312
+ # List Metro modules
313
+ npx xcobra expo src modules
314
+ ```
315
+
316
+ ---
317
+
223
318
  ## Build Commands
224
319
 
225
320
  Standard xcodebuild commands with pretty-formatted output:
@@ -256,6 +351,7 @@ Build logs are automatically saved to `.xcodebuild/xcodebuild.log`.
256
351
  | `sim screenshot` | Capture screenshot |
257
352
  | `sim record-video` | Record video |
258
353
  | `sim hierarchy` | Get UIKit view hierarchy via LLDB |
354
+ | `sim xml` | Alias for `sim hierarchy` |
259
355
  | `sim heap` | Heap memory analysis |
260
356
  | `sim keyboard` | Toggle software keyboard |
261
357
  | `sim log` | Stream simulator logs |
@@ -270,6 +366,21 @@ Build logs are automatically saved to `.xcodebuild/xcodebuild.log`.
270
366
  | `crash <path>` | Display specific crash report |
271
367
  | `crash --json` | Output crash data as JSON |
272
368
 
369
+ ### Expo Commands
370
+
371
+ | Command | Description |
372
+ | -------------------- | ------------------------------------------ |
373
+ | `expo list` | List debuggable targets |
374
+ | `expo eval <expr>` | Evaluate JavaScript in the app |
375
+ | `expo console` | Stream console output |
376
+ | `expo network` | Monitor network requests |
377
+ | `expo proxy` | Start CDP proxy for connection sharing |
378
+ | `expo reload` | Reload the app |
379
+ | `expo open-debugger` | Launch React Native DevTools |
380
+ | `expo src scripts` | List loaded scripts |
381
+ | `expo src source` | Get script source code |
382
+ | `expo src modules` | List Metro modules |
383
+
273
384
  ---
274
385
 
275
386
  ## Development