@su-record/vibe 2.6.1 → 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.
@@ -1,40 +1,146 @@
1
1
  ---
2
- description: Preview UI with ASCII art
3
- argument-hint: "UI description"
2
+ description: Preview UI with Gemini image or ASCII art fallback
3
+ argument-hint: "UI description or design folder path"
4
4
  ---
5
5
 
6
6
  # /vibe.ui
7
7
 
8
- Preview UI with ASCII art.
8
+ Preview UI from description or design guide folder.
9
+
10
+ - **Gemini enabled**: Generate actual UI image
11
+ - **Gemini disabled**: ASCII art fallback
9
12
 
10
13
  ## Usage
11
14
 
12
15
  ```
13
- /vibe.ui "login page"
14
- /vibe.ui "dashboard" --layout grid
16
+ /vibe.ui "login page" # Text description
17
+ /vibe.ui "dashboard" --layout grid # With layout option
18
+ /vibe.ui ./design/ # Design guide folder
19
+ /vibe.ui ./mockups/login.html # Single HTML file
15
20
  ```
16
21
 
17
22
  ## Process
18
23
 
19
- ### 1. Analyze UI Description
24
+ ### 0. Detect Input Type
25
+
26
+ First, determine if input is:
27
+
28
+ - **Text description**: Generate UI from description
29
+ - **Folder path**: Read design files and generate UI
30
+ - **File path**: Read single file and generate UI
31
+
32
+ **Detection logic:**
33
+
34
+ ```
35
+ if (input starts with "./" or "/" or contains "/" or "\") → path
36
+ else → text description
37
+ ```
38
+
39
+ ### 1. If Folder/File Path: Read Design Files
40
+
41
+ **Supported file formats:**
42
+
43
+ | Format | Purpose | How to read |
44
+ | ------ | ------- | ----------- |
45
+ | `*.html` | HTML mockups/prototypes | Read and parse structure |
46
+ | `*.md` | Design guide documents | Read content |
47
+ | `*.json` | Design tokens, theme config | Parse JSON |
48
+ | `*.css` / `*.scss` | Style variables, colors | Extract variables |
49
+ | `*.png` / `*.jpg` / `*.webp` | UI screenshots, mockups | **Use Read tool** (multimodal) |
50
+ | `*.svg` | Icons, vector graphics | Read as XML |
51
+ | `*.figma.json` | Figma export | Parse components |
52
+
53
+ **Reading images:**
54
+
55
+ Claude can read images using the Read tool. When encountering image files:
56
+
57
+ 1. Use Read tool to view the image
58
+ 2. Analyze UI structure, colors, layout from the image
59
+ 3. Extract component hierarchy
60
+
61
+ **Folder scanning priority:**
62
+
63
+ 1. `*.html` files first (main structure)
64
+ 2. `*.png` / `*.jpg` images (visual reference)
65
+ 3. `*.json` (design tokens)
66
+ 4. `*.css` / `*.scss` (styles)
67
+ 5. `*.md` (documentation)
68
+
69
+ **Example folder structure:**
70
+
71
+ ```
72
+ design/
73
+ ├── mockup.html # Main HTML mockup
74
+ ├── screenshot.png # UI screenshot
75
+ ├── tokens.json # Design tokens
76
+ ├── variables.css # CSS variables
77
+ └── style-guide.md # Documentation
78
+ ```
79
+
80
+ ### 2. Analyze UI (from description or files)
81
+
82
+ Analyze the UI structure:
20
83
 
21
- Analyze user's requested UI description:
22
84
  - Page/component name
23
85
  - Required UI elements (buttons, inputs, cards, etc.)
24
86
  - Layout structure (header-footer, sidebar, grid, etc.)
87
+ - **Colors and typography** (from design tokens/CSS)
88
+ - **Component hierarchy** (from HTML/images)
89
+
90
+ ### 3. Check Gemini Status and Generate
91
+
92
+ **Check Gemini authentication:**
93
+
94
+ ```bash
95
+ vibe gemini status
96
+ ```
97
+
98
+ Or check config file: `~/.config/vibe/gemini.json`
99
+
100
+ #### If Gemini Enabled: Generate UI Image
101
+
102
+ Use Gemini Image API to generate actual UI mockup:
103
+
104
+ **Prompt template for Gemini:**
105
+
106
+ ```
107
+ Generate a modern UI mockup image for:
108
+
109
+ [UI Description from step 2]
110
+
111
+ Style requirements:
112
+ - Clean, modern design
113
+ - [Colors from design tokens if available]
114
+ - [Typography from style guide if available]
115
+ - Mobile-first responsive layout
116
+ - Include all specified components
117
+
118
+ Output: High-quality UI mockup image (1280x720 or similar)
119
+ ```
120
+
121
+ **Execution:**
122
+
123
+ ```bash
124
+ node hooks/scripts/generate-brand-assets.js \
125
+ --type "ui-mockup" \
126
+ --description "[analyzed UI description]" \
127
+ --colors "[extracted colors]" \
128
+ --output "./ui-preview.png"
129
+ ```
25
130
 
26
- ### 2. Generate ASCII Art
131
+ **Output location:** `./ui-preview-{timestamp}.png`
132
+
133
+ #### If Gemini Disabled: ASCII Art Fallback
27
134
 
28
135
  Generate ASCII art based on the UI description:
29
136
 
30
137
  **Input format:**
138
+
31
139
  - Page name
32
140
  - Layout type (centered, sidebar, grid, header-footer)
33
141
  - Components list (type, label, position)
34
142
 
35
- ### 3. Output ASCII Art
36
-
37
- Output generated ASCII art:
143
+ **Example ASCII output:**
38
144
 
39
145
  ```
40
146
  ┌─────────────────────────────────────────┐
@@ -61,12 +167,14 @@ Output generated ASCII art:
61
167
  Suggest list of components needed for UI:
62
168
 
63
169
  **Required Components:**
170
+
64
171
  - `Header.tsx` - Header ("Welcome")
65
172
  - `LoginForm.tsx` - Form container
66
173
  - `Input.tsx` - Reusable input field
67
174
  - `Button.tsx` - Login button
68
175
 
69
176
  **Expected File Structure:**
177
+
70
178
  ```
71
179
  src/
72
180
  ├── components/
@@ -80,12 +188,41 @@ src/
80
188
  └── LoginPage.tsx
81
189
  ```
82
190
 
83
- ## Example
191
+ ## Example (with Gemini)
192
+
193
+ ```
194
+ User: /vibe.ui ./design/dashboard/
195
+
196
+ Claude: Reading design folder...
197
+ - Found: mockup.png, tokens.json, style-guide.md
198
+
199
+ Analyzing design files...
200
+ - Layout: Sidebar + Main content
201
+ - Colors: Primary #2F6BFF, Background #F5F5F5
202
+ - Components: Header, Sidebar, 3 StatCards, Footer
203
+
204
+ Generating UI mockup with Gemini...
205
+
206
+ ✅ UI Preview generated: ./ui-preview-1706234567.png
207
+
208
+ [Image displayed]
209
+
210
+ **Component Breakdown:**
211
+ 1. Header (logo, user menu)
212
+ 2. Sidebar (navigation)
213
+ 3. StatsCard (reusable card)
214
+ 4. Footer (copyright, links)
215
+ 5. DashboardLayout (overall layout)
216
+
217
+ Next step: /vibe.spec "dashboard page"
218
+ ```
219
+
220
+ ## Example (ASCII Fallback)
84
221
 
85
222
  ```
86
223
  User: /vibe.ui "Dashboard page - header, sidebar, main content (3 cards), footer"
87
224
 
88
- Claude: Generating dashboard UI preview...
225
+ Claude: Gemini not configured. Using ASCII preview...
89
226
 
90
227
  ┌────────────────────────────────────────────────────────┐
91
228
  │ [Logo] Dashboard [User] [Logout] │
@@ -114,15 +251,17 @@ Claude: Generating dashboard UI preview...
114
251
  - Main: grid (3 columns)
115
252
  - Responsive: Changes to 1 column on mobile
116
253
 
117
- Next step:
118
- vibe spec "dashboard page"
254
+ 💡 Tip: Run `vibe gemini auth` for actual UI image generation
255
+
256
+ Next step: /vibe.spec "dashboard page"
119
257
  ```
120
258
 
121
259
  ## Notes
122
260
 
123
261
  - For complex UI, request in multiple parts
124
262
  - Layout options: `sidebar`, `header-footer`, `grid`, `centered`, `split`
125
- - ASCII art is for quick visualization before actual implementation
263
+ - Gemini generates high-quality mockups; ASCII is for quick visualization
264
+ - Design folder input extracts colors, typography, and component structure automatically
126
265
 
127
266
  ---
128
267
 
@@ -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
@@ -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
@@ -29,15 +30,78 @@ Collection of utility tools. Use with options.
29
30
 
30
31
  ## --ui (UI Preview)
31
32
 
32
- Read and follow `agents/ui-previewer.md` for ASCII UI preview generation.
33
+ Read and follow `agents/ui-previewer.md` for UI preview generation.
33
34
 
34
- Generate ASCII-based UI preview from description.
35
+ Generate UI preview from description or design folder.
36
+
37
+ - **Gemini enabled**: Actual UI mockup image
38
+ - **Gemini disabled**: ASCII art fallback
39
+
40
+ **Input types:**
41
+
42
+ | Input | Example |
43
+ | ----- | ------- |
44
+ | Text description | `"Login form with email, password"` |
45
+ | Design folder | `./design/` |
46
+ | Single file | `./mockups/login.html` |
47
+
48
+ **Supported file formats in folder:**
49
+
50
+ - `*.html` - HTML mockups
51
+ - `*.png` / `*.jpg` / `*.webp` - UI screenshots (Claude reads images)
52
+ - `*.json` - Design tokens
53
+ - `*.css` / `*.scss` - Style variables
54
+ - `*.md` - Style guides
55
+ - `*.svg` - Vector graphics
35
56
 
36
57
  **Example:**
58
+
37
59
  ```
38
60
  /vibe.utils --ui "Login form - email, password input + login button"
61
+ /vibe.utils --ui ./design/dashboard/
62
+ /vibe.utils --ui ./mockups/homepage.png
63
+ ```
64
+
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
39
96
  ```
40
97
 
98
+ **Output:**
99
+
100
+ - Diff report (design vs code)
101
+ - List of changes to apply
102
+ - Confirmation prompt
103
+ - Files modified
104
+
41
105
  ---
42
106
 
43
107
  ## --diagram (Diagram Generation)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@su-record/vibe",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "description": "Vibe - Claude Code exclusive SPEC-driven AI coding framework with 35+ integrated tools",
5
5
  "type": "module",
6
6
  "main": "dist/cli/index.js",