Browser Code Inspector
Provide the code-inspector-plugin interaction: the user selects an element in
the visible browser, and the development runtime opens the corresponding local
component in Cursor. This is a setup and troubleshooting skill, not a resident
browser listener. The browser overlay and IDE launch are performed by the
configured build plugin.
Required Interaction Model
- Do not ask the user to paste an element, selector, screenshot, or error when the requested workflow is click-to-source.
- Configure the project first. Then tell the user to use the browser overlay:
hold
Option + Shifton macOS orAlt + Shifton Windows, hover the target, and click once. - Treat an exact file, line, and column as available only when the development build exposes code-inspector metadata. A production DOM without that metadata cannot reliably provide the original component location.
- Keep the plugin development-only. Do not add it to production bundles or claim that it works after a production build unless the project explicitly preserves the required metadata.
Setup Workflow
- Inspect
package.json, the package manager lockfile, and the build config. Use scripts/detect-project.mjs when a compact framework/bundler summary is useful. - Check the project Node runtime before installing anything. Inspect
.nvmrc,.node-version,package.json#volta.node, andpackage.json#engines.node, then compare them withnode --versionandnpm --version. If the runtime is outside the declared range or declarations conflict, stop and ask the user to activate the project's existing version manager configuration first. A minimum-only declaration such as>=8.9is not proof that a legacy Vue CLI/Webpack dependency tree supports the current Node version. - Choose the package manager from the existing lockfile. Add
code-inspector-pluginas a development dependency. After install, confirm packages already declared inpackage.jsonstill resolve. Ifsass-loaderfails withCannot find module 'node-sass', restore declaredsass; do not installnode-sassunless the project already used it. - Read references/code-inspector-plugin.md
and add exactly one Cursor-targeted registration for the detected bundler.
On macOS that includes
launchType: 'open'. Do not leave macOS on defaultexec. - Set
CODE_EDITOR=cursorin uncommitted.env.local. A trackedEDITOR=codedoes not replaceeditor: 'cursor'. - Start the existing development workflow. Plugin option changes require a full restart. Do not run a build or type check unless the user requests it.
- Tell the user only the browser action. Cursor should open the local file quickly at the reported source position.
Do not automatically install, upgrade, downgrade, or switch Node. Do not create
or modify .nvmrc, .node-version, Volta settings, or other runtime manager
files unless the user explicitly asks for that change. When a switch is needed,
show the command appropriate to the detected project, such as nvm use or
fnm use, and wait for the project to be run under that environment.
Current Project Pattern
For a Vue CLI/Webpack project, use the chainWebpack registration documented in
the reference. Preserve existing vue.config.js plugins and avoid duplicate
code-inspector-plugin registrations. For Vite, add the plugin to the existing
plugins array and preserve the current defineConfig shape.
Verification
Verify the setup in this order:
- The development page loads without a plugin initialization error.
- Holding the platform shortcut produces the inspector overlay and source hint while hovering a rendered component.
- Clicking the component opens Cursor, rather than only opening DevTools.
- Cursor opens a local file in the current workspace within about 300ms. A delay of a second or more is a launch-type failure, even if the file eventually opens.
Before plugin installation, record the Node runtime check as match,
mismatch, or unknown. A match from a minimum-only engine declaration
still needs a compatibility warning for old dependency trees.
If the overlay appears but Cursor does not open, or opens slowly, read
references/ide-launch.md. Use
scripts/open-cursor-location.sh only when a
file, line, and column are known and the editor still does not open. If
the overlay does not appear, inspect the dev server bundle before searching
the DOM.
Fallback Boundary
When the page was not built with source metadata, read references/fallback-source-search.md. Search can identify a likely component, but it is not equivalent to the plugin's exact click-to-source behavior. Report candidate files and confidence instead of silently opening an arbitrary match.