( params: BootSimParams, executor: CommandExecutor, )
| 121 | } |
| 122 | |
| 123 | export async function boot_simLogic( |
| 124 | params: BootSimParams, |
| 125 | executor: CommandExecutor, |
| 126 | ): Promise<void> { |
| 127 | const ctx = getHandlerContext(); |
| 128 | const simulatorResult = await determineSimulatorUuid(params, executor); |
| 129 | if (simulatorResult.error || !simulatorResult.uuid) { |
| 130 | const result = createBootSimResult({ |
| 131 | didError: true, |
| 132 | error: 'Boot simulator operation failed.', |
| 133 | diagnosticMessage: `Failed to resolve simulator: ${simulatorResult.error ?? 'No simulator UUID returned'}`, |
| 134 | }); |
| 135 | setStructuredOutput(ctx, result); |
| 136 | log('error', `Error during boot simulator operation: ${result.error ?? 'Unknown error'}`); |
| 137 | return; |
| 138 | } |
| 139 | |
| 140 | if (simulatorResult.warning) { |
| 141 | log('warn', simulatorResult.warning); |
| 142 | } |
| 143 | |
| 144 | const resolvedParams: ResolvedBootSimParams = { ...params, simulatorId: simulatorResult.uuid }; |
| 145 | log('info', `Starting xcrun simctl boot request for simulator ${resolvedParams.simulatorId}`); |
| 146 | |
| 147 | const executeBootSim = createBootSimExecutor(executor); |
| 148 | const result = await executeBootSim(resolvedParams); |
| 149 | setStructuredOutput(ctx, result); |
| 150 | |
| 151 | if (result.didError) { |
| 152 | log('error', `Error during boot simulator operation: ${result.error ?? 'Unknown error'}`); |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | ctx.nextStepParams = { |
| 157 | open_sim: {}, |
| 158 | install_app_sim: { simulatorId: resolvedParams.simulatorId, appPath: 'PATH_TO_YOUR_APP' }, |
| 159 | launch_app_sim: { simulatorId: resolvedParams.simulatorId, bundleId: 'YOUR_APP_BUNDLE_ID' }, |
| 160 | }; |
| 161 | } |
| 162 | |
| 163 | export const schema = getSessionAwareToolSchemaShape({ |
| 164 | sessionAware: publicSchemaObject, |
no test coverage detected