MCPcopy
hub / github.com/callstack/agent-device / screenshotCommand

Function screenshotCommand

src/cli/commands/screenshot.ts:14–38  ·  view source on GitHub ↗
({ positionals, flags, client })

Source from the content-addressed store, hash-verified

12import type { ClientCommandHandler } from './router-types.ts';
13
14export const screenshotCommand: ClientCommandHandler = async ({ positionals, flags, client }) => {
15 const result = (await runCliCommand({
16 client,
17 command: 'screenshot',
18 positionals,
19 flags,
20 })) as CaptureScreenshotResult;
21 // A non-default responseLevel returns a leveled (digest) payload — overlayCount,
22 // artifacts, leveled overlayRefs. Rebuilding the default { path, overlayRefs }
23 // shape would drop those, so emit the leveled payload verbatim.
24 if (isNonDefaultResponseLevel(flags.responseLevel)) {
25 writeCommandOutput(flags, result, () => JSON.stringify(result, null, 2));
26 return true;
27 }
28 const data = {
29 path: result.path,
30 ...(result.overlayRefs ? { overlayRefs: result.overlayRefs } : {}),
31 };
32 writeCommandOutput(flags, data, () =>
33 result.overlayRefs
34 ? `Annotated ${result.overlayRefs.length} refs onto ${result.path}`
35 : result.path,
36 );
37 return true;
38};
39
40export const diffCommand: ClientCommandHandler = async ({ positionals, flags, client }) => {
41 if (positionals[0] === 'snapshot') {

Callers 1

screenshot.test.tsFile · 0.90

Calls 3

runCliCommandFunction · 0.90
writeCommandOutputFunction · 0.90

Tested by

no test coverage detected