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

Function main

packages/core/scripts/check-hyperframe-static.ts:38–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36}
37
38async function main() {
39 const args = process.argv.slice(2);
40 const normalizedArgs = args[0] === "--" ? args.slice(1) : args;
41 const jsonOutput = normalizedArgs.includes("--json");
42 const positionalArgs = normalizedArgs.filter((arg) => arg !== "--json");
43 const inputPath = positionalArgs[0];
44 if (!inputPath) {
45 console.error(
46 "Usage: bun run check:hyperframe-html [--json] <path-to-html>\nExample: bun run check:hyperframe-html core/src/tests/broken-video.html",
47 );
48 process.exit(2);
49 }
50
51 const resolvedPath = path.resolve(process.cwd(), inputPath);
52 if (!fs.existsSync(resolvedPath)) {
53 console.error(`File not found: ${resolvedPath}`);
54 process.exit(2);
55 }
56
57 const html = fs.readFileSync(resolvedPath, "utf-8");
58 const result = await lintHyperframeHtml(html, { filePath: resolvedPath });
59
60 if (jsonOutput) {
61 console.log(JSON.stringify(result, null, 2));
62 process.exit(result.ok ? 0 : 1);
63 }
64
65 if (result.ok) {
66 console.log(formatHumanOutput(result, resolvedPath));
67 process.exit(0);
68 }
69
70 console.error(formatHumanOutput(result, resolvedPath));
71 process.exit(1);
72}
73
74main();

Callers 1

Calls 3

lintHyperframeHtmlFunction · 0.90
formatHumanOutputFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected