@su-record/vibe 2.6.2 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/ui-syncer.md +259 -0
- package/commands/vibe.utils.md +41 -0
- package/package.json +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Sync UI code with design files
|
|
3
|
+
argument-hint: "design folder path"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /vibe.ui-sync
|
|
7
|
+
|
|
8
|
+
Analyze design files and update existing UI code to match.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
/vibe.utils --ui-sync ./design/ui/
|
|
14
|
+
/vibe.utils --ui-sync ./mockups/
|
|
15
|
+
/vibe.utils --ui-sync ./design/homepage.html
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
### 1. Read ALL Design Files
|
|
21
|
+
|
|
22
|
+
**MANDATORY: Read every file in the design folder.**
|
|
23
|
+
|
|
24
|
+
Scan folder and read ALL supported files:
|
|
25
|
+
|
|
26
|
+
| Format | What to Extract |
|
|
27
|
+
| ------ | --------------- |
|
|
28
|
+
| `*.html` | Structure, components, layout, classes |
|
|
29
|
+
| `*.png` / `*.jpg` / `*.webp` | Visual layout, colors, spacing, typography |
|
|
30
|
+
| `*.json` | Design tokens, theme config, component props |
|
|
31
|
+
| `*.css` / `*.scss` | Variables, colors, spacing, typography |
|
|
32
|
+
| `*.md` | Design guidelines, component specs |
|
|
33
|
+
| `*.svg` | Icons, vector assets |
|
|
34
|
+
|
|
35
|
+
**Reading order:**
|
|
36
|
+
|
|
37
|
+
1. `*.md` files first (design specs/guidelines)
|
|
38
|
+
2. `*.html` files (structure reference)
|
|
39
|
+
3. `*.png` / `*.jpg` images (visual reference - use Read tool)
|
|
40
|
+
4. `*.json` (design tokens)
|
|
41
|
+
5. `*.css` / `*.scss` (styles)
|
|
42
|
+
|
|
43
|
+
**CRITICAL:** Do NOT skip any file. Read images with the Read tool.
|
|
44
|
+
|
|
45
|
+
### 2. Analyze Design Intent
|
|
46
|
+
|
|
47
|
+
From all design files, extract:
|
|
48
|
+
|
|
49
|
+
**Layout:**
|
|
50
|
+
- Page structure (header, sidebar, main, footer)
|
|
51
|
+
- Grid system (columns, gaps)
|
|
52
|
+
- Responsive breakpoints
|
|
53
|
+
|
|
54
|
+
**Components:**
|
|
55
|
+
- Component hierarchy
|
|
56
|
+
- Component names and types
|
|
57
|
+
- Props and variants
|
|
58
|
+
|
|
59
|
+
**Styling:**
|
|
60
|
+
- Color palette (primary, secondary, accent, background, text)
|
|
61
|
+
- Typography (font family, sizes, weights)
|
|
62
|
+
- Spacing system (padding, margin, gaps)
|
|
63
|
+
- Border radius, shadows
|
|
64
|
+
- Dark/light theme support
|
|
65
|
+
|
|
66
|
+
**Interactions:**
|
|
67
|
+
- Button states (hover, active, disabled)
|
|
68
|
+
- Form validation styles
|
|
69
|
+
- Animations/transitions
|
|
70
|
+
|
|
71
|
+
### 3. Find Existing UI Code
|
|
72
|
+
|
|
73
|
+
Search for existing UI implementation:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
src/components/
|
|
77
|
+
src/pages/
|
|
78
|
+
src/views/
|
|
79
|
+
src/ui/
|
|
80
|
+
app/components/
|
|
81
|
+
app/(routes)/
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Detect framework:
|
|
85
|
+
- React: `*.tsx`, `*.jsx`
|
|
86
|
+
- Vue: `*.vue`
|
|
87
|
+
- Svelte: `*.svelte`
|
|
88
|
+
- Angular: `*.component.ts`
|
|
89
|
+
|
|
90
|
+
### 4. Compare Design vs Code
|
|
91
|
+
|
|
92
|
+
Create a diff report:
|
|
93
|
+
|
|
94
|
+
| Aspect | Design | Current Code | Action |
|
|
95
|
+
| ------ | ------ | ------------ | ------ |
|
|
96
|
+
| Colors | #2F6BFF | #3B82F6 | Update |
|
|
97
|
+
| Font | Inter | system-ui | Update |
|
|
98
|
+
| Border radius | 12px | 8px | Update |
|
|
99
|
+
| Component X | Exists | Missing | Create |
|
|
100
|
+
|
|
101
|
+
### 5. Generate Update Plan
|
|
102
|
+
|
|
103
|
+
List all changes needed:
|
|
104
|
+
|
|
105
|
+
**Style Updates:**
|
|
106
|
+
```css
|
|
107
|
+
/* Before */
|
|
108
|
+
--primary: #3B82F6;
|
|
109
|
+
--radius: 8px;
|
|
110
|
+
|
|
111
|
+
/* After */
|
|
112
|
+
--primary: #2F6BFF;
|
|
113
|
+
--radius: 12px;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Component Updates:**
|
|
117
|
+
```tsx
|
|
118
|
+
// Before: Missing hover state
|
|
119
|
+
<Button>Click</Button>
|
|
120
|
+
|
|
121
|
+
// After: Add hover state from design
|
|
122
|
+
<Button className="hover:bg-primary-600">Click</Button>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**New Components:**
|
|
126
|
+
- List components that exist in design but not in code
|
|
127
|
+
|
|
128
|
+
### 6. Execute Updates
|
|
129
|
+
|
|
130
|
+
**Ask user before making changes:**
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
Found 12 differences between design and code:
|
|
134
|
+
- 3 color updates
|
|
135
|
+
- 2 spacing changes
|
|
136
|
+
- 1 new component
|
|
137
|
+
- 6 style adjustments
|
|
138
|
+
|
|
139
|
+
Proceed with updates? [Y/n]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Apply changes:**
|
|
143
|
+
|
|
144
|
+
1. Update CSS/SCSS variables
|
|
145
|
+
2. Update Tailwind config (if applicable)
|
|
146
|
+
3. Update component styles
|
|
147
|
+
4. Create new components (if needed)
|
|
148
|
+
5. Update imports
|
|
149
|
+
|
|
150
|
+
### 7. Verify Changes
|
|
151
|
+
|
|
152
|
+
After updates:
|
|
153
|
+
|
|
154
|
+
1. Run build to check for errors
|
|
155
|
+
2. Show before/after comparison
|
|
156
|
+
3. List all files modified
|
|
157
|
+
|
|
158
|
+
## Output Format
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
📂 Design Analysis: ./design/ui/
|
|
162
|
+
|
|
163
|
+
Files Read:
|
|
164
|
+
✓ homepage.html (structure)
|
|
165
|
+
✓ homepage.png (visual)
|
|
166
|
+
✓ tokens.json (design tokens)
|
|
167
|
+
✓ styles.css (variables)
|
|
168
|
+
|
|
169
|
+
Design Specs Extracted:
|
|
170
|
+
Colors: #2F6BFF (primary), #1E293B (text), #F8FAFC (bg)
|
|
171
|
+
Typography: Inter, 14px base, 1.5 line-height
|
|
172
|
+
Spacing: 4px base unit
|
|
173
|
+
Border Radius: 12px (cards), 8px (buttons)
|
|
174
|
+
|
|
175
|
+
Differences Found: 8
|
|
176
|
+
|
|
177
|
+
| File | Change | Status |
|
|
178
|
+
|------|--------|--------|
|
|
179
|
+
| tailwind.config.js | Update primary color | ⏳ Pending |
|
|
180
|
+
| src/components/Button.tsx | Add hover state | ⏳ Pending |
|
|
181
|
+
| src/styles/globals.css | Update CSS variables | ⏳ Pending |
|
|
182
|
+
|
|
183
|
+
Apply changes? [Y/n]
|
|
184
|
+
|
|
185
|
+
✅ Updated 3 files
|
|
186
|
+
- tailwind.config.js
|
|
187
|
+
- src/components/Button.tsx
|
|
188
|
+
- src/styles/globals.css
|
|
189
|
+
|
|
190
|
+
Next: Run `npm run build` to verify
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Example
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
User: /vibe.utils --ui-sync ./design/dashboard/
|
|
197
|
+
|
|
198
|
+
Claude: Reading design folder...
|
|
199
|
+
|
|
200
|
+
📂 Files found:
|
|
201
|
+
- dashboard.html
|
|
202
|
+
- dashboard-dark.png
|
|
203
|
+
- dashboard-light.png
|
|
204
|
+
- tokens.json
|
|
205
|
+
- components.md
|
|
206
|
+
|
|
207
|
+
Reading dashboard.html...
|
|
208
|
+
[Extracts: header, sidebar, 3-column grid, card components]
|
|
209
|
+
|
|
210
|
+
Reading dashboard-dark.png...
|
|
211
|
+
[Analyzes: dark theme colors, spacing, typography]
|
|
212
|
+
|
|
213
|
+
Reading tokens.json...
|
|
214
|
+
[Extracts: color palette, spacing scale, typography scale]
|
|
215
|
+
|
|
216
|
+
📊 Design Analysis Complete:
|
|
217
|
+
|
|
218
|
+
Layout: Header + Sidebar + 3-column main
|
|
219
|
+
Theme: Dark (#0F172A bg, #F8FAFC text)
|
|
220
|
+
Components: Header, Sidebar, StatCard, DataTable
|
|
221
|
+
|
|
222
|
+
🔍 Comparing with existing code...
|
|
223
|
+
|
|
224
|
+
Found: src/pages/Dashboard.tsx
|
|
225
|
+
Found: src/components/StatCard.tsx
|
|
226
|
+
Missing: src/components/DataTable.tsx
|
|
227
|
+
|
|
228
|
+
Differences:
|
|
229
|
+
1. StatCard border-radius: design=16px, code=8px
|
|
230
|
+
2. Sidebar width: design=240px, code=200px
|
|
231
|
+
3. Header height: design=64px, code=56px
|
|
232
|
+
4. Primary color: design=#6366F1, code=#3B82F6
|
|
233
|
+
5. DataTable component: missing
|
|
234
|
+
|
|
235
|
+
Apply 4 updates + create 1 component? [Y/n]
|
|
236
|
+
|
|
237
|
+
User: Y
|
|
238
|
+
|
|
239
|
+
✅ Changes applied:
|
|
240
|
+
- src/components/StatCard.tsx (border-radius)
|
|
241
|
+
- src/components/Sidebar.tsx (width)
|
|
242
|
+
- src/components/Header.tsx (height)
|
|
243
|
+
- tailwind.config.js (primary color)
|
|
244
|
+
- src/components/DataTable.tsx (created)
|
|
245
|
+
|
|
246
|
+
Run `npm run dev` to preview changes.
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Notes
|
|
250
|
+
|
|
251
|
+
- Always read ALL files including images
|
|
252
|
+
- Ask for confirmation before making changes
|
|
253
|
+
- Preserve existing functionality while updating styles
|
|
254
|
+
- Create backup recommendation for large changes
|
|
255
|
+
- Support both CSS-in-JS and traditional CSS
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
ARGUMENTS: $ARGUMENTS
|
package/commands/vibe.utils.md
CHANGED
|
@@ -11,6 +11,7 @@ Collection of utility tools. Use with options.
|
|
|
11
11
|
|
|
12
12
|
```
|
|
13
13
|
/vibe.utils --ui "description" # UI ASCII preview
|
|
14
|
+
/vibe.utils --ui-sync ./design/ # Sync UI code with design files
|
|
14
15
|
/vibe.utils --diagram # Architecture diagram
|
|
15
16
|
/vibe.utils --diagram --er # ERD diagram
|
|
16
17
|
/vibe.utils --diagram --flow # Flowchart
|
|
@@ -63,6 +64,46 @@ Generate UI preview from description or design folder.
|
|
|
63
64
|
|
|
64
65
|
---
|
|
65
66
|
|
|
67
|
+
## --ui-sync (Design to Code Sync)
|
|
68
|
+
|
|
69
|
+
Read and follow `agents/ui-syncer.md` for design-to-code synchronization.
|
|
70
|
+
|
|
71
|
+
Analyze design files (HTML, images, CSS, tokens) and update existing UI code to match.
|
|
72
|
+
|
|
73
|
+
**What it does:**
|
|
74
|
+
|
|
75
|
+
1. Read ALL design files (including images)
|
|
76
|
+
2. Extract design specs (colors, typography, spacing, components)
|
|
77
|
+
3. Compare with existing code
|
|
78
|
+
4. Generate update plan
|
|
79
|
+
5. Apply changes (with confirmation)
|
|
80
|
+
|
|
81
|
+
**Supported file formats:**
|
|
82
|
+
|
|
83
|
+
- `*.html` - Structure, layout, classes
|
|
84
|
+
- `*.png` / `*.jpg` / `*.webp` - Visual reference (Claude reads images)
|
|
85
|
+
- `*.json` - Design tokens, theme config
|
|
86
|
+
- `*.css` / `*.scss` - Variables, colors, spacing
|
|
87
|
+
- `*.md` - Design guidelines
|
|
88
|
+
- `*.svg` - Icons, vectors
|
|
89
|
+
|
|
90
|
+
**Example:**
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
/vibe.utils --ui-sync ./design/ui/
|
|
94
|
+
/vibe.utils --ui-sync ./mockups/dashboard/
|
|
95
|
+
/vibe.utils --ui-sync ./design/homepage.html
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Output:**
|
|
99
|
+
|
|
100
|
+
- Diff report (design vs code)
|
|
101
|
+
- List of changes to apply
|
|
102
|
+
- Confirmation prompt
|
|
103
|
+
- Files modified
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
66
107
|
## --diagram (Diagram Generation)
|
|
67
108
|
|
|
68
109
|
Read and follow `agents/diagrammer.md` for diagram generation.
|