MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / buildBrowserArgs

Function buildBrowserArgs

packages/cli/src/utils/openBrowser.ts:43–57  ·  view source on GitHub ↗
(url: string, options: OpenBrowserOptions)

Source from the content-addressed store, hash-verified

41 * Pure function — easy to unit-test without mocking `spawn` or `import("open")`.
42 */
43export function buildBrowserArgs(url: string, options: OpenBrowserOptions): string[] {
44 const args: string[] = [];
45 if (options.userDataDir) {
46 args.push(`--user-data-dir=${options.userDataDir}`);
47 }
48 // Defense-in-depth: only emit --remote-debugging-port when paired with an
49 // isolated --user-data-dir. Without an isolated profile the CDP endpoint
50 // would expose the user's main browser session, which is the whole reason
51 // the CLI validation layer requires both flags together.
52 if (options.remoteDebuggingPort !== undefined && options.userDataDir) {
53 args.push(`--remote-debugging-port=${options.remoteDebuggingPort}`);
54 }
55 args.push(url);
56 return args;
57}
58
59/**
60 * Open a URL in the browser with the given options.

Callers 2

openBrowserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected