MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveDispatchCommand

Function resolveDispatchCommand

src/daemon/request-generic-dispatch.ts:216–248  ·  view source on GitHub ↗
(req: DaemonRequest)

Source from the content-addressed store, hash-verified

214 | { ok: false; message: string };
215
216function resolveDispatchCommand(req: DaemonRequest): DispatchCommandResolution {
217 if (
218 req.command === 'pan' ||
219 req.command === 'fling' ||
220 req.command === 'rotate-gesture' ||
221 req.command === 'transform-gesture'
222 ) {
223 return {
224 ok: false,
225 message:
226 'Use gesture pan, gesture fling, gesture swipe, gesture rotate, or gesture transform.',
227 };
228 }
229 if (req.command !== 'gesture') {
230 return {
231 ok: true,
232 platformCommand: req.command,
233 dispatchRequest: req,
234 recordedCommand: req.command,
235 };
236 }
237 const [subcommand, ...positionals] = req.positionals ?? [];
238 const platformCommand = subcommand ? GESTURE_PLATFORM_COMMANDS[subcommand] : undefined;
239 if (!platformCommand) {
240 return { ok: false, message: GESTURE_SUBCOMMAND_ERROR };
241 }
242 return {
243 ok: true,
244 platformCommand,
245 dispatchRequest: { ...req, command: platformCommand, positionals },
246 recordedCommand: req.command,
247 };
248}
249
250function resolveScreenshotOutputPlacement(req: DaemonRequest): ScreenshotOutputPlacement {
251 if (req.command !== 'screenshot') return 'default';

Callers 1

dispatchGenericCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected