一键导入
moldui-sync
// Apply pending visual edits from moldui to source code. Triggers: /moldui-sync, apply my moldui changes, sync visual edits, apply canvas edits
// Apply pending visual edits from moldui to source code. Triggers: /moldui-sync, apply my moldui changes, sync visual edits, apply canvas edits
| name | moldui-sync |
| description | Apply pending visual edits from moldui to source code. Triggers: /moldui-sync, apply my moldui changes, sync visual edits, apply canvas edits |
This skill reads pending visual edit batches from .moldui/ in the current project and translates them into source code edits.
/moldui-syncmoldui and clicked SaveCheck for pending batches
ls -1 .moldui/batch-*.json 2>/dev/null
If no batches found, tell the user: "No pending moldui edits found. Run npx moldui and make some visual changes first."
Read all pending batches in chronological order (sorted by timestamp in filename). Each batch is JSON with:
timestamp: when the batch was createdframework: detected framework (e.g. nextjs, vite, vue, static)sourceHints: array of { file, confidence, reason } — likely source fileschanges: array of change descriptorsprompt: pre-built prompt describing changesFor each batch, apply changes intelligently:
For style changes (type: style):
element.classes to find the element in sourcep-6 → p-8 when padding changes from 24px to 32px)changes object: { padding: { from: "24px", to: "32px" } }For text changes (type: text):
oldText in source files (prefer files from sourceHints)newTextFor reorder changes (type: reorder):
fromParent selector or class namesfromIndex to toIndexfromParent !== toParent, move the element to a different containerFor swap changes (type: swap):
selector and swapSelectorFor clone changes (type: clone):
Use sourceHints first — these are the most likely source files. Read them first, then grep if needed.
Edit files minimally — preserve existing code style, formatting, indentation.
After applying each batch, delete it:
rm .moldui/batch-{timestamp}.json
Report to the user:
When the framework uses Tailwind CSS, translate CSS values to Tailwind classes:
| CSS | Tailwind |
|---|---|
padding: 24px | p-6 |
padding: 32px | p-8 |
margin: 16px | m-4 |
gap: 16px | gap-4 |
border-radius: 8px | rounded-lg |
border-radius: 12px | rounded-xl |
border-radius: 16px | rounded-2xl |
font-size: 16px | text-base |
font-size: 18px | text-lg |
font-size: 24px | text-2xl |
width: 100% | w-full |
Base unit = 4px. So {N}px → {N/4} (e.g., 12px → 3).
Next.js / React:
app/*/page.tsx, pages/*/index.tsx, components/*.tsxVue:
<template>, <script>, <style>Svelte:
.svelte files with <script>, HTML, and <style>Django/Rails/Laravel:
Static HTML:
<style> block or linked CSSUser: /moldui-sync
Claude: Found 1 pending batch with 3 changes.
Reading batch-1713300000000.json...
Framework: nextjs + tailwind
Source hints: src/app/page.tsx (route match)
Applied changes:
✓ src/app/page.tsx — padding p-6 → p-8 on .card (3 instances)
✓ src/app/page.tsx — text "Welcome to My App" → "Ship Faster with AI" (h1)
✓ src/app/page.tsx — reordered grid children [0,1,2] → [2,0,1]
Deleted batch file.