Skip to content

feat(clone-website): add optional ego-browser backend - #68

Open
ystyleb wants to merge 1 commit into
JCodesMore:masterfrom
ystyleb:feat/optional-ego-browser-backend
Open

feat(clone-website): add optional ego-browser backend#68
ystyleb wants to merge 1 commit into
JCodesMore:masterfrom
ystyleb:feat/optional-ego-browser-backend

Conversation

@ystyleb

@ystyleb ystyleb commented Jul 5, 2026

Copy link
Copy Markdown

What

Adds an optional ego-browser backend to the clone-website skill, alongside the existing browser MCP (which stays the default and completely unchanged).

Why

ego-browser drives a real Chromium through a Node runtime and composes multi-step browser work as a single JavaScript pass, returning only the fields you build — instead of re-dumping a full DOM / accessibility tree into context each round. For this skill's heavy getComputedStyle extraction that means far fewer tool calls and much less context token per clone.

How

  • New "Browser Backend (pick one)" section: Option A = browser MCP (default, read straight through), Option B = ego-browser (opt-in) with a heredoc example + a translation table mapping the existing "via browser MCP" wording to ego-browser equivalents.
  • The extraction scripts are backend-agnostic, so the rest of the document is byte-for-byte unchanged and existing users are unaffected.
  • One-line Pre-Flight tweak to point at backend selection.
  • Regenerated all 9 platform copies via scripts/sync-skills.mjs (net: SKILL.md +36/-1).

Testing

  • ego-browser primitives probed against ego lite (macOS): captureScreenshot() returns a temp PNG path (not base64), cdp Emulation.setDeviceMetricsOverride works, js() returns a real JS value.
  • Ran an end-to-end minimal clone (example.com) on this template with the ego backend: ego extraction (getComputedStyle probe) → generated a React component → npm run build passed (Next 16, TypeScript clean) → dev-server render verified via ego to match the source (h1 24px/700, link rgb(51, 68, 136) underline, verbatim text). Demo artifacts were not committed — this PR is skill files only.
  • browser MCP remains the default and unchanged path.

Adds a "Browser Backend" section letting users pick between the existing
browser MCP (default, unchanged) and ego-browser (opt-in). ego-browser
composes multi-step browser work as one JavaScript pass and returns only
the fields you build, so extraction uses far fewer tool calls and much
less context token than re-dumping a DOM/accessibility tree each round.

Extraction scripts stay backend-agnostic: a translation table maps the
existing "via browser MCP" wording to ego-browser equivalents, so the rest
of the document is byte-for-byte unchanged and existing users are unaffected.

Regenerated all 9 platform copies via scripts/sync-skills.mjs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 153ee703e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


| This doc says (browser MCP) | ego-browser equivalent |
| --- | --- |
| evaluate a snippet | `await js(...)` with a `String.raw` template — returns a real JS value; **do not `JSON.stringify` inside** the snippet, serialize in the Node body via `cliLog` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid double-encoding ego extraction results

When an agent uses the new ego-browser backend and pastes the unchanged extraction snippets later in this skill, this guidance conflicts with those snippets: the Asset Discovery and Per-component scripts still return JSON.stringify(...), while the heredoc also does cliLog(JSON.stringify(data, null, 2)). In that ego-browser path the captured output becomes a quoted/escaped JSON string instead of the object the rest of the workflow expects, which can contaminate specs or asset manifests with double-encoded data; either update the snippets for ego or make the wrapper log string results directly.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant