@ceraph/react-native-mcp 0.2.2 → 0.3.1

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 (124) hide show
  1. package/LICENSE +116 -15
  2. package/README.md +79 -77
  3. package/assets/default.png +0 -0
  4. package/dist/app-lifecycle.d.ts +50 -0
  5. package/dist/app-lifecycle.js +487 -0
  6. package/dist/camera-image-writer.d.ts +43 -0
  7. package/dist/camera-image-writer.js +280 -0
  8. package/dist/camera-registry-sync.d.ts +18 -0
  9. package/dist/camera-registry-sync.js +117 -0
  10. package/dist/cli.d.ts +0 -7
  11. package/dist/cli.js +41 -9
  12. package/dist/device-autonomy.d.ts +30 -0
  13. package/dist/device-autonomy.js +117 -0
  14. package/dist/error-parser.d.ts +6 -26
  15. package/dist/error-parser.js +4 -74
  16. package/dist/expo-manager.d.ts +2 -74
  17. package/dist/expo-manager.js +11 -125
  18. package/dist/index.d.ts +0 -7
  19. package/dist/index.js +1266 -56
  20. package/dist/init/ast-camera.d.ts +29 -0
  21. package/dist/init/ast-camera.js +267 -0
  22. package/dist/init/ast-layout.d.ts +15 -0
  23. package/dist/init/ast-layout.js +167 -0
  24. package/dist/init/claude-hook-constants.d.ts +9 -0
  25. package/dist/init/claude-hook-constants.js +91 -0
  26. package/dist/init/lan-ip.d.ts +11 -0
  27. package/dist/init/lan-ip.js +51 -0
  28. package/dist/init/monorepo.d.ts +13 -0
  29. package/dist/init/monorepo.js +185 -0
  30. package/dist/init/oauth.d.ts +52 -0
  31. package/dist/init/oauth.js +220 -0
  32. package/dist/init/package-manager.d.ts +11 -0
  33. package/dist/init/package-manager.js +60 -0
  34. package/dist/init/prompt.d.ts +12 -0
  35. package/dist/init/prompt.js +68 -0
  36. package/dist/init/shell-profile.d.ts +22 -0
  37. package/dist/init/shell-profile.js +85 -0
  38. package/dist/init/steps.d.ts +135 -0
  39. package/dist/init/steps.js +399 -0
  40. package/dist/init/url-scheme.d.ts +42 -0
  41. package/dist/init/url-scheme.js +187 -0
  42. package/dist/init/walkthrough.d.ts +76 -0
  43. package/dist/init/walkthrough.js +340 -0
  44. package/dist/init.d.ts +7 -7
  45. package/dist/init.js +280 -120
  46. package/dist/iproxy-manager.d.ts +32 -0
  47. package/dist/iproxy-manager.js +216 -0
  48. package/dist/mac-caffeinate.d.ts +10 -0
  49. package/dist/mac-caffeinate.js +56 -0
  50. package/dist/permission-interceptor.d.ts +29 -0
  51. package/dist/permission-interceptor.js +185 -0
  52. package/dist/prebuild-detector.d.ts +0 -30
  53. package/dist/prebuild-detector.js +1 -42
  54. package/dist/preflight.d.ts +34 -0
  55. package/dist/preflight.js +847 -0
  56. package/dist/screen.d.ts +132 -43
  57. package/dist/screen.js +668 -94
  58. package/dist/shim/boot.d.ts +41 -0
  59. package/dist/shim/boot.js +141 -0
  60. package/dist/shim/camera.d.ts +22 -0
  61. package/dist/shim/camera.js +62 -0
  62. package/dist/shim/config.d.ts +6 -0
  63. package/dist/shim/config.js +56 -0
  64. package/dist/shim/deep-link.d.ts +1 -0
  65. package/dist/shim/deep-link.js +25 -0
  66. package/dist/shim/dev-guard.d.ts +1 -0
  67. package/dist/shim/dev-guard.js +3 -0
  68. package/dist/shim/error-handler.d.ts +20 -0
  69. package/dist/shim/error-handler.js +66 -0
  70. package/dist/shim/fetch-interceptor.d.ts +13 -0
  71. package/dist/shim/fetch-interceptor.js +93 -0
  72. package/dist/shim/index.d.ts +6 -0
  73. package/dist/shim/index.js +6 -0
  74. package/dist/shim/keep-awake.d.ts +13 -0
  75. package/dist/shim/keep-awake.js +118 -0
  76. package/dist/shim/reload.d.ts +23 -0
  77. package/dist/shim/reload.js +76 -0
  78. package/dist/shim/signal-capture.d.ts +11 -0
  79. package/dist/shim/signal-capture.js +15 -0
  80. package/dist/shim/signal-transport.d.ts +17 -0
  81. package/dist/shim/signal-transport.js +43 -0
  82. package/dist/signal-listener.d.ts +27 -0
  83. package/dist/signal-listener.js +135 -0
  84. package/dist/simulator-boot.d.ts +52 -0
  85. package/dist/simulator-boot.js +227 -0
  86. package/dist/target.d.ts +48 -0
  87. package/dist/target.js +267 -0
  88. package/dist/uninstall/cli-runner.d.ts +32 -0
  89. package/dist/uninstall/cli-runner.js +223 -0
  90. package/dist/uninstall/footprint.d.ts +40 -0
  91. package/dist/uninstall/footprint.js +288 -0
  92. package/dist/uninstall/mcp-tools.d.ts +14 -0
  93. package/dist/uninstall/mcp-tools.js +175 -0
  94. package/dist/uninstall/revert-auth.d.ts +22 -0
  95. package/dist/uninstall/revert-auth.js +31 -0
  96. package/dist/uninstall/revert-boot.d.ts +24 -0
  97. package/dist/uninstall/revert-boot.js +242 -0
  98. package/dist/uninstall/revert-camera.d.ts +12 -0
  99. package/dist/uninstall/revert-camera.js +199 -0
  100. package/dist/uninstall/revert-ceraph-dir.d.ts +27 -0
  101. package/dist/uninstall/revert-ceraph-dir.js +38 -0
  102. package/dist/uninstall/revert-claude-hooks.d.ts +19 -0
  103. package/dist/uninstall/revert-claude-hooks.js +191 -0
  104. package/dist/uninstall/revert-gitignore.d.ts +17 -0
  105. package/dist/uninstall/revert-gitignore.js +43 -0
  106. package/dist/uninstall/revert-mcp-clients.d.ts +57 -0
  107. package/dist/uninstall/revert-mcp-clients.js +194 -0
  108. package/dist/uninstall/revert-package.d.ts +34 -0
  109. package/dist/uninstall/revert-package.js +98 -0
  110. package/dist/uninstall/revert-scheme.d.ts +36 -0
  111. package/dist/uninstall/revert-scheme.js +139 -0
  112. package/dist/uninstall/revert-signal-host-env.d.ts +31 -0
  113. package/dist/uninstall/revert-signal-host-env.js +61 -0
  114. package/dist/uninstall/walkthrough.d.ts +80 -0
  115. package/dist/uninstall/walkthrough.js +1244 -0
  116. package/dist/utils/atomic-write.d.ts +1 -0
  117. package/dist/utils/atomic-write.js +30 -0
  118. package/dist/wait-for-device.d.ts +68 -0
  119. package/dist/wait-for-device.js +368 -0
  120. package/dist/wda-manager.d.ts +38 -0
  121. package/dist/wda-manager.js +186 -0
  122. package/dist/wda-simulator.d.ts +28 -0
  123. package/dist/wda-simulator.js +257 -0
  124. package/package.json +38 -5
package/dist/screen.d.ts CHANGED
@@ -1,9 +1,4 @@
1
- /**
2
- * WebDriverAgent client with pixel ratio correction.
3
- *
4
- * Talks to the WDA HTTP server running on localhost:8100 to perform
5
- * taps and element lookups on a connected iOS device.
6
- */
1
+ import { TargetResolver } from "./target.js";
7
2
  export interface TapResult {
8
3
  success: boolean;
9
4
  tappedAt: {
@@ -38,58 +33,152 @@ export interface FindTapResult {
38
33
  }>;
39
34
  error?: string;
40
35
  }
41
- interface ElementQuery {
36
+ export interface ElementQuery {
42
37
  text?: string;
43
38
  accessibilityLabel?: string;
44
39
  type?: string;
45
40
  index?: number;
46
41
  }
42
+ export interface SwipeOptions {
43
+ direction: "up" | "down" | "left" | "right";
44
+ from?: {
45
+ x: number;
46
+ y: number;
47
+ };
48
+ distancePx?: number;
49
+ durationMs?: number;
50
+ coordinateSource?: "screenshot" | "device";
51
+ }
52
+ export interface SwipeResult {
53
+ success: boolean;
54
+ from: {
55
+ x: number;
56
+ y: number;
57
+ };
58
+ to: {
59
+ x: number;
60
+ y: number;
61
+ };
62
+ durationMs: number;
63
+ error?: string;
64
+ }
65
+ export interface SimpleResult {
66
+ success: boolean;
67
+ error?: string;
68
+ details?: Record<string, unknown>;
69
+ }
70
+ export interface ScreenshotResult {
71
+ success: boolean;
72
+ base64?: string;
73
+ error?: string;
74
+ }
75
+ export interface SourceResult {
76
+ success: boolean;
77
+ source?: WDAElement;
78
+ error?: string;
79
+ }
80
+ export interface WaitForResult {
81
+ success: boolean;
82
+ found: boolean;
83
+ elapsedMs: number;
84
+ element?: ElementInfo;
85
+ error?: string;
86
+ }
87
+ export interface WDAElement {
88
+ type?: string;
89
+ label?: string;
90
+ name?: string;
91
+ value?: string;
92
+ rect?: {
93
+ x: number;
94
+ y: number;
95
+ width: number;
96
+ height: number;
97
+ };
98
+ children?: WDAElement[];
99
+ [key: string]: unknown;
100
+ }
47
101
  export declare class ScreenManager {
48
102
  private sessionId;
49
103
  private pixelRatio;
50
- /**
51
- * Check whether WebDriverAgent is reachable.
52
- */
104
+ private targetResolver;
105
+ private sessionBaseUrl;
106
+ constructor(opts?: {
107
+ targetResolver?: TargetResolver;
108
+ });
109
+ private snapshotTarget;
110
+ private wdaFetchAt;
111
+ private wdaFetch;
53
112
  isAvailable(): Promise<boolean>;
54
- /**
55
- * Get or create a WDA session. Sessions are cached and revalidated.
56
- */
57
113
  ensureSession(): Promise<string>;
58
- /**
59
- * Determine the pixel ratio between screenshot coordinates and
60
- * device logical coordinates.
61
- *
62
- * Screenshot images are in physical pixels; WDA taps use logical points.
63
- * The ratio is typically 2 (for @2x Retina) or 3 (for @3x).
64
- */
65
114
  getPixelRatio(): Promise<number>;
66
- /**
67
- * Tap at the given coordinates.
68
- *
69
- * When `fromScreenshot` is true (the default), the coordinates are
70
- * assumed to come from a screenshot image and are divided by the
71
- * pixel ratio to convert to logical device points.
72
- */
115
+ getWindowSize(): Promise<{
116
+ width: number;
117
+ height: number;
118
+ }>;
73
119
  tap(x: number, y: number, fromScreenshot?: boolean): Promise<TapResult>;
74
- /**
75
- * Find an element in the UI tree and tap its center.
76
- */
77
120
  findAndTap(query: ElementQuery): Promise<FindTapResult>;
78
- /**
79
- * Recursively search the WDA element tree for elements matching the query.
80
- */
121
+ findElement(query: ElementQuery): Promise<{
122
+ success: boolean;
123
+ element?: WDAElement;
124
+ matchCount?: number;
125
+ error?: string;
126
+ }>;
127
+ swipe(opts: SwipeOptions): Promise<SwipeResult>;
128
+ scrollToElement(query: ElementQuery, opts?: {
129
+ maxSwipes?: number;
130
+ direction?: "up" | "down";
131
+ distancePx?: number;
132
+ }): Promise<{
133
+ success: boolean;
134
+ swipes: number;
135
+ element?: ElementInfo;
136
+ error?: string;
137
+ }>;
138
+ longPress(x: number, y: number, durationMs?: number, fromScreenshot?: boolean): Promise<SimpleResult>;
139
+ longPressElement(query: ElementQuery, durationMs?: number): Promise<SimpleResult & {
140
+ element?: ElementInfo;
141
+ }>;
142
+ type(text: string, opts?: {
143
+ hideKeyboardAfter?: boolean;
144
+ }): Promise<SimpleResult>;
145
+ clearText(query: ElementQuery): Promise<SimpleResult>;
146
+ pressKey(key: "home" | "volumeUp" | "volumeDown" | "lock"): Promise<SimpleResult>;
147
+ unlock(): Promise<SimpleResult>;
148
+ isLocked(): Promise<boolean | null>;
149
+ screenshot(): Promise<ScreenshotResult>;
150
+ getSource(): Promise<SourceResult>;
151
+ waitFor(query: ElementQuery, opts?: {
152
+ timeoutMs?: number;
153
+ pollIntervalMs?: number;
154
+ disappear?: boolean;
155
+ }): Promise<WaitForResult>;
156
+ assertVisible(query: ElementQuery): Promise<{
157
+ success: boolean;
158
+ visible: boolean;
159
+ element?: ElementInfo;
160
+ error?: string;
161
+ }>;
162
+ assertNotVisible(query: ElementQuery): Promise<{
163
+ success: boolean;
164
+ visible: boolean;
165
+ error?: string;
166
+ }>;
167
+ getOrientation(): Promise<string | null>;
168
+ setOrientation(orientation: "portrait" | "landscape"): Promise<SimpleResult>;
169
+ getActiveAppInfo(): Promise<{
170
+ success: boolean;
171
+ bundleId?: string;
172
+ pid?: number;
173
+ name?: string;
174
+ error?: string;
175
+ }>;
176
+ activateApp(bundleId: string): Promise<SimpleResult>;
177
+ openUrl(url: string): Promise<SimpleResult>;
178
+ terminateAppViaWDA(bundleId: string): Promise<SimpleResult>;
179
+ pingStatus(): Promise<boolean>;
81
180
  private searchElements;
82
- /**
83
- * Check whether a single element matches the given query.
84
- */
85
181
  private elementMatches;
86
- /**
87
- * Collect a summary of visible elements for debugging (when no match found).
88
- */
89
182
  private collectVisibleElements;
90
- /**
91
- * Invalidate cached session and pixel ratio (e.g., after app restart).
92
- */
93
183
  reset(): void;
94
184
  }
95
- export {};