import { Recorder, stringifySession } from "@vulcn/engine";
import fs from "fs/promises";
async function recordSession(url: string, outputPath: string) {
console.log(`Recording session from ${url}...`);
const recording = await Recorder.start(url, {
browser: "chromium",
headless: false,
});
console.log("Browser opened. Interact with the page, then close it.");
// Wait for browser to close
const session = await recording.stop();
console.log(`Recorded ${session.steps.length} steps`);
// Save to file
const yaml = stringifySession(session);
await fs.writeFile(outputPath, yaml);
console.log(`Saved to ${outputPath}`);
}
recordSession("https://example.com", "session.vulcn.yml");