dx-playground cockpit: embedded UI + approval gate, runtime registry, themeable proposals, freeform screens
dx-playground cockpit: embedded UI + approval gate, runtime registry, themeable proposals, freeform screens
#1 in tonybierman/dioxus-mcp — merged 2026-05-27
Summary
Builds out the dx-playground cockpit — a wasm DSL editor + live preview that the stdio MCP server embeds and serves — and the substrate underneath it. Five threads of work:
Cockpit + human approval gate (M5–M7)
- The stdio MCP server now also serves the cockpit (UI + HTTP MCP) on
--bind(default127.0.0.1:8731) unless--no-cockpit, sharing oneArc<State>— nothing extra to run. propose_scaffold/resolve_proposal/check_proposal: submit a DSL doc as a proposal (preview/edit/approve in the cockpit) instead of writing files. Proposals persist to<root>/target/dioxus-mcp/proposals.json.- Cockpit UI: Author + Proposals modes, screen navigator, debounced dry-run preview.
String-keyed runtime registry (themes / components / layouts)
- New wasm-safe crate
dioxus-mcp-registryholding the descriptor schema + the generic-preview vocabulary (RenderNode/Slot/Behavior);RenderModel/RenderFieldmoved here (server + playground re-export the one definition). - Descriptors loaded from disk (embedded built-ins < global
~/.config/dioxus-mcp/registry/< project<root>/.dioxus-mcp/registry/), hot-reloaded on every access.get_registryMCP tool serves the merged registry to the cockpit (re-fetched on window focus). - Wired into: the component catalog, layout codegen dispatch, the cockpit theme selector, and a generic node-walker preview for runtime layouts. Built-ins unchanged (no codegen drift).
Themeable proposals
- A doc-level
theme:field flows to both the preview (--p-*CSS vars, overridable per-review) and generated code (assets/theme.csstoken block + baseline rules).
freeform screen kind (greenfield non-CRUD apps)
- The escape hatch for UIs the closed CRUD template set can't express (markdown editor, dashboard, canvas): with
template.bodyset it splices the full component body into a#[component]; with none it emits a titled shell. Preview shows a static shell so it stays in the navigator. - Spec + tool-description guidance steers the agent to
freeformfor non-CRUD requests, and documents that freeform bodies are prelude-only — usedocument::evalfor browser capabilities (file save/clipboard), not native crates.
Packaging
scripts/build-ui.shbakes the built cockpit intocrates/dioxus-mcp/ui-dist/so the bare-registered MCP serves the real UI viainclude_dir!.
Test plan
cargo test -p dioxus-mcp— 453 lib tests pass (codegen byte-for-byte stable; new freeform + registry + theme tests).cd playground && cargo check --target wasm32-unknown-unknownclean.- End-to-end: scaffolded a working markdown editor via
propose_scaffold+kind: freeform; verified the embedded cockpit serves the real UI and the approval round-trip writes files. Manual prompts inTODO_TEST_PROMPT.md(untracked).
🤖 Generated with Claude Code
Last updated 2026-05-28
Links to this note
Credits
Merged pull requests, newest first.