@ceraph/react-native-mcp 0.3.2 → 0.4.5

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 (132) hide show
  1. package/README.md +335 -68
  2. package/dist/babel-plugin/index.cjs +1 -0
  3. package/dist/babel-plugin/index.js +1 -0
  4. package/dist/cli.d.ts +3 -1
  5. package/dist/cli.js +1 -47
  6. package/dist/index.d.ts +106 -1
  7. package/dist/index.js +2 -1651
  8. package/dist/shim/async-storage-ops.d.ts +26 -0
  9. package/dist/shim/async-storage-ops.js +1 -0
  10. package/dist/shim/boot.d.ts +9 -0
  11. package/dist/shim/boot.js +1 -141
  12. package/dist/shim/camera.js +1 -62
  13. package/dist/shim/command-poll.d.ts +18 -0
  14. package/dist/shim/command-poll.js +1 -0
  15. package/dist/shim/config.js +1 -56
  16. package/dist/shim/console-capture.d.ts +16 -0
  17. package/dist/shim/console-capture.js +1 -0
  18. package/dist/shim/deep-link.js +1 -25
  19. package/dist/shim/dev-guard.js +1 -3
  20. package/dist/shim/dev-host.d.ts +1 -0
  21. package/dist/shim/dev-host.js +1 -0
  22. package/dist/shim/error-handler.js +1 -66
  23. package/dist/shim/fetch-interceptor.js +1 -93
  24. package/dist/shim/index.d.ts +3 -0
  25. package/dist/shim/index.js +1 -6
  26. package/dist/shim/keep-awake.js +1 -118
  27. package/dist/shim/network-ownership.d.ts +4 -0
  28. package/dist/shim/network-ownership.js +1 -0
  29. package/dist/shim/optimistic-observer.d.ts +29 -0
  30. package/dist/shim/optimistic-observer.js +1 -0
  31. package/dist/shim/reload.js +1 -76
  32. package/dist/shim/reset.d.ts +30 -0
  33. package/dist/shim/reset.js +1 -0
  34. package/dist/shim/signal-capture.d.ts +8 -0
  35. package/dist/shim/signal-capture.js +1 -15
  36. package/dist/shim/signal-transport.d.ts +14 -1
  37. package/dist/shim/signal-transport.js +1 -43
  38. package/dist/shim/xhr-interceptor.d.ts +39 -0
  39. package/dist/shim/xhr-interceptor.js +1 -0
  40. package/package.json +41 -15
  41. package/dist/app-lifecycle.d.ts +0 -50
  42. package/dist/app-lifecycle.js +0 -487
  43. package/dist/camera-image-writer.d.ts +0 -43
  44. package/dist/camera-image-writer.js +0 -280
  45. package/dist/camera-registry-sync.d.ts +0 -18
  46. package/dist/camera-registry-sync.js +0 -117
  47. package/dist/device-autonomy.d.ts +0 -30
  48. package/dist/device-autonomy.js +0 -117
  49. package/dist/error-parser.d.ts +0 -51
  50. package/dist/error-parser.js +0 -275
  51. package/dist/expo-manager.d.ts +0 -62
  52. package/dist/expo-manager.js +0 -447
  53. package/dist/init/ast-camera.d.ts +0 -29
  54. package/dist/init/ast-camera.js +0 -267
  55. package/dist/init/ast-layout.d.ts +0 -15
  56. package/dist/init/ast-layout.js +0 -167
  57. package/dist/init/claude-hook-constants.d.ts +0 -9
  58. package/dist/init/claude-hook-constants.js +0 -91
  59. package/dist/init/lan-ip.d.ts +0 -11
  60. package/dist/init/lan-ip.js +0 -51
  61. package/dist/init/monorepo.d.ts +0 -13
  62. package/dist/init/monorepo.js +0 -185
  63. package/dist/init/oauth.d.ts +0 -52
  64. package/dist/init/oauth.js +0 -220
  65. package/dist/init/package-manager.d.ts +0 -11
  66. package/dist/init/package-manager.js +0 -60
  67. package/dist/init/prompt.d.ts +0 -12
  68. package/dist/init/prompt.js +0 -68
  69. package/dist/init/shell-profile.d.ts +0 -22
  70. package/dist/init/shell-profile.js +0 -85
  71. package/dist/init/steps.d.ts +0 -135
  72. package/dist/init/steps.js +0 -399
  73. package/dist/init/url-scheme.d.ts +0 -42
  74. package/dist/init/url-scheme.js +0 -187
  75. package/dist/init/walkthrough.d.ts +0 -76
  76. package/dist/init/walkthrough.js +0 -340
  77. package/dist/init.d.ts +0 -8
  78. package/dist/init.js +0 -395
  79. package/dist/iproxy-manager.d.ts +0 -32
  80. package/dist/iproxy-manager.js +0 -216
  81. package/dist/mac-caffeinate.d.ts +0 -10
  82. package/dist/mac-caffeinate.js +0 -56
  83. package/dist/permission-interceptor.d.ts +0 -29
  84. package/dist/permission-interceptor.js +0 -185
  85. package/dist/prebuild-detector.d.ts +0 -19
  86. package/dist/prebuild-detector.js +0 -174
  87. package/dist/preflight.d.ts +0 -34
  88. package/dist/preflight.js +0 -847
  89. package/dist/screen.d.ts +0 -184
  90. package/dist/screen.js +0 -931
  91. package/dist/signal-listener.d.ts +0 -27
  92. package/dist/signal-listener.js +0 -135
  93. package/dist/simulator-boot.d.ts +0 -52
  94. package/dist/simulator-boot.js +0 -227
  95. package/dist/target.d.ts +0 -48
  96. package/dist/target.js +0 -267
  97. package/dist/uninstall/cli-runner.d.ts +0 -32
  98. package/dist/uninstall/cli-runner.js +0 -223
  99. package/dist/uninstall/footprint.d.ts +0 -40
  100. package/dist/uninstall/footprint.js +0 -288
  101. package/dist/uninstall/mcp-tools.d.ts +0 -14
  102. package/dist/uninstall/mcp-tools.js +0 -175
  103. package/dist/uninstall/revert-auth.d.ts +0 -22
  104. package/dist/uninstall/revert-auth.js +0 -31
  105. package/dist/uninstall/revert-boot.d.ts +0 -24
  106. package/dist/uninstall/revert-boot.js +0 -242
  107. package/dist/uninstall/revert-camera.d.ts +0 -12
  108. package/dist/uninstall/revert-camera.js +0 -199
  109. package/dist/uninstall/revert-ceraph-dir.d.ts +0 -27
  110. package/dist/uninstall/revert-ceraph-dir.js +0 -38
  111. package/dist/uninstall/revert-claude-hooks.d.ts +0 -19
  112. package/dist/uninstall/revert-claude-hooks.js +0 -191
  113. package/dist/uninstall/revert-gitignore.d.ts +0 -17
  114. package/dist/uninstall/revert-gitignore.js +0 -43
  115. package/dist/uninstall/revert-mcp-clients.d.ts +0 -57
  116. package/dist/uninstall/revert-mcp-clients.js +0 -194
  117. package/dist/uninstall/revert-package.d.ts +0 -34
  118. package/dist/uninstall/revert-package.js +0 -98
  119. package/dist/uninstall/revert-scheme.d.ts +0 -36
  120. package/dist/uninstall/revert-scheme.js +0 -139
  121. package/dist/uninstall/revert-signal-host-env.d.ts +0 -31
  122. package/dist/uninstall/revert-signal-host-env.js +0 -61
  123. package/dist/uninstall/walkthrough.d.ts +0 -80
  124. package/dist/uninstall/walkthrough.js +0 -1244
  125. package/dist/utils/atomic-write.d.ts +0 -1
  126. package/dist/utils/atomic-write.js +0 -30
  127. package/dist/wait-for-device.d.ts +0 -68
  128. package/dist/wait-for-device.js +0 -368
  129. package/dist/wda-manager.d.ts +0 -38
  130. package/dist/wda-manager.js +0 -186
  131. package/dist/wda-simulator.d.ts +0 -28
  132. package/dist/wda-simulator.js +0 -257
@@ -1,275 +0,0 @@
1
- const XCODE_ERROR_RE = /^(.+?):(\d+):(\d+):\s*(error|warning|note):\s*(.+)$/;
2
- const BUILD_FAILED_MARKERS = [
3
- "Build Failed",
4
- "** BUILD FAILED **",
5
- "xcodebuild: error:",
6
- "❌",
7
- ];
8
- const LINKER_ERROR_RE = /^(ld|clang):\s*(error|warning):\s*(.+)$/;
9
- const UNDEFINED_SYMBOL_RE = /^Undefined symbols? for architecture .+:\s*"(.+)"/;
10
- const POD_ERROR_RE = /^\[!\]\s*(.+)$/;
11
- const METRO_ERROR_RE = /^(Error|TypeError|ReferenceError|SyntaxError|RangeError):\s*(.+)$/;
12
- const METRO_MODULE_RE = /Unable to resolve module ['"](.+?)['"]/;
13
- const METRO_ENCOUNTERED_RE = /Metro has encountered an error/;
14
- const CONSOLE_ERROR_RE = /^(ERROR|console\.error)\s*(.+)$/i;
15
- const INVARIANT_RE = /Invariant Violation:\s*(.+)/;
16
- const UNHANDLED_JS_RE = /Unhandled JS Exception:\s*(.+)/;
17
- const RED_SCREEN_RE = /ExceptionsManager\.js/;
18
- function parseXcodeLine(line) {
19
- const match = line.match(XCODE_ERROR_RE);
20
- if (match) {
21
- return {
22
- file: match[1],
23
- line: parseInt(match[2], 10),
24
- column: parseInt(match[3], 10),
25
- message: match[5],
26
- severity: match[4],
27
- type: "build",
28
- };
29
- }
30
- return null;
31
- }
32
- function parseLinkerLine(line) {
33
- const linkerMatch = line.match(LINKER_ERROR_RE);
34
- if (linkerMatch) {
35
- return {
36
- file: "",
37
- line: 0,
38
- column: 0,
39
- message: linkerMatch[3],
40
- severity: linkerMatch[2],
41
- type: "link",
42
- };
43
- }
44
- const undefinedMatch = line.match(UNDEFINED_SYMBOL_RE);
45
- if (undefinedMatch) {
46
- return {
47
- file: "",
48
- line: 0,
49
- column: 0,
50
- message: `Undefined symbol: ${undefinedMatch[1]}`,
51
- severity: "error",
52
- type: "link",
53
- };
54
- }
55
- return null;
56
- }
57
- const POD_SAFE_WARNING_RE = /\b(cdn|trunk|repo update|overrides the|setting defined in|deprecated|recommends|should)\b/i;
58
- function parsePodLine(line) {
59
- const match = line.match(POD_ERROR_RE);
60
- if (!match)
61
- return null;
62
- const message = match[1];
63
- const isSafeWarning = POD_SAFE_WARNING_RE.test(message);
64
- return {
65
- file: "Podfile",
66
- line: 0,
67
- column: 0,
68
- message,
69
- severity: isSafeWarning ? "warning" : "error",
70
- type: "pod",
71
- };
72
- }
73
- export function parseBuildOutput(lines) {
74
- const errors = [];
75
- const warnings = [];
76
- let buildFailed = false;
77
- let lastError = null;
78
- let contextLines = 0;
79
- const MAX_CONTEXT = 3;
80
- for (const line of lines) {
81
- const trimmed = line.trim();
82
- if (!trimmed) {
83
- lastError = null;
84
- contextLines = 0;
85
- continue;
86
- }
87
- if (BUILD_FAILED_MARKERS.some((m) => trimmed.includes(m))) {
88
- buildFailed = true;
89
- }
90
- const xcodeError = parseXcodeLine(trimmed);
91
- if (xcodeError) {
92
- if (xcodeError.severity === "error") {
93
- errors.push(xcodeError);
94
- lastError = xcodeError;
95
- contextLines = 0;
96
- }
97
- else {
98
- warnings.push({
99
- message: xcodeError.message,
100
- source: `${xcodeError.file}:${xcodeError.line}:${xcodeError.column}`,
101
- });
102
- }
103
- continue;
104
- }
105
- const linkerError = parseLinkerLine(trimmed);
106
- if (linkerError) {
107
- if (linkerError.severity === "warning") {
108
- warnings.push({ message: linkerError.message, source: "linker" });
109
- }
110
- else {
111
- errors.push(linkerError);
112
- }
113
- lastError = linkerError;
114
- contextLines = 0;
115
- continue;
116
- }
117
- const podNotice = parsePodLine(trimmed);
118
- if (podNotice) {
119
- if (podNotice.severity === "warning") {
120
- warnings.push({ message: podNotice.message, source: "CocoaPods" });
121
- }
122
- else {
123
- errors.push(podNotice);
124
- lastError = podNotice;
125
- contextLines = 0;
126
- }
127
- continue;
128
- }
129
- if (lastError && contextLines < MAX_CONTEXT) {
130
- lastError.message += `\n${trimmed}`;
131
- contextLines++;
132
- }
133
- }
134
- return { errors, warnings, buildFailed };
135
- }
136
- export class MetroErrorParser {
137
- currentStack = [];
138
- currentErrorMessage = "";
139
- inStackTrace = false;
140
- parse(lines) {
141
- const runtimeErrors = [];
142
- const warnings = [];
143
- const flushInto = (sink) => {
144
- if (this.currentErrorMessage) {
145
- sink.push({
146
- message: this.currentErrorMessage,
147
- stack: this.currentStack.join("\n"),
148
- timestamp: new Date().toISOString(),
149
- kind: "metro-error",
150
- });
151
- this.currentErrorMessage = "";
152
- this.currentStack = [];
153
- this.inStackTrace = false;
154
- }
155
- };
156
- for (const line of lines) {
157
- const trimmed = line.trim();
158
- const moduleMatch = trimmed.match(METRO_MODULE_RE);
159
- if (moduleMatch) {
160
- flushInto(runtimeErrors);
161
- runtimeErrors.push({
162
- message: `Unable to resolve module '${moduleMatch[1]}'`,
163
- stack: trimmed,
164
- timestamp: new Date().toISOString(),
165
- kind: "metro-error",
166
- });
167
- continue;
168
- }
169
- if (METRO_ENCOUNTERED_RE.test(trimmed)) {
170
- flushInto(runtimeErrors);
171
- this.currentErrorMessage = "Metro has encountered an error";
172
- this.inStackTrace = true;
173
- continue;
174
- }
175
- const invariantMatch = trimmed.match(INVARIANT_RE);
176
- if (invariantMatch) {
177
- flushInto(runtimeErrors);
178
- this.currentErrorMessage = `Invariant Violation: ${invariantMatch[1]}`;
179
- this.inStackTrace = true;
180
- continue;
181
- }
182
- const unhandledMatch = trimmed.match(UNHANDLED_JS_RE);
183
- if (unhandledMatch) {
184
- flushInto(runtimeErrors);
185
- this.currentErrorMessage = `Unhandled JS Exception: ${unhandledMatch[1]}`;
186
- this.inStackTrace = true;
187
- continue;
188
- }
189
- const metroMatch = trimmed.match(METRO_ERROR_RE);
190
- if (metroMatch) {
191
- flushInto(runtimeErrors);
192
- this.currentErrorMessage = `${metroMatch[1]}: ${metroMatch[2]}`;
193
- this.inStackTrace = true;
194
- continue;
195
- }
196
- const consoleMatch = trimmed.match(CONSOLE_ERROR_RE);
197
- if (consoleMatch) {
198
- flushInto(runtimeErrors);
199
- this.currentErrorMessage = consoleMatch[2];
200
- this.inStackTrace = true;
201
- continue;
202
- }
203
- if (RED_SCREEN_RE.test(trimmed)) {
204
- if (!this.currentErrorMessage) {
205
- this.currentErrorMessage = "Red screen error detected";
206
- }
207
- this.inStackTrace = true;
208
- }
209
- if (this.inStackTrace) {
210
- if (trimmed.startsWith("at ") ||
211
- trimmed.startsWith("in ") ||
212
- /^\s+at\s/.test(line) ||
213
- /^\d+\s*\|/.test(trimmed)) {
214
- this.currentStack.push(trimmed);
215
- continue;
216
- }
217
- else if (trimmed === "") {
218
- flushInto(runtimeErrors);
219
- continue;
220
- }
221
- else {
222
- this.currentStack.push(trimmed);
223
- continue;
224
- }
225
- }
226
- if (/^warn\s/i.test(trimmed) || /\(WARN\)/.test(trimmed)) {
227
- warnings.push({
228
- message: trimmed.replace(/^warn\s*/i, "").replace(/\(WARN\)\s*/, ""),
229
- source: "metro",
230
- });
231
- }
232
- }
233
- return { runtimeErrors, warnings };
234
- }
235
- flush() {
236
- const runtimeErrors = [];
237
- if (this.currentErrorMessage) {
238
- runtimeErrors.push({
239
- message: this.currentErrorMessage,
240
- stack: this.currentStack.join("\n"),
241
- timestamp: new Date().toISOString(),
242
- kind: "metro-error",
243
- });
244
- this.currentErrorMessage = "";
245
- this.currentStack = [];
246
- this.inStackTrace = false;
247
- }
248
- return { runtimeErrors, warnings: [] };
249
- }
250
- }
251
- export function parseMetroOutput(lines) {
252
- const parser = new MetroErrorParser();
253
- const streamed = parser.parse(lines);
254
- const flushed = parser.flush();
255
- return {
256
- runtimeErrors: [...streamed.runtimeErrors, ...flushed.runtimeErrors],
257
- warnings: [...streamed.warnings, ...flushed.warnings],
258
- };
259
- }
260
- export function classifyLogLevel(line) {
261
- const trimmed = line.trim().toLowerCase();
262
- if (trimmed.startsWith("error") ||
263
- trimmed.includes("console.error") ||
264
- trimmed.startsWith("❌") ||
265
- /^\s*error\s*:/i.test(line)) {
266
- return "error";
267
- }
268
- if (trimmed.startsWith("warn") ||
269
- trimmed.includes("console.warn") ||
270
- trimmed.includes("(warn)") ||
271
- /^\s*warning\s*:/i.test(line)) {
272
- return "warn";
273
- }
274
- return "log";
275
- }
@@ -1,62 +0,0 @@
1
- import { type RuntimeError, type Warning, type AllErrors } from "./error-parser.js";
2
- export interface BuildResult {
3
- success: boolean;
4
- errors: Array<{
5
- file: string;
6
- line: number;
7
- message: string;
8
- type: "build" | "link" | "pod";
9
- }>;
10
- warnings: Warning[];
11
- output: string;
12
- }
13
- interface RunBuildOptions {
14
- clean?: boolean;
15
- device?: string;
16
- }
17
- interface StartMetroOptions {
18
- port?: number;
19
- clear?: boolean;
20
- }
21
- interface ConsoleOptions {
22
- lines?: number;
23
- level?: "all" | "error" | "warn" | "log";
24
- }
25
- export declare class RNManager {
26
- private buildProcess;
27
- private metroProcess;
28
- private buildKilled;
29
- private metroKilled;
30
- private buildOutput;
31
- private metroOutput;
32
- private buildErrors;
33
- private runtimeErrors;
34
- private buildWarnings;
35
- private metroWarnings;
36
- private metroParser;
37
- private readonly MAX_BUILD_LINES;
38
- private readonly MAX_METRO_LINES;
39
- private readonly MAX_ERRORS;
40
- private cwd;
41
- private errorFilePath;
42
- constructor(cwd: string);
43
- detectProjectType(): Promise<boolean>;
44
- private writeErrorFile;
45
- appendShimSignal(entry: RuntimeError): Promise<void>;
46
- private clearErrorFile;
47
- private pushLine;
48
- private capErrors;
49
- private killProcess;
50
- private runPrebuildClean;
51
- runBuild(options?: RunBuildOptions): Promise<BuildResult>;
52
- startMetro(options?: StartMetroOptions): Promise<{
53
- success: boolean;
54
- message: string;
55
- }>;
56
- getErrors(): AllErrors;
57
- getConsole(options?: ConsoleOptions): string[];
58
- stopAll(): Promise<string[]>;
59
- getBuildOutput(): string[];
60
- getMetroOutput(): string[];
61
- }
62
- export {};