Skip to content

feat: make RFC 0001 captureStyles reachable from every plugin surface - #60

Open
Narrator wants to merge 1 commit into
mainfrom
claude/domscribe-project-status-ejkwmw
Open

feat: make RFC 0001 captureStyles reachable from every plugin surface#60
Narrator wants to merge 1 commit into
mainfrom
claude/domscribe-project-status-ejkwmw

Conversation

@Narrator

Copy link
Copy Markdown
Member

Closes the RFC 0001 configuration gap: style capture landed wired through the middle of the stack (transform extraction, runtime StyleCapturer, relay/MCP surface) but was unreachable from any supported plugin config. The React/Vue build plugins silently dropped captureStyles, styleOptions, and serialization from the generated runtime init, and the Next/Nuxt option surfaces didn't expose the flag at all — the only way to enable RFC 0001 was hand-rolling RuntimeManager.initialize().

What this adds

One top-level captureStyles flag now drives both tiers on every surface — build-time styleSource attribution in the manifest and runtime componentStyles snapshots — with runtime.captureStyles as an independent per-tier override:

// vite.config.ts
domscribe({ overlay: true, captureStyles: true })

// next.config.js
withDomscribe({ overlay: true, captureStyles: true })({})

// nuxt.config.ts
domscribe: { overlay: true, captureStyles: true }

Changes by package

  • @domscribe/react + @domscribe/vue (Vite) — the virtual init module now embeds the full serializable runtime options (serialization, captureStyles, styleOptions) as one JSON spread instead of a cherry-picked field list, so future runtime options flow through automatically. New top-level captureStyles on the plugin options (also feeds the base transform plugin's build tier).
  • @domscribe/react + @domscribe/vue (Webpack) — the __DOMSCRIBE_RUNTIME_OPTIONS__ DefinePlugin global gains the same fields; the existing auto-init modules already spread them.
  • @domscribe/transform (Turbopack loader) — new runtime option (loosely typed; the loader can't depend on @domscribe/runtime per module boundaries) emitted as window.__DOMSCRIBE_RUNTIME_OPTIONS__ in the client preamble, only when configured.
  • @domscribe/nextcaptureStyles + runtime: DomscribeRuntimeOptions on DomscribeNextOptions, threaded through both the Turbopack and Webpack loader paths; auto-init reads the preamble global and spreads it into initialize().
  • @domscribe/nuxt — same two options on the module; runtime options injected via the head-script global (only when configured, preserving the no-script-when-nothing-to-say behavior); the client plugin reads and spreads them. Webpack fallback path passes captureStyles to the base plugin.
  • READMEs — style-capture sections added for all four packages.

Why now

This makes the verify_after_edit MCP tools (#58) fully usable from plugin config: with captureStyles on, verification returns per-property computed-style deltas instead of geometry-only change detection.

Testing

  • nx run-many -t lint test build typecheck green for all 15 projects
  • Updated generated-init/DefinePlugin assertions to the new JSON format; new cases covering the top-level flag, the runtime.captureStyles override, serialization/styleOptions passthrough, the Turbopack runtime global (present and absent), the Nuxt head-script global, and both auto-init spreads

🤖 Generated with Claude Code

https://claude.ai/code/session_01QdBkwcY2Wx1KSCgPWV5xtS


Generated by Claude Code

The style-capture feature landed wired through the middle of the stack
but unreachable from any supported config surface: the react/vue build
plugins silently dropped captureStyles, styleOptions, and serialization
from the generated runtime init, and the next/nuxt option surfaces did
not expose the flag at all. Users could only enable RFC 0001 by
hand-rolling RuntimeManager.initialize().

One top-level `captureStyles` flag now drives both tiers everywhere —
build-time styleSource attribution (transform) and runtime
componentStyles snapshots — with `runtime.captureStyles` as a per-tier
override:

- @domscribe/react + @domscribe/vue (vite): generated init embeds the
  full serializable runtime options (serialization, captureStyles,
  styleOptions) instead of a cherry-picked subset
- @domscribe/react + @domscribe/vue (webpack): DefinePlugin runtime
  globals gain the same fields; auto-init already spreads them
- @domscribe/transform (turbopack loader): new `runtime` option
  emitted as window.__DOMSCRIBE_RUNTIME_OPTIONS__ in the preamble
- @domscribe/next: captureStyles + runtime options on
  DomscribeNextOptions, threaded through both bundler paths; auto-init
  reads the preamble global
- @domscribe/nuxt: captureStyles + runtime options on the module,
  injected via head-script global; client plugin reads it

This also makes the verify_after_edit MCP tools (RFC 0002) fully
usable from a plugin config: with captureStyles on, verification
returns per-property style deltas instead of geometry-only checks.

READMEs updated for all four packages.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QdBkwcY2Wx1KSCgPWV5xtS
@nx-cloud

nx-cloud Bot commented Jul 29, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 8c1cfc8

Command Status Duration Result
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 16s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 43s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 42s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 21s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 9s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 17s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 37s View ↗
nx run domscribe-test-fixtures:integration--vit... ✅ Succeeded 34s View ↗
Additional runs (18) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-29 14:43:46 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants