Option+click any element of your dev app to open its source in Claude, Cursor, VS Code, OpenCode or Codex. React, Vue, Svelte, Solid, Preact, Astro, Angular.
Hold ⌥ Option and click anything in your running app. Land on the line that drew it — in any framework, with any coding agent: Claude, Cursor, VS Code, Zed, OpenCode or Codex.
Try the demo → · Install · Frameworks · Where it opens · How it works
You see the bug on the page; your agent needs the file. claude-locator turns "the price on the second card" into src/components/ProductCard.tsx:12, opened where you and your agent work — without the React DevTools extension, and inside the built-in browsers of coding agents, which do not hand vscode:// or cursor:// links to your editor.
The name comes from where it started, the Claude desktop app. It is not tied to Claude.
file:line, or a muted no source here label when no location is availablevite build, and the click never reaches your appClaude desktop app with React? The app's preview has its own element picker: it hands Claude the component, its source location, the HTML, styles and a screenshot, with nothing to install. Use that. claude-locator is for the rest: Vue, Svelte, Solid, Preact, Astro and Angular (where the picker finds no source), other agents and editors (Cursor, VS Code, Zed, OpenCode, Codex), any browser, and opening the file itself at the line, with the component tree to move up from there.
npm install -D vite-plugin-claude-locator
// vite.config.ts
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import claudeLocator from 'vite-plugin-claude-locator'
export default defineConfig({
plugins: [react(), claudeLocator()],
})
Then pick where it opens. The default, 'claude', also needs the Claude Code plugin:
/plugin install claude-locator --marketplace scs0209/claude-locator
At the prompt of a Claude Code terminal session, the line above; answer y to add the marketplace and pick a scope (the user scope loads it in every session, the desktop app's included).
From a shell:
claude plugin install claude-locator --marketplace scs0209/claude-locator
In the desktop app, where /plugin does not run: click + next to the prompt box, then Plugins, Add marketplace with scs0209/claude-locator, then Add plugin.
| Framework | Setup | Element → line | Component tree |
|---|---|---|---|
| React 18 · 19 | Vite plugin | ✅ JSX transform | ✅ fiber chain, with where each component is defined |
| Vue 3 | Vite plugin | ✅ .vue template transform | ✅ component instances, with their files |
| Svelte 4 · 5 | Vite plugin | ✅ Svelte's own dev records | ✅ Svelte 5 component usages |
| Solid · Preact | Vite plugin | ✅ JSX transform | ✅ by file |
| Astro 5 · 7 | vite-plugin-claude-locator/astro | ✅ .astro template transform, and the islands | ✅ islands, then the .astro files around them |
| Angular 20 | standalone server + page script | ✅ the owning component's class | ✅ component hosts |
| Anything else (webpack, Next.js, …) | standalone server + page script | elements tagged by your build, or nothing | by file |
// astro.config.mjs
import { defineConfig } from 'astro/config'
import claudeLocator from 'vite-plugin-claude-locator/astro'
export default defineConfig({
integrations: [claudeLocator()],
})
The integration adds the Vite plugin in astro dev only and injects the page script. Astro 7 runs astro dev in the background: after changing the config, astro dev stop before starting again.
The Angular CLI dev server takes no Vite plugins, so the endpoint runs on its own port and the page script is loaded from your code:
npx claude-locator # http://127.0.0.1:5678, beside `ng serve`
// main.ts
import { isDevMode } from '@angular/core'
if (isDevMode()) {
import('vite-plugin-claude-locator/client').then((m) => m.startClaudeLocator())
}
Angular in development records each component class's file and line (ɵcmp.debugInfo); a click opens the class of the component that owns the element. Template lines are not recorded.
npx claude-locator --help lists the options (--open claude,editor,opencode, --editor cursor, --root, --port). It answers pages served from this machine only (localhost, 127.0.0.1).
claudeLocator({ open: ['claude', 'editor'], editor: 'cursor' })
open | Opens in | Needs |
|---|---|---|
'claude' (default) | the Claude desktop ap |
Reports from Windows and Linux
https://github.com/scs0209/claude-locator/issues/5
Labels: help wanted
Verify the editor target in VS Code, Windsurf and Zed
https://github.com/scs0209/claude-locator/issues/1
Labels: help wanted, good first issue
Thanks for looking. Bug reports from a setup we have not tried (a framework, an editor, an agent's built-in browser) are as useful as code. If something did not land on the right file and line, open an issue with your framework, editor and browser.
Looking for something to pick up? See good first issue and help wanted. Questions and ideas go to Discussions.
Node 20 or newer and pnpm (the repository pins its version through packageManager).
pnpm install
pnpm build # the sample apps use the built package
pnpm test # Vitest
pnpm typecheck
Run a sample app and Option+click around:
pnpm --filter example-react19 dev # or react18, vue, svelte, solid, preact, astro, angular, demo
Each sample picks its targets from the environment, so you can try another one without editing it:
CLAUDE_LOCATOR_OPEN=clipboard,editor CLAUDE_LOCATOR_EDITOR=code pnpm --filter example-react19 dev
The Angular sample talks to the standalone server: run node packages/vite-plugin-claude-locator/dist/cli.js in examples/angular beside pnpm --filter example-angular dev.
packages/vite-plugin-claude-locator/ the npm package
src/index.ts the Vite plugin: options, transforms, endpoint, page script
src/transform.ts JSX: data-claude-source on elements, __claudeSource on components
src/templates.ts Vue and Astro templates
src/client.ts the page script: overlay, finding the source, the tree menu
(inlined with Function#toString: no imports in it)
src/server.ts the /__claude-open endpoint
src/targets.ts where a click goes: claude, editor, opencode, clipboard, url, function
src/editor.ts editor launchers
src/opencode.ts OpenCode TUI prompt
src/standalone.ts `npx claude-locator`, for dev servers without Vite plugins
test/ Vitest tests, by module
plugin/ the Claude Code plugin (hooks module) for the Claude desktop app
examples/ sample apps per framework, and the demo site
scripts/ demo GIF and social preview rendering
The Claude Code plugin has its own tests: claude plugin test plugin. Try it from your checkout with claude --plugin-dir ./plugin.
__svelte_meta), and optionally the component chain for the tree. Look at how Vue (templates.ts, vueTree in client.ts) or Svelte (sourceFromSvelte, svelteTree) do it, add a sample app under examples/, and tests with the framework's real output.Opener in targets.ts: a function that gets { file, line, column, at }. Anything that must happen inside the click (the clipboard, opening a URL) belongs in client.ts instead.pnpm build && pnpm typecheck && pnpm test.fix: ..., feat: ..., docs: ....By contributing you agree that your contribution is licensed under the MIT License.