Shavin Dev Inspector & Agent Bridge

What is the Shavin Dev Inspector?

ShavinDevInspector (also exported as ShavinDevTools) is a floating, draggable design inspector and real-time agent bridge that auto-mounts in development when you wrap your app in ThemeProvider. It provides a live theme configurator, a real-time token discipline audit scanner, and bidirectional connection to the Agent-Browser Bridge (:7428).

Zero-config: The inspector appears automatically in development (NODE_ENV !== "production"). It is completely tree-shaken and omitted in production builds.

Real-Time Agent-Browser Bridge (:7428)

The Dev Inspector connects directly to the Shavin Bridge Daemon running on port 7428. This creates a live telemetry pipeline between your browser and AI coding assistants (Cursor, Claude, Antigravity):

1. Start the Bridge Daemon

Launch the standalone bridge daemon and dashboard monitor:

npx @shavin/cli bridge

2. Zero-Latency DOM Telemetry

Whenever your app renders, ShavinDevInspector sends live token purity scores, hardcoded CSS detection, geometry hierarchy, and contrast math to http://127.0.0.1:7428/api/audit via Server-Sent Events (SSE).

3. AI Agent Validation Tools

AI agents use these MCP tools to verify DOM compliance autonomously without screenshots or manual human verification:

get_live_audit

Inspects active DOM token violations, contrast ratios, and connected browser tabs from http://127.0.0.1:7428/api/audit.

trigger_live_rescan

Broadcasts an SSE rescan command to force an immediate DOM re-audit across all connected browser tabs.

wait_for_live_clean

Blocks agent execution until zero design system violations remain in the active browser tab.

Inspector Capabilities & Tabs

The floating panel provides three specialized operational modes:

Theme

Live theme configurator — pick accent, neutral gray, radius, scaling, panel background, display font, and body font. Changes apply instantly to your whole app via CSS variables and generates ready-to-paste ThemeProvider JSX.

Audit

Live DOM scanner that inspects your page for token discipline violations: hardcoded hex/RGB inline styles, arbitrary container radii instead of token variables, and contrast math. Click any violation to scroll to it with a highlight beacon.

Bridge & MCP

Real-time Agent-Browser Bridge (:7428) daemon connection, active AI agent sessions, and MCP tool health — enabling Cursor, Claude, and Antigravity to inspect live DOM telemetry directly.

How It Gets Injected

The injection chain is managed at the root layout:

  1. You wrap your app in <ThemeProvider> at the root layout.
  2. ThemeProvider evaluates showDevTools = devTools ?? (NODE_ENV !== "production").
  3. When active, it renders <ShavinDevTools /> alongside your children.

Running npx @shavin/cli init automatically wraps your root layout.

ThemeProvider Props

Configure default theme presets, appearance mode, and dev inspector visibility on ThemeProvider:

PropTypeDefaultDescription
themestring—A named THEME_PRESETS preset (e.g. "Editorial") — applies its whole config. Individual props below override it.
defaultTheme"light" | "dark" | "system"appearanceDefault appearance mode when no stored theme is found. Defaults to "light".
accentColorstring—One of the Configurator's 24 named accents (e.g. "Grass"), or a literal "#rrggbb".
grayColorstring—"Zinc" | "Slate" | "Gray" | "Neutral" | "Stone"
radius"none" | "small" | "medium" | "large" | "full"—Radius preset: "none" | "small" | "medium" | "large" | "full".
scaling90 | 95 | 100 | 105 | 110 | "90%" | "95%" | "100%" | "105%" | "110%"—Scaling percentage preset: 90 | 95 | 100 | 105 | 110 | "90%" | "95%" | "100%" | "105%" | "110%".
panelBackground"solid" | "translucent"—Panel background translucent vs solid mode: "solid" | "translucent".
displayFontstring—Display font preset family string.
bodyFontstring—Body font preset family string.
colorSpaceColorSpace—Color space for runtime token values. "rgb" (default) outputs bare RGB triplets for Tailwind v3 + v4-rgb paths. "oklch" outputs oklch() CSS strings for the Tailwind v4 OKLCH path (global-oklch.css + theme-v4-oklch.css). Set to "oklch" when your project imports @shavin/ui/global-oklch.css.
preloadFontsboolean—When true, preloads the complete curated Google Fonts bundle (all 30 families) on mount so every font is available for instant preview in the DevTools inspector. Recommended for dev/playground only — end users should add only the fonts they use.
devToolsboolean—Whether to render the Shavin Dev Inspector in development. Defaults to true in dev.
childrenReactNode——

ShavinDevTools Props

If you mount ShavinDevTools directly to override placement or force staging previews:

PropTypeDefaultDescription
classNamestring—Optional custom trigger class name.
position"bottom-left" | "bottom-right" | "top-left" | "top-right"floatingDefault floating trigger placement on screen. Defaults to "bottom-right" (20px token offset).
forceShowboolean—If true, forces ShavinDevTools to render even in production. By default, it is omitted in production (NODE_ENV === 'production').

Inspector Placement & Customization

The floating trigger button snaps to one of four screen corners and can be dragged across the screen:

import { ThemeProvider, ShavinDevTools } from "@shavin/ui";

// ThemeProvider mounts DevTools automatically.
// To customize placement, disable default devTools and mount ShavinDevTools explicitly:
<ThemeProvider devTools={false}>
  {children}
  <ShavinDevTools position="bottom-right" />
</ThemeProvider>
bottom-right

Default — 20px token offset from bottom-right corner

bottom-left

20px token offset from bottom-left corner

top-left

20px token offset from top-left corner

top-right

20px token offset from top-right corner

Forcing the Inspector in Staging

By default, the inspector self-guards and never renders in production (NODE_ENV === "production"). If you need it in a staging or preview deployment that runs in production mode, use the forceShow prop:

<ShavinDevTools forceShow position="bottom-right" />
Do not ship forceShow to production. Reserve it for QA and staging environments only.

Disabling the Inspector

To turn off the inspector entirely, pass devTools={false} to ThemeProvider:

<ThemeProvider devTools={false}>
  {children}
</ThemeProvider>
Learn more about theme configuration in the Theme System guide, or explore AI-assisted workflows in the MCP Setup guide.
Configure Theme
Theme
Accent Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font