The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.
JavaScript agent-skillsai-agentautomationbrowserbrowser-automationclaude-codecodexhermes-agentskillsskills-sh
build(ego-browser): unwrap soft-wrapped prose in the printed usage guide
Zhuowei Wang768363a6f6a8
diff --git a/package/ego-browser/scripts/build.mjs b/package/ego-browser/scripts/build.mjsindex 7505091..2c202cd 100644--- a/package/ego-browser/scripts/build.mjs+++ b/package/ego-browser/scripts/build.mjs@@ -115,6 +115,7 @@ try {// Replace the source frontmatter with the version line and end marker that// `ego-browser skill` prints verbatim; agents use the marker to detect truncation.+// The source wraps prose at 80 columns for review; the printed guide unwraps it.function renderGuide(source) {const match = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/.exec(source);const version = match && /^version: "([^"]+)"$/m.exec(match[1])?.[1];@@ -124,7 +125,7 @@ function renderGuide(source) {const guide = [`[ego-browser:skill] ego-browser usage guide v${version}`,"",- match[2].trim(),+ unwrapProse(match[2].trim()),"",`[ego-browser:skill] end of guide v${version}`,"",@@ -137,6 +138,32 @@ function renderGuide(source) {return guide;}+// Join soft-wrapped Markdown lines with a space, which renders identically.+// Code fences, headings, list items, tables, and blockquotes start new lines.+function unwrapProse(markdown) {+ const startsBlock = /^\s*(```|#|[-*+] |\d+\. |\||>)/;+ const lines = [];+ let inFence = false;+ for (const line of markdown.split("\n")) {+ const fence = /^\s*```/.test(line);+ const previous = lines.at(-1);+ if (+ !inFence &&+ !fence &&+ line.trim() &&+ previous?.trim() &&+ !startsBlock.test(line) &&+ !/^\s*(```|#|\|)/.test(previous)+ ) {+ lines[lines.length - 1] = `${previous} ${line.trim()}`;+ } else {+ lines.push(line);+ }+ if (fence) inFence = !inFence;+ }+ return lines.join("\n");+}+async function tsEntryPoints(dirs) {const files = [];for (const dir of dirs) {diff --git a/package/ego-browser/src/skill-package.test.mjs b/package/ego-browser/src/skill-package.test.mjsindex a55fe6d..07d4f11 100644--- a/package/ego-browser/src/skill-package.test.mjs+++ b/package/ego-browser/src/skill-package.test.mjs@@ -10,7 +10,10 @@ const guideSource = fileURLToPath(new URL("../skill-body/SKILL.md", import.meta.url),);-test("the bundled usage guide is the source guide between version and end markers", async () => {+const codeFences = (markdown) => markdown.match(/^```[^\n]*\n[\s\S]*?^```$/gm);+const words = (markdown) => markdown.split(/\s+/).filter(Boolean);++test("the bundled usage guide is the unwrapped source guide between version and end markers", async () => {const bundled = await readFile(join(outDir, "ego-browser/SKILL.md"), "utf8");const source = await readFile(guideSource, "utf8");const version = /^version: "([^"]+)"$/m.exec(source)[1];@@ -22,9 +25,12 @@ test("the bundled usage guide is the source guide between version and end marker`[ego-browser:skill] ego-browser usage guide v${version}`,);assert.equal(lines.at(-1), `[ego-browser:skill] end of guide v${version}`);- assert.ok(- bundled.includes(source.replace(/^---\n[\s\S]*?\n---\n/, "").trim()),- );+ const body = source.replace(/^---\n[\s\S]*?\n---\n/, "").trim();+ const bundledBody = lines.slice(2, -2).join("\n");+ assert.deepEqual(words(bundledBody), words(body));+ assert.deepEqual(codeFences(bundledBody), codeFences(body));+ assert.ok(bundledBody.split("\n").length < body.split("\n").length);+ assert.ok(!/^ {2,}\S/m.test(bundledBody.replace(/^```[\s\S]*?^```$/gm, "")));assert.ok(bundled.length <= 25_000);});