Skip to content

Add an SEO prompt composer to the OG viewer - #1922

Merged
David Pine (IEvangelist) merged 1 commit into
ievangelist-og-viewer-oversized-page-fixfrom
ievangelist-og-preview-prompt-composer
Oct 26, 2026
Merged

David Pine (IEvangelist) merged 1 commit into
ievangelist-og-viewer-oversized-page-fixfrom
ievangelist-og-preview-prompt-composer

Conversation

@IEvangelist

Copy link
Copy Markdown
Member

Summary

Adds a Prompt tab to the OG Viewer canvas and an agent-callable get_prompt action. Both turn a URL into one ready-to-use prompt for an AI assistant: a short context block, composable task modules (audit, fix head tags, rewrite copy, share image, structured data, agent readiness, implement, verify), the user's own notes, and a versioned JSON snapshot of the page's SEO and social metadata (URL and redirects, HTTP headers, title, description, canonical, robots, hreflang, JSON-LD, Open Graph, Twitter, diagnostics, agent readiness).

Stacked on #1918. This branch is based on #1918's branch, so the diff shows only the composer commit. I'll retarget it to main and rebase once #1918 merges.

How it works:

  • One pure module, lib/build-prompt.mjs, builds the payload and the prompt. The extension server and the canvas UI both use it, so the tab and the action can't drift.
  • The tab has Copy prompt, Copy JSON, Open in Copilot, and Create issue (the last two appear when the page links to its source repository). The fifth tab also gets a responsive toolbar fix.
  • Page content is untrusted. The JSON is fenced and followed by a reminder, the Page: line carries only the requested URL, and redirect targets, the canonical URL, and the detected repository appear only inside the JSON.
  • The payload is bounded. Strings, lists, and JSON-LD have fixed limits, and anything cut is named in truncated; JSON-LD that is left out is flagged dataOmitted. The limits are listed in the README.

Known limit: a page that pushes every limit at once can still produce a prompt larger than the 512 KB request limit used by Open in Copilot and Create issue, and GitHub caps an issue body at 65,536 characters. Copying always works.

Third-party links and affiliations

None. The tests use reserved .example hostnames as hostile fixtures; no real third-party links are added.

Validation

  • node --check on extension.mjs, lib/parse-og.mjs, and lib/build-prompt.mjs: all pass.
  • node --test ".github/extensions/og-preview/tests/*.test.mjs": 72 pass, 0 fail.
  • Control: against the lib files from before the review fixes, 11 of the new and updated tests fail, so the tests catch the problems they target.
  • Live check in a real browser with the extension reloaded, on https://aspire.dev/reference/api/csharp/ (the page Fix OG Viewer failing to load pages over the 6 MiB fetch cap #1918 fixes):
    • Browse shows the whole page (6.45M characters, 4,996 package links, footer).
    • The Prompt tab shows all eight modules, the size readout (15,868 characters, about 3,967 tokens), the truncation notice, and a valid JSON snapshot with the agent-readiness checks joined in.
    • get_prompt returns the same shape; the Page: line shows only the requested URL and the detected repository appears only in the JSON.
  • UI, CSS, and the agent-readiness path aren't covered by CI; the live check above is the only coverage for them. The design linter still reports 3 findings in styles.css (side-tab, bounce-easing, layout-transition) that were there before this change.
  • CI: OG preview tests runs on this PR. ci.yml only runs for PRs into main or release/*, so it will run after the retarget.

Adds a Prompt tab and a get_prompt canvas action that turn a URL into a ready-to-paste AI prompt: a bounded JSON snapshot of its SEO and social metadata (URL and redirects, HTTP headers, title, description, canonical, robots, hreflang, structured data, Open Graph, Twitter, diagnostics, agent readiness) wrapped in composable task modules and the user's own notes.

The payload and prompt are built by one pure module (lib/build-prompt.mjs) that the extension server and the canvas UI share, so the tab and the action cannot drift. The parser gains the extra SEO fields with caps, and the fifth tab gets a responsive toolbar fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ed12c02d-40f7-44b1-b708-2f2517aa89e7
@IEvangelist
David Pine (IEvangelist) merged commit 5311e3a into ievangelist-og-viewer-oversized-page-fix Oct 26, 2026
2 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the ievangelist-og-preview-prompt-composer branch October 26, 2026 19:01
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