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

Function dispatchCommand

src/core/dispatch.ts:42–88  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  command: string,
  positionals: string[],
  outPath?: string,
  context?: DispatchContext,
)

Source from the content-addressed store, hash-verified

40export type { CommandFlags, DispatchContext } from './dispatch-context.ts';
41
42export async function dispatchCommand(
43 device: DeviceInfo,
44 command: string,
45 positionals: string[],
46 outPath?: string,
47 context?: DispatchContext,
48): Promise<Record<string, unknown> | void> {
49 const runnerCtx: RunnerContext = {
50 requestId: context?.requestId,
51 appBundleId: context?.appBundleId,
52 verbose: context?.verbose,
53 logPath: context?.logPath,
54 traceLogPath: context?.traceLogPath,
55 iosXctestrunFile: context?.iosXctestrunFile,
56 iosXctestDerivedDataPath: context?.iosXctestDerivedDataPath,
57 iosXctestEnvDir: context?.iosXctestEnvDir,
58 runnerLeaseContext: context?.runnerLeaseContext,
59 };
60 const interactor = await getInteractor(device, runnerCtx);
61 emitDiagnostic({
62 level: 'debug',
63 phase: 'platform_command_prepare',
64 data: {
65 command,
66 platform: device.platform,
67 kind: device.kind,
68 },
69 });
70 return await withDiagnosticTimer(
71 'platform_command',
72 async () => {
73 return await dispatchKnownCommand(
74 device,
75 interactor,
76 command,
77 positionals,
78 outPath,
79 context,
80 runnerCtx,
81 );
82 },
83 {
84 command,
85 platform: device.platform,
86 },
87 );
88}
89
90/**
91 * The exact set of commands routed by {@link dispatchKnownCommand}. Hand-authored

Calls 4

getInteractorFunction · 0.90
emitDiagnosticFunction · 0.90
withDiagnosticTimerFunction · 0.90
dispatchKnownCommandFunction · 0.85

Tested by

no test coverage detected