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

Function run

packages/cli/src/commands/play.ts:56–181  ·  view source on GitHub ↗
({ args })

Source from the content-addressed store, hash-verified

54 },
55 },
56 async run({ args }) {
57 const project = resolveProject(args.dir);
58 const startPort = parseInt(args.port ?? "3003", 10);
59
60 // Validation: --user-data-dir requires --browser-path
61 if (args["user-data-dir"] && !args["browser-path"]) {
62 clack.log.error("--user-data-dir requires --browser-path");
63 process.exitCode = 1;
64 return;
65 }
66 // Validation: --remote-debugging-port deps
67 const depsError = validateRemoteDebuggingPortDeps({
68 browserPath: args["browser-path"] as string | undefined,
69 userDataDir: args["user-data-dir"] as string | undefined,
70 remoteDebuggingPort: args["remote-debugging-port"] as string | undefined,
71 });
72 if (depsError) {
73 clack.log.error(depsError);
74 process.exitCode = 1;
75 return;
76 }
77 // Parse --remote-debugging-port before any server setup so an invalid value
78 // exits cleanly instead of leaving an orphan listening socket behind.
79 let remoteDebuggingPort: number | undefined;
80 try {
81 remoteDebuggingPort = parseRemoteDebuggingPort(
82 args["remote-debugging-port"] as string | undefined,
83 );
84 } catch (err) {
85 clack.log.error((err as Error).message);
86 process.exitCode = 1;
87 return;
88 }
89
90 // Resolve runtime path — same logic as studioServer.ts
91 const runtimePath = resolveRuntimePath();
92 if (!runtimePath) {
93 clack.log.error("HyperFrames runtime not found. Run `bun run build` first.");
94 process.exitCode = 1;
95 return;
96 }
97
98 // Resolve player path
99 const playerPath = resolvePlayerPath();
100 if (!playerPath) {
101 clack.log.error(
102 "@hyperframes/player not found. Run `bun run --cwd packages/player build` first.",
103 );
104 process.exitCode = 1;
105 return;
106 }
107
108 const { Hono } = await import("hono");
109 const { createAdaptorServer } = await import("@hono/node-server");
110 const { isSafePath } = await import("@hyperframes/core/studio-api");
111
112 const app = new Hono();
113

Callers

nothing calls this directly

Calls 15

parseRemoteDebuggingPortFunction · 0.85
resolvePlayerPathFunction · 0.85
resolveFunction · 0.85
isSafePathFunction · 0.85
injectRuntimeFunction · 0.85
assetContentTypeFunction · 0.85
buildPlayerPageFunction · 0.85
listenOnFreePortFunction · 0.85
errorMethod · 0.80
getMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected