1#!/usr/bin/env node2// Run one editor-API snippet from a file in the open Harmony editor and print its result.3//4// node scripts/copy/editor-run.mjs <snippet.js> [--site <metaSiteId>] [--max 20000] [--capabilities caps.json]5//6// The snippet is the body of an async function with `editorLLMApis` in scope; `return`7// its result. Keeping snippets in files avoids shell-quoting bugs and leaves a replayable8// record of every write. Prints the parsed `result` on success, or the editor's failure9// summary (which lists completed writes: never re-run those, continue from the failed call).10import { chromium } from 'playwright';11import { hideScrollbars } from './hide-scrollbars.mjs';
25 for (const p of problems) console.error(`ERROR ${p.at}: ${p.error || p.warning}`);
26 if (problems.some((p) => p.error)) { console.error('Not sent: fix the unknown API calls or non-API operations (or refresh the snapshot).'); process.exit(4); }
27} else console.error('note: no --capabilities / HARMONY_CAPABILITIES given: the snippet is not linted against the editor API list');