(selection: SetupSelection)
| 965 | } |
| 966 | |
| 967 | function selectionToMcpConfigJson(selection: SetupSelection): string { |
| 968 | const env: Record<string, string> = {}; |
| 969 | |
| 970 | if (selection.enabledWorkflows.length > 0) { |
| 971 | env.XCODEBUILDMCP_ENABLED_WORKFLOWS = selection.enabledWorkflows.join(','); |
| 972 | } |
| 973 | |
| 974 | if (selection.debug) { |
| 975 | env.XCODEBUILDMCP_DEBUG = 'true'; |
| 976 | } |
| 977 | |
| 978 | if (selection.sentryDisabled) { |
| 979 | env.XCODEBUILDMCP_SENTRY_DISABLED = 'true'; |
| 980 | } |
| 981 | |
| 982 | if (selection.workspacePath) { |
| 983 | env.XCODEBUILDMCP_WORKSPACE_PATH = selection.workspacePath; |
| 984 | } else if (selection.projectPath) { |
| 985 | env.XCODEBUILDMCP_PROJECT_PATH = selection.projectPath; |
| 986 | } |
| 987 | |
| 988 | env.XCODEBUILDMCP_SCHEME = selection.scheme; |
| 989 | if (selection.deviceId) { |
| 990 | env.XCODEBUILDMCP_DEVICE_ID = selection.deviceId; |
| 991 | } |
| 992 | |
| 993 | const derivedPlatform = derivePlatformSessionDefault(selection.platforms); |
| 994 | if (derivedPlatform) { |
| 995 | env.XCODEBUILDMCP_PLATFORM = derivedPlatform; |
| 996 | } |
| 997 | |
| 998 | if (selection.simulatorId) { |
| 999 | env.XCODEBUILDMCP_SIMULATOR_ID = selection.simulatorId; |
| 1000 | } |
| 1001 | if (selection.simulatorName) { |
| 1002 | env.XCODEBUILDMCP_SIMULATOR_NAME = selection.simulatorName; |
| 1003 | } |
| 1004 | |
| 1005 | const mcpConfig = { |
| 1006 | mcpServers: { |
| 1007 | XcodeBuildMCP: { |
| 1008 | command: 'npx', |
| 1009 | args: ['-y', 'xcodebuildmcp@latest', 'mcp'], |
| 1010 | env, |
| 1011 | }, |
| 1012 | }, |
| 1013 | }; |
| 1014 | |
| 1015 | return JSON.stringify(mcpConfig, null, 2); |
| 1016 | } |
| 1017 | |
| 1018 | export async function runSetupWizard(deps?: Partial<SetupDependencies>): Promise<SetupRunResult> { |
| 1019 | const isTTY = isInteractiveTTY(); |
no test coverage detected