@websolutespa/bom-pilot
v0.1.7
Published
Development-only overlay: select React components in the running app and prompt Claude Code or GitHub Copilot to change them.
Maintainers
Keywords
Readme
bom-pilot
A development-only overlay for React apps. Hover any component in the running app, click it, and describe the change. bom-pilot resolves the element to its source (file:line, the owner components including Server Components, and the BOM CMS block). It can also attach a screenshot, then sends everything to a coding agent:
| Agent | Where it runs | Reply |
| --- | --- | --- |
| Claude Code | Locally through the Claude Agent SDK, with your project settings, CLAUDE.md and skills | Streams in the panel: tool calls, diffs, permission prompts, stop. Continue in VS Code opens the same session in the Claude Code extension. |
| Copilot · VS Code | code chat --mode agent in the last active VS Code window, with the source files and screenshot attached | In VS Code (Copilot Chat) |
| Claude Code · VS Code | Opens a Claude Code tab with the prompt pre-filled; press Enter there | In VS Code |
| Copilot CLI | copilot -p in the project root, when GitHub Copilot CLI is installed | Streams in the panel |
Usage
Add the provider once, inside <body> of the root layout. It is a React Server Component:
import { BomPilot } from '@websolutespa/bom-pilot';
<body>
<BomPilot>{children}</BomPilot>
</body>In any environment other than NODE_ENV=development, the provider renders only children, and the overlay code is dropped from the bundle.
Next.js setup:
// next.config.ts
serverExternalPackages: ['@anthropic-ai/claude-agent-sdk'],Add .bom-pilot/ to .gitignore. Screenshots and long prompts are written there.
Props:
enabledport(defaultBOM_PILOT_PORTor 4597)root(defaultprocess.cwd())agents(restricts the picker)shortcut(defaultAlt+Shift+P)bomContext(defaulttrue): adds the CMS block, market and locale to selections. Set it tofalsein Next.js apps outside the BOM stack.
Requirements: Next.js (App Router, React 19) is required. BOM is not.
Controls
- Alt+Shift+P or the crosshair button toggles select mode.
- Click selects an element. Shift+Click adds more elements.
- ↑ / ↓ or Alt+wheel moves to the parent or child element.
- ← / → (or Shift/Ctrl + ↑ / ↓) moves to the previous or next sibling.
- Enter selects the highlighted element (Shift+Enter adds it to the selection) and opens the prompt. Esc cancels.
- Drag the Pilot pill by its body to move it out of the way. The position is remembered; double-click the pill to reset it.
- Click a context chip to open that file and line in VS Code.
- In the composer, Enter sends and Shift+Enter inserts a new line. For Claude Code you can pick the permission mode (edit automatically, ask before edits, plan) and the model.
Requirements
- Claude Code:
@anthropic-ai/claude-agent-sdkinstalled, and Claude Code logged in on this machine (claude→/login), orANTHROPIC_API_KEYset. - Copilot · VS Code: the
codeCLI on PATH (in VS Code run Shell Command: Install 'code' command in PATH) and GitHub Copilot Chat enabled. - Claude Code · VS Code: the Claude Code VS Code extension.
- Copilot CLI:
copiloton PATH.
Architecture
index.tsx "." BomPilot (RSC): starts the sidecar in dev, renders the client overlay
server/ "./server" startSidecar / ensureSidecar: node:http on 127.0.0.1, SSE + JSON, agent runners
client/ "./client" BomPilotClient: Shadow-DOM overlay (picker, composer, chat panel)
shared/ "./shared" protocol types and zod schemas, constants- Source resolution: React 19 has no
_debugSource. The picker walks_debugOwner(client fibers and Server Component infos) through bippy, reads each_debugStack, and symbolicates the frames:- Browser frames are mapped from the chunk source maps in the browser.
- Server Component frames go through the Next dev endpoint
/__nextjs_original-stack-frames. Under Turbopack that endpoint rejectshttp://chunk URLs, so it handles only server frames. - When a frame still cannot be resolved, the sidecar searches the sources for the component's declaration. It ranks JSX files and functions above same-named objects such as Payload block schemas.
- Isolation: the UI lives in a Shadow DOM with its own hand-authored stylesheet (
client/styles.ts). Site CSS cannot leak in and plugin CSS cannot leak out. - Security:
- The sidecar listens on 127.0.0.1 only.
- Every call needs a random per-process token.
- Browser calls are accepted only from localhost origins.
- The sidecar refuses to start in production.
- Agents are spawned without a shell.
- Developing bom-pilot itself: see the repository README. the sidecar is a per-process singleton that survives HMR, so restart the dev server after changing
server/code. Client changes hot-reload.__BOM_PILOT__.store.get()in the browser console shows the overlay state.
Not yet supported
- Pushing prompts into an already running
claudeCLI session (Claude Code channels, research preview).
