Skip to content

Add unpacked MV3 URL Cleaner extension (draft) - #31

Merged
heyandromeda merged 6 commits into
mainfrom
cursor/mv3-extension-bookmarklet-9892
Oct 25, 2026
Merged

heyandromeda merged 6 commits into
mainfrom
cursor/mv3-extension-bookmarklet-9892

Conversation

@heyandromeda

@heyandromeda heyandromeda commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Unpacked Manifest V3 toolbar extension plus a README bookmarklet. Not for store publish, and this PR should stay a draft.

What landed

  • extension/ toolbar popup imports cleanUrl() and explainParameter() from the repo engine via committed extension/vendor/ copies. It does not fork the cleaner. Load unpacked works without a build; CI checks vendor still matches extension/build.mjs.
  • Toolbar click cleans the current tab locally, copies the cleaned URL only after a real copy succeeds, and offers Open in URL Cleaner using the existing /#url= hash handoff (never ?url=).
  • Permissions: activeTab and clipboardWrite only. No host_permissions, no page fetch, no remote scripts.
  • Bookmarklet lives in the README only:
    javascript:(()=>{window.open('https://andromeda-url-cleaner.vercel.app/#url='+encodeURIComponent(location.href),'_blank')})()

Popup UI

Compact 340px card using the site logo and styles.css tokens, including system dark mode. No LOCAL UTILITY eyebrow.

  • After a successful copy of a dirty URL: big check + Copied! (fade/scale, respects prefers-reduced-motion)
  • Already-clean URL: neutral Already clean, copied
  • Cleaned URL in mono, CSS-truncated, full text in the tooltip
  • N removed badge plus a chip per removed param
  • Small Copy again button; Open in URL Cleaner is a secondary text link
  • Clipboard rejection shows Copy failed., not Copied, and keeps Copy again
  • Shortener / 8192 / non-http warnings keep the site notice styling

Copy reliability

navigator.clipboard.writeText can reject with Document is not focused while the popup is opening. Before the first try the popup calls window.focus() and, if document.hasFocus() is false, waits up to ~150ms. If writeText still rejects, it falls back to a hidden textarea + select() + document.execCommand('copy'). Copied! / Already clean, copied only show if one of those two succeeded.

Popup rules (tested)

  1. Handoff is #url= in the hash only.
  2. URLs longer than 8192 characters are not truncated; the popup shows a short error.
  3. Shortener warning: cleanTabUrl() calls isOpaqueShortener() from the engine. If it flags the URL (for example https://bit.ly/abc or https://bit.ly/abc?utm_source=x), the popup shows the site's shortener warning — Its destination cannot be inspected locally without following the redirect. The visible URL was cleaned, but the hidden destination was not opened or checked. The short URL is cleaned in place. Nothing is fetched or followed. Covered by tests/extension.test.js.
  4. chrome://, file:, about:blank, and other non-http(s) pages show Nothing to clean on this page. No copy, no site open.
  5. https://youtu.be/_ARIGPnYYUk?si=BNwFs4FDXQAIIDYb becomes https://youtu.be/_ARIGPnYYUk.
  6. not a url returns an error object instead of throwing.
  7. Copied! is only returned after a successful writeText or execCommand fallback; both failing shows Copy failed.

How to try it

  1. Chrome → chrome://extensions → Developer mode → Load unpacked → extension/ (no build step)
  2. Click the toolbar icon on an http(s) page

Tests

  • npm test: 197 passing
  • cd mcp && node --test tests/*.mjs: 26 passing
  • npm run test:playwright: 8 scripts, including five back-to-back popup opens that still copy after writeText rejects
Open in Web Open in Cursor 

Note

Low Risk
Optional local-only extension with minimal permissions; no changes to hosted app auth or data handling, mainly new client surface area covered by tests.

Reviewed by Cursor Bugbot for commit 7626e60. Bugbot is set up for automated code reviews on this repo. Configure here.

Toolbar popup imports cleanUrl() and explanations from the repo engine,
copies the cleaned tab URL locally, and links back via the existing #url=
handoff. Tests cover YouTube si cleanup, invalid input, long URLs,
opaque shorteners, and non-http(s) pages. Not for store publish.

Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
url-cleaner Ready Ready Preview Oct 25, 2026 1:54pm UTC

@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 4116cd5c-7d27-4119-932f-0cbf609c2da4)

Cover https://bit.ly/abc and assert the popup shows the local
warning without fetch.

Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 8e17eec9-634f-4785-af2e-ff94bdadf044)

Match the site tokens in a 340px card, show Copied! only after
clipboard writeText resolves, and keep load-unpacked working
without a build by committing extension/vendor/.

Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 36ff0771-14e5-453f-ac98-fb15dffe3987)

writeText can reject with "Document is not focused" while the
popup is opening. Focus first, wait up to 150ms, then fall back
to a hidden textarea + execCommand('copy'). Copied! only shows
when one of those actually succeeds.

Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: c26b4b9c-27bb-406c-9681-bd36e0b0a9f1)

@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 9acc2225-d22e-4a27-9ea3-5cde4fc57307)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T13:25:52.392316Z b9086bb Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: b9086bb1a0

ℹ️ 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".

Comment thread scripts/build.mjs Outdated

if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
buildDist();
buildExtensionVendor();

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 Preserve committed vendor files until synchronization checks run

When an engine file changes without updating extension/vendor/, npm test runs this build through its existing pretest hook and silently replaces the committed vendor copies before either synchronization test reads them. Both tests therefore pass even though loading the extension directly from that checkout uses stale cleaning rules, contrary to the documented no-build installation flow. Check the committed copies before regenerating them, or generate into a temporary directory for comparison.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stopped npm run build from rewriting extension/vendor/; drift is detected by comparing committed files to a fresh buildExtensionVendor output in a temp dir (findExtensionVendorDrift + stale-copy unit test). — 6533b44

Comment thread extension/popup-ui.js Outdated
Comment on lines +37 to +38
if (!result.removedParams.length) {
return { kind: "neutral", text: ALREADY_CLEAN, check: false };

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 Account for redirect unwrapping in the success headline

For a recognized redirect whose destination has no tracking parameters, such as https://www.google.com/url?q=https%3A%2F%2Fexample.com%2F, the engine replaces the wrapper with https://example.com/ but returns an empty removedParameters array. This condition consequently displays Already clean, copied even though the extension changed the URL and removed a redirect wrapper. Preserve the engine's changed or unwrappedFrom metadata in cleanTabUrl() and use it to distinguish an unchanged URL from a successfully unwrapped one.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Popup headline and chips now use the engine changed / unwrappedFrom fields (Google /url shows Copied! + Unwrapped redirect chip); unit + Playwright tests added. — 6533b44

- Merge main and keep horrible playbook in Playwright CI chain
- Stop npm run build from rewriting extension/vendor before tests
- Compare committed vendor to fresh builds in a temp directory
- Drive popup headline from engine changed flag; show unwrap chip
- Add unit and Playwright coverage for Google /url unwrap

Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 2627b024-4c6d-4c70-936f-2dd8abd4c266)

- Count redirect unwrap once in removed badge; host-named redirect chips
- Reject whitespace/encoded-space hostnames without copying
- Neutral styling for nothing-to-clean; unwrap-limit headline and warning
- Consistent popup punctuation; execCommand focus restore; link tap target
- Vendor drift assertion message; artifacts dir via env with temp fallback

Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: e36174bd-30cd-4936-be0c-d47150b73d0e)

@heyandromeda
heyandromeda merged commit 9e4fb34 into main Oct 25, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 7626e60e Deployed Oct 25, 2026 by vercel[bot]
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.

2 participants