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

Function sendToDaemon

src/__tests__/cli-diff.test.ts:40–82  ·  view source on GitHub ↗
(req: CapturedDaemonRequest)

Source from the content-addressed store, hash-verified

38 const tempHome = fs.mkdtempSync(path.join(os.tmpdir(), 'cli-diff-home-'));
39
40 const sendToDaemon = async (req: CapturedDaemonRequest): Promise<DaemonResponse> => {
41 if (req.command === 'screenshot') {
42 // The client-backed diff handler captures a screenshot via the client.
43 // Write a real PNG to the requested path so compareScreenshots can read it.
44 const outPath = req.positionals?.[0] ?? req.flags?.out;
45 if (typeof outPath === 'string') {
46 fs.mkdirSync(path.dirname(outPath), { recursive: true });
47 fs.writeFileSync(outPath, solidPngBuffer(10, 10, { r: 255, g: 255, b: 255 }));
48 }
49 return {
50 ok: true,
51 data: {
52 path: outPath,
53 ...(req.flags?.overlayRefs
54 ? {
55 overlayRefs: [
56 {
57 ref: 'e1',
58 label: 'Continue',
59 rect: { x: 1, y: 2, width: 3, height: 4 },
60 overlayRect: { x: 1, y: 2, width: 3, height: 4 },
61 center: { x: 3, y: 4 },
62 },
63 ],
64 }
65 : {}),
66 },
67 };
68 }
69 return {
70 ok: true,
71 data: {
72 mode: 'snapshot',
73 baselineInitialized: false,
74 summary: { additions: 1, removals: 1, unchanged: 1 },
75 lines: [
76 { kind: 'unchanged', text: '@e2 [window]' },
77 { kind: 'removed', text: ' @e3 [text] "67"' },
78 { kind: 'added', text: ' @e3 [text] "134"' },
79 ],
80 },
81 };
82 };
83
84 try {
85 return await captureCli(argv, sendToDaemon, {

Callers

nothing calls this directly

Calls 1

solidPngBufferFunction · 0.70

Tested by

no test coverage detected