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).
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 bridge2. 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_auditInspects active DOM token violations, contrast ratios, and connected browser tabs from http://127.0.0.1:7428/api/audit.
trigger_live_rescanBroadcasts an SSE rescan command to force an immediate DOM re-audit across all connected browser tabs.
wait_for_live_cleanBlocks agent execution until zero design system violations remain in the active browser tab.
Inspector Capabilities & Tabs
The floating panel provides three specialized operational modes:
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.
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.
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:
- You wrap your app in
<ThemeProvider>at the root layout. ThemeProviderevaluatesshowDevTools = devTools ?? (NODE_ENV !== "production").- 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:
| Prop | Type | Default | Description |
|---|---|---|---|
| theme | string | — | A named THEME_PRESETS preset (e.g. "Editorial") — applies its whole config. Individual props below override it. |
| defaultTheme | "light" | "dark" | "system" | appearance | Default appearance mode when no stored theme is found. Defaults to "light". |
| accentColor | string | — | One of the Configurator's 24 named accents (e.g. "Grass"), or a literal "#rrggbb". |
| grayColor | string | — | "Zinc" | "Slate" | "Gray" | "Neutral" | "Stone" |
| radius | "none" | "small" | "medium" | "large" | "full" | — | Radius preset: "none" | "small" | "medium" | "large" | "full". |
| scaling | 90 | 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". |
| displayFont | string | — | Display font preset family string. |
| bodyFont | string | — | Body font preset family string. |
| colorSpace | ColorSpace | — | 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. |
| preloadFonts | boolean | — | 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. |
| devTools | boolean | — | Whether to render the Shavin Dev Inspector in development. Defaults to true in dev. |
| children | ReactNode | — | — |
ShavinDevTools Props
If you mount ShavinDevTools directly to override placement or force staging previews:
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Optional custom trigger class name. |
| position | "bottom-left" | "bottom-right" | "top-left" | "top-right" | floating | Default floating trigger placement on screen. Defaults to "bottom-right" (20px token offset). |
| forceShow | boolean | — | 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-rightDefault — 20px token offset from bottom-right corner
bottom-left20px token offset from bottom-left corner
top-left20px token offset from top-left corner
top-right20px 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" />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>