@su-record/vibe 2.6.1 → 2.6.2
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-previewer.md +155 -16
- package/commands/vibe.utils.md +25 -2
- package/package.json +1 -1
package/agents/ui-previewer.md
CHANGED
|
@@ -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
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
118
|
-
|
|
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
|
|
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
|
|
package/commands/vibe.utils.md
CHANGED
|
@@ -29,13 +29,36 @@ Collection of utility tools. Use with options.
|
|
|
29
29
|
|
|
30
30
|
## --ui (UI Preview)
|
|
31
31
|
|
|
32
|
-
Read and follow `agents/ui-previewer.md` for
|
|
32
|
+
Read and follow `agents/ui-previewer.md` for UI preview generation.
|
|
33
33
|
|
|
34
|
-
Generate
|
|
34
|
+
Generate UI preview from description or design folder.
|
|
35
|
+
|
|
36
|
+
- **Gemini enabled**: Actual UI mockup image
|
|
37
|
+
- **Gemini disabled**: ASCII art fallback
|
|
38
|
+
|
|
39
|
+
**Input types:**
|
|
40
|
+
|
|
41
|
+
| Input | Example |
|
|
42
|
+
| ----- | ------- |
|
|
43
|
+
| Text description | `"Login form with email, password"` |
|
|
44
|
+
| Design folder | `./design/` |
|
|
45
|
+
| Single file | `./mockups/login.html` |
|
|
46
|
+
|
|
47
|
+
**Supported file formats in folder:**
|
|
48
|
+
|
|
49
|
+
- `*.html` - HTML mockups
|
|
50
|
+
- `*.png` / `*.jpg` / `*.webp` - UI screenshots (Claude reads images)
|
|
51
|
+
- `*.json` - Design tokens
|
|
52
|
+
- `*.css` / `*.scss` - Style variables
|
|
53
|
+
- `*.md` - Style guides
|
|
54
|
+
- `*.svg` - Vector graphics
|
|
35
55
|
|
|
36
56
|
**Example:**
|
|
57
|
+
|
|
37
58
|
```
|
|
38
59
|
/vibe.utils --ui "Login form - email, password input + login button"
|
|
60
|
+
/vibe.utils --ui ./design/dashboard/
|
|
61
|
+
/vibe.utils --ui ./mockups/homepage.png
|
|
39
62
|
```
|
|
40
63
|
|
|
41
64
|
---
|