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

Function runWebCommand

src/cli/commands/web.ts:8–40  ·  view source on GitHub ↗
(
  positionals: string[],
  options: { flags: CliFlags; stateDir: string },
)

Source from the content-addressed store, hash-verified

6type PublicAgentBrowserToolStatus = Omit<AgentBrowserToolStatus, 'socketDir'>;
7
8export async function runWebCommand(
9 positionals: string[],
10 options: { flags: CliFlags; stateDir: string },
11): Promise<number> {
12 const action = positionals[0];
13 switch (action) {
14 case 'setup': {
15 printWebSetupStart(options.flags.json);
16 const { setupManagedAgentBrowser } =
17 await import('../../platforms/web/agent-browser-tool.ts');
18 const status = await setupManagedAgentBrowser({
19 stateDir: options.stateDir,
20 });
21 printWebSetupResult(options.flags.json, status);
22 return 0;
23 }
24 case 'doctor': {
25 const { doctorManagedAgentBrowser } =
26 await import('../../platforms/web/agent-browser-tool.ts');
27 const result = await doctorManagedAgentBrowser({
28 stateDir: options.stateDir,
29 });
30 printWebResult(
31 options.flags.json,
32 result.exitCode === 0 ? 'Web backend is healthy.' : 'Web backend doctor reported issues.',
33 result,
34 );
35 return result.exitCode;
36 }
37 default:
38 throw new AppError('INVALID_ARGS', 'web requires setup or doctor');
39 }
40}
41
42function printWebSetupStart(json: boolean | undefined): void {
43 if (json) return;

Callers 1

runCliFunction · 0.90

Calls 5

printWebSetupStartFunction · 0.85
setupManagedAgentBrowserFunction · 0.85
printWebSetupResultFunction · 0.85
printWebResultFunction · 0.85

Tested by

no test coverage detected