PixelPrompt is a Chrome extension that lets you visually select any region of your running application, write a prompt describing what you want changed, and copies a rich, structured context bundle straight to your clipboard. Paste it into any AI assistant (ChatGPT, Claude, Copilot, Cursor, etc.) and get back a precise edit against the right files.
https://github.com/karishnu/pixel-prompt.git
Point at your UI. Describe the change. Let AI do the rest.
Editing frontend code with AI is powerful โ but describing which part of the UI you want changed is surprisingly hard. You're stuck typing things like "the card in the second row" or "the button next to the search bar" into a prompt box that has zero visual context.
PixelPrompt fixes this. It's a Chrome extension that lets you visually select any region of your running application, write a prompt describing what you want changed, and copies a rich, structured context bundle โ complete with the original source file paths and code โ straight to your clipboard. Paste it into any AI assistant (ChatGPT, Claude, Copilot, Cursor, etc.) and get back a precise edit against the right files.
PixelPrompt is available on the Chrome Web Store.
Modern frontend toolchains (Vite, webpack, esbuild, etc.) transform and bundle your source files before serving them to the browser. The code running in the DOM bears little resemblance to what you actually wrote. PixelPrompt bridges this gap using multiple resolution strategies:
PixelPrompt injects a small bridge script into the page's main world (not the isolated content-script world) so it can access framework internals that are invisible to regular extensions:
| Framework | How it finds the component |
|---|---|
| React | Walks the fiber tree via __reactFiber$ to find the nearest component, reads _debugSource / __source for file info |
| Vue | Reads __vueParentComponent and extracts __file / component name |
| Svelte | Looks for __svelte context keys and constructor names |
| Angular | Inspects __ngContext__ for component constructors |
Header) and, when available in dev mode, the exact source file path and line number.
If the framework metadata doesn't include a file path, PixelPrompt falls back to source maps:
<script> tags in the DOM and fetches each script's content.//# sourceMappingURL= comment from the bottom of each script (supports both external URLs and inline data: URIs).Header โ src/components/Header/Header.tsx).Vite serves each source file as a separate ES module in development. PixelPrompt detects Vite by looking for the @vite/client script tag, then:
/src/main.tsx).import statements to discover every module in the app.App โ src/App.tsx).?raw query parameter.When none of the above yield a result, PixelPrompt tries heuristic matching:
Header_wrapper__a1b2c โ component Header.sc-Header โ component Header.data-testid, data-cy values matched against source map file lists.data-source-file, data-source-map-url + data-generated-line / data-generated-column for manual annotation.Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
git clone <repository-url>
cd ui-select-extension
npm install
npm run build
This bundles everything into the dist/ directory using esbuild.
chrome://extensionsdist/ foldernpm run watch
Then rebuild with npm run build after making changes and reload the extension in Chrome.
npm test
Tests use Jest with jsdom and cover the core modules (overlay, popover, select mode, source map resolver, toast, utilities).
src/
โโโ background/ # Service worker โ handles extension lifecycle and messages
โโโ content/ # Content scripts โ injected into web pages
โ โโโ select-mode.ts # Core selection logic (drag, lock, copy)
โ โโโ overlay.ts # Visual backdrop and selection box
โ โโโ popover.ts # Prompt input popover UI
โ โโโ toast.ts # Copy-confirmation toast
โ โโโ page-bridge.ts # MAIN-world script for framework introspection
โ โโโ sourcemap-resolver.ts # Source map parsing and component resolution
โโโ popup/ # Extension popup (triggers select mode)
โโโ shared/ # Shared types and utilities
โโโ manifest.json # Chrome extension manifest (MV3)
This project is licensed under the MIT License. See the LICENSE file for details.