A desktop coding agent with free access to frontier models.
TypeScript
import { bundle } from "@remotion/bundler";
import {
renderMedia,
renderStill,
selectComposition,
} from "@remotion/renderer";
import { cp, mkdir, mkdtemp, readFile, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { recordingFromCapture } from "@omnirush/presentation/recording";
const [directory, ...flags] = process.argv.slice(2);
if (!directory || flags.some((flag) => !/^--still=\d+$/.test(flag))) {
throw new Error(
"Usage: pnpm --dir scenarios onboarding:render <capture-directory> [--still=frame]",
);
}
const captureDirectory = resolve(directory);
const recording = recordingFromCapture(
JSON.parse(await readFile(join(captureDirectory, "capture.json"), "utf8")),
);
if (recording.downloads.length > 0) {
throw new Error(
"Use an onboarding capture that completes setup without downloading an installer",
);
}
const temporary = await mkdtemp(join(tmpdir(), "omnirush-onboarding-render-"));
try {
const publicDir = join(temporary, "public");
await mkdir(publicDir);
await cp(join(captureDirectory, "frames"), join(publicDir, "frames"), {
recursive: true,
});
const serveUrl = await bundle({
entryPoint: join(dirname(fileURLToPath(import.meta.url)), "remotion.tsx"),
outDir: join(temporary, "bundle"),
publicDir,
});
const inputProps = { recording };
const browserExecutable = process.env.REMOTION_BROWSER_EXECUTABLE;
const composition = await selectComposition({
serveUrl,
id: "Onboarding",
inputProps,
browserExecutable,
});
const still = flags.find((flag) => flag.startsWith("--still="));
if (still) {
const frame = Number(still.slice(8));
const output = join(captureDirectory, `preview-${frame}.png`);
await renderStill({
serveUrl,
composition,
inputProps,
browserExecutable,
frame,
output,
});
console.log(output);
} else {
const outputLocation = join(captureDirectory, "onboarding.mp4");
await renderMedia({
serveUrl,
composition,
inputProps,
browserExecutable,
codec: "h264",
outputLocation,
concurrency: 2,
crf: 18,
});
console.log(outputLocation);
}
} finally {
await rm(temporary, { recursive: true, force: true });
}