forked from getsentry/XcodeBuildMCP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiagnostic-cli.ts
More file actions
49 lines (40 loc) · 1.55 KB
/
diagnostic-cli.ts
File metadata and controls
49 lines (40 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
/**
* XcodeBuildMCP Diagnostic CLI
*
* This standalone script runs the diagnostic tool and outputs the results
* to the console. It's designed to be run directly via npx or mise.
*/
import { version } from './version.js';
// Set the debug environment variable
process.env.XCODEBUILDMCP_DEBUG = 'true';
async function runDiagnostic(): Promise<void> {
try {
// Using console.error to avoid linting issues as it's allowed by the project's linting rules
console.error(`Running XcodeBuildMCP Diagnostic Tool (v${version})...`);
console.error('Collecting system information and checking dependencies...\n');
const { runDiagnosticTool } = await import('./tools/diagnostic.js');
// Run the diagnostic tool
const result = await runDiagnosticTool({});
// Output the diagnostic information
if (result.content && result.content.length > 0) {
const textContent = result.content.find((item: { type: string }) => item.type === 'text');
if (textContent && 'text' in textContent) {
console.error(textContent.text);
} else {
console.error('Error: Unexpected diagnostic result format');
}
} else {
console.error('Error: No diagnostic information returned');
}
console.error('\nDiagnostic complete. Please include this output when reporting issues.');
} catch (error) {
console.error('Error running diagnostic:', error);
process.exit(1);
}
}
// Run the diagnostic
runDiagnostic().catch((error) => {
console.error('Unhandled exception:', error);
process.exit(1);
});