( executor: CommandExecutor, simulatorId: string, )
| 65 | * Resolves a simulator UUID to its name by querying simctl. |
| 66 | */ |
| 67 | export async function resolveSimulatorIdToName( |
| 68 | executor: CommandExecutor, |
| 69 | simulatorId: string, |
| 70 | ): Promise<SimulatorResolutionResult> { |
| 71 | log('info', `Looking up simulator by UUID: ${simulatorId}`); |
| 72 | const data = await fetchSimulatorDevices(executor); |
| 73 | if ('error' in data) return { success: false, error: data.error }; |
| 74 | |
| 75 | const simulator = findSimulator(data, (d) => d.udid === simulatorId); |
| 76 | if (simulator) { |
| 77 | log('info', `Resolved simulator UUID "${simulatorId}" to name: ${simulator.name}`); |
| 78 | return { success: true, simulatorId: simulator.udid, simulatorName: simulator.name }; |
| 79 | } |
| 80 | |
| 81 | return { |
| 82 | success: false, |
| 83 | error: `Simulator UUID "${simulatorId}" not found. Use list_sims to see available simulators.`, |
| 84 | }; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Resolves a simulator from either simulatorId or simulatorName. |
no test coverage detected