omgkit 2.29.0 → 2.30.0
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/README.md +24 -0
- package/bin/omgkit.js +178 -0
- package/lib/cli.js +1 -1
- package/lib/theme.js +649 -0
- package/package.json +2 -2
- package/plugin/agents/fullstack-developer.md +1 -0
- package/plugin/agents/ui-ux-designer.md +163 -54
- package/plugin/commands/design/rebuild.md +153 -0
- package/plugin/commands/design/rollback.md +179 -0
- package/plugin/commands/design/scan.md +155 -0
- package/plugin/registry.yaml +7 -3
- package/plugin/skills/frontend/design-system-context/SKILL.md +252 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scan
|
|
3
|
+
description: Scan project for non-compliant color usage that should use theme variables
|
|
4
|
+
usage: /design:scan [--fix]
|
|
5
|
+
allowed-tools: Read, Glob, Grep
|
|
6
|
+
args:
|
|
7
|
+
- name: --fix
|
|
8
|
+
required: false
|
|
9
|
+
description: Auto-fix simple violations (same as /design:rebuild)
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Design Scan
|
|
13
|
+
|
|
14
|
+
Scan project files for hardcoded colors that should use theme CSS variables instead.
|
|
15
|
+
|
|
16
|
+
## What This Command Does
|
|
17
|
+
|
|
18
|
+
1. **Scans Source Files**
|
|
19
|
+
- Scans `app/`, `components/`, `src/`, `pages/` directories
|
|
20
|
+
- Checks `.tsx`, `.jsx`, `.ts`, `.js` files
|
|
21
|
+
- Excludes `node_modules`, `.git`, `.omgkit`, `dist`, `build`, `.next`
|
|
22
|
+
|
|
23
|
+
2. **Detects Non-Compliant Patterns**
|
|
24
|
+
- Tailwind default colors (e.g., `bg-blue-500`, `text-gray-600`)
|
|
25
|
+
- Hardcoded hex colors in className (e.g., `bg-[#3B82F6]`)
|
|
26
|
+
- Inline style colors
|
|
27
|
+
|
|
28
|
+
3. **Reports Findings**
|
|
29
|
+
- Groups violations by file
|
|
30
|
+
- Shows line numbers
|
|
31
|
+
- Suggests theme variable replacements
|
|
32
|
+
|
|
33
|
+
## Detection Patterns
|
|
34
|
+
|
|
35
|
+
### Tailwind Default Colors (Auto-Fixable)
|
|
36
|
+
|
|
37
|
+
| Pattern | Example | Should Be |
|
|
38
|
+
|---------|---------|-----------|
|
|
39
|
+
| Gray scales | `bg-gray-100` | `bg-muted` |
|
|
40
|
+
| Gray text | `text-gray-600` | `text-muted-foreground` |
|
|
41
|
+
| Blue primary | `bg-blue-500` | `bg-primary` |
|
|
42
|
+
| Red destructive | `bg-red-500` | `bg-destructive` |
|
|
43
|
+
| Gray borders | `border-gray-200` | `border-border` |
|
|
44
|
+
|
|
45
|
+
### Hardcoded Colors (Manual Review)
|
|
46
|
+
|
|
47
|
+
| Pattern | Example | Action |
|
|
48
|
+
|---------|---------|--------|
|
|
49
|
+
| Hex in className | `bg-[#E11D48]` | Use CSS variable |
|
|
50
|
+
| Arbitrary colors | `text-[#333333]` | Use theme foreground |
|
|
51
|
+
| Inline styles | `style={{ color: 'red' }}` | Use theme class |
|
|
52
|
+
|
|
53
|
+
## Usage Examples
|
|
54
|
+
|
|
55
|
+
### Basic Scan
|
|
56
|
+
```bash
|
|
57
|
+
/design:scan
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Scan and Auto-Fix
|
|
61
|
+
```bash
|
|
62
|
+
/design:scan --fix
|
|
63
|
+
```
|
|
64
|
+
Note: `--fix` is equivalent to running `/design:rebuild` with current theme.
|
|
65
|
+
|
|
66
|
+
## Example Output
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
🔍 Scanning project for non-compliant colors...
|
|
70
|
+
|
|
71
|
+
Scanned 45 files
|
|
72
|
+
|
|
73
|
+
⚠ Found 12 non-compliant color references
|
|
74
|
+
|
|
75
|
+
📁 app/page.tsx
|
|
76
|
+
Line 15: bg-blue-500 → bg-primary
|
|
77
|
+
Line 23: text-gray-600 → text-muted-foreground
|
|
78
|
+
Line 45: bg-gray-50 → bg-muted
|
|
79
|
+
|
|
80
|
+
📁 components/Header.tsx
|
|
81
|
+
Line 8: border-gray-200 → border-border
|
|
82
|
+
Line 12: bg-white → bg-background
|
|
83
|
+
Line 23: text-gray-900 → text-foreground
|
|
84
|
+
|
|
85
|
+
📁 components/Card.tsx
|
|
86
|
+
Line 5: bg-[#ffffff] (manual review)
|
|
87
|
+
Line 18: hover:bg-gray-100 → hover:bg-accent
|
|
88
|
+
|
|
89
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
90
|
+
Total: 12 violations in 3 files
|
|
91
|
+
|
|
92
|
+
Run omgkit design:rebuild <theme-id> to auto-fix
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Compliance Categories
|
|
96
|
+
|
|
97
|
+
### Fully Compliant (Good)
|
|
98
|
+
```tsx
|
|
99
|
+
// Using theme variables
|
|
100
|
+
<div className="bg-background text-foreground">
|
|
101
|
+
<button className="bg-primary text-primary-foreground">
|
|
102
|
+
<span className="text-muted-foreground">
|
|
103
|
+
<div className="border-border">
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Non-Compliant (Should Fix)
|
|
107
|
+
```tsx
|
|
108
|
+
// Hardcoded Tailwind colors
|
|
109
|
+
<div className="bg-white text-gray-900"> // ❌
|
|
110
|
+
<button className="bg-blue-500 text-white"> // ❌
|
|
111
|
+
<span className="text-gray-500"> // ❌
|
|
112
|
+
<div className="border-gray-200"> // ❌
|
|
113
|
+
|
|
114
|
+
// Should be
|
|
115
|
+
<div className="bg-background text-foreground"> // ✅
|
|
116
|
+
<button className="bg-primary text-primary-foreground"> // ✅
|
|
117
|
+
<span className="text-muted-foreground"> // ✅
|
|
118
|
+
<div className="border-border"> // ✅
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Color Mapping Reference
|
|
122
|
+
|
|
123
|
+
| Hardcoded | Theme Variable | Context |
|
|
124
|
+
|-----------|---------------|---------|
|
|
125
|
+
| `bg-white` | `bg-background` | Page background |
|
|
126
|
+
| `bg-gray-50` | `bg-muted` | Subtle background |
|
|
127
|
+
| `bg-gray-100` | `bg-secondary` | Secondary background |
|
|
128
|
+
| `text-gray-900` | `text-foreground` | Primary text |
|
|
129
|
+
| `text-gray-600` | `text-muted-foreground` | Secondary text |
|
|
130
|
+
| `text-gray-500` | `text-muted-foreground` | Muted text |
|
|
131
|
+
| `border-gray-200` | `border-border` | Standard border |
|
|
132
|
+
| `border-gray-300` | `border-input` | Input border |
|
|
133
|
+
| `bg-blue-500` | `bg-primary` | Primary action |
|
|
134
|
+
| `text-blue-600` | `text-primary` | Accent text |
|
|
135
|
+
| `bg-red-500` | `bg-destructive` | Danger action |
|
|
136
|
+
| `text-red-600` | `text-destructive` | Error text |
|
|
137
|
+
| `ring-blue-500` | `ring-ring` | Focus ring |
|
|
138
|
+
|
|
139
|
+
## CLI Alternative
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
omgkit design:scan
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## After Scanning
|
|
146
|
+
|
|
147
|
+
1. **Auto-fixable issues**: Run `/design:rebuild <theme-id>` to fix
|
|
148
|
+
2. **Manual review issues**: Edit files directly to use theme variables
|
|
149
|
+
3. **Re-scan**: Run `/design:scan` again to verify all fixed
|
|
150
|
+
|
|
151
|
+
## Related Commands
|
|
152
|
+
|
|
153
|
+
- `/design:rebuild <theme-id>` - Fix issues and apply new theme
|
|
154
|
+
- `/design:themes` - List available themes
|
|
155
|
+
- `/design:preview` - Preview current theme colors
|
package/plugin/registry.yaml
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# OMGKIT Component Registry
|
|
2
2
|
# Single Source of Truth for Agents, Skills, Commands, Workflows, and MCPs
|
|
3
|
-
# Version: 2.
|
|
4
|
-
# Updated: 2026-01-
|
|
3
|
+
# Version: 2.30.0
|
|
4
|
+
# Updated: 2026-01-08
|
|
5
5
|
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.30.0"
|
|
7
7
|
|
|
8
8
|
# =============================================================================
|
|
9
9
|
# OPTIMIZED ALIGNMENT PRINCIPLE (OAP)
|
|
@@ -431,6 +431,7 @@ agents:
|
|
|
431
431
|
- frontend/accessibility
|
|
432
432
|
- frontend/responsive
|
|
433
433
|
- frontend/tailwindcss
|
|
434
|
+
- frontend/design-system-context
|
|
434
435
|
commands:
|
|
435
436
|
- /design:screenshot
|
|
436
437
|
- /design:cro
|
|
@@ -445,6 +446,9 @@ agents:
|
|
|
445
446
|
- /design:from-url
|
|
446
447
|
- /design:builder
|
|
447
448
|
- /design:reset
|
|
449
|
+
- /design:rebuild
|
|
450
|
+
- /design:scan
|
|
451
|
+
- /design:rollback
|
|
448
452
|
|
|
449
453
|
api-designer:
|
|
450
454
|
file: agents/api-designer.md
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-system-context
|
|
3
|
+
description: Automatic design system context injection for UI consistency
|
|
4
|
+
category: frontend
|
|
5
|
+
level: foundational
|
|
6
|
+
commands:
|
|
7
|
+
- /design:preview
|
|
8
|
+
- /design:themes
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Design System Context Injection
|
|
12
|
+
|
|
13
|
+
This skill ensures all UI/UX work automatically follows the project's design system without explicit user specification.
|
|
14
|
+
|
|
15
|
+
## Automatic Context Loading
|
|
16
|
+
|
|
17
|
+
**CRITICAL**: Before ANY UI/component work, you MUST:
|
|
18
|
+
|
|
19
|
+
1. Check if `.omgkit/design/theme.json` exists
|
|
20
|
+
2. If exists, read it and use its colors
|
|
21
|
+
3. If not exists, suggest running `/design:theme <id>` first
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Always check first
|
|
25
|
+
if [ -f ".omgkit/design/theme.json" ]; then
|
|
26
|
+
# Read and use theme colors
|
|
27
|
+
else
|
|
28
|
+
# Suggest: "No design system detected. Run /design:themes to select one."
|
|
29
|
+
fi
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Theme Context Structure
|
|
33
|
+
|
|
34
|
+
When theme.json exists, extract these key values:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"name": "Theme Name",
|
|
39
|
+
"id": "theme-id",
|
|
40
|
+
"colors": {
|
|
41
|
+
"light": {
|
|
42
|
+
"background": "0 0% 100%",
|
|
43
|
+
"foreground": "240 10% 3.9%",
|
|
44
|
+
"primary": "346.8 77.2% 49.8%",
|
|
45
|
+
"primary-foreground": "355.7 100% 97.3%",
|
|
46
|
+
"secondary": "240 4.8% 95.9%",
|
|
47
|
+
"muted": "240 4.8% 95.9%",
|
|
48
|
+
"accent": "240 4.8% 95.9%",
|
|
49
|
+
"destructive": "0 84.2% 60.2%",
|
|
50
|
+
"border": "240 5.9% 90%",
|
|
51
|
+
"ring": "346.8 77.2% 49.8%"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"radius": "0.5rem"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Mandatory Color Usage
|
|
59
|
+
|
|
60
|
+
**NEVER hardcode colors**. Always use CSS variables via Tailwind:
|
|
61
|
+
|
|
62
|
+
### ✅ CORRECT - Use Theme Variables
|
|
63
|
+
```tsx
|
|
64
|
+
// Backgrounds
|
|
65
|
+
<div className="bg-background"> // Main background
|
|
66
|
+
<div className="bg-card"> // Card background
|
|
67
|
+
<div className="bg-muted"> // Subtle background
|
|
68
|
+
<div className="bg-primary"> // Primary action background
|
|
69
|
+
<div className="bg-secondary"> // Secondary background
|
|
70
|
+
<div className="bg-destructive"> // Error/danger background
|
|
71
|
+
|
|
72
|
+
// Text
|
|
73
|
+
<p className="text-foreground"> // Primary text
|
|
74
|
+
<p className="text-muted-foreground"> // Secondary/subtle text
|
|
75
|
+
<p className="text-primary"> // Accent text
|
|
76
|
+
<p className="text-destructive"> // Error text
|
|
77
|
+
|
|
78
|
+
// Borders
|
|
79
|
+
<div className="border-border"> // Standard border
|
|
80
|
+
<div className="border-input"> // Input border
|
|
81
|
+
<div className="ring-ring"> // Focus ring
|
|
82
|
+
|
|
83
|
+
// Interactive states
|
|
84
|
+
<button className="bg-primary hover:bg-primary/90">
|
|
85
|
+
<button className="bg-secondary hover:bg-secondary/80">
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### ❌ WRONG - Never Hardcode
|
|
89
|
+
```tsx
|
|
90
|
+
// NEVER do this
|
|
91
|
+
<div className="bg-[#E11D48]"> // Hardcoded hex
|
|
92
|
+
<div className="bg-rose-500"> // Tailwind default color
|
|
93
|
+
<div className="text-gray-900"> // Not from theme
|
|
94
|
+
<div style={{ color: '#333' }}> // Inline style
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Component Generation Rules
|
|
98
|
+
|
|
99
|
+
When generating ANY UI component:
|
|
100
|
+
|
|
101
|
+
### 1. Button Component
|
|
102
|
+
```tsx
|
|
103
|
+
// Always use theme colors
|
|
104
|
+
<Button className="bg-primary text-primary-foreground hover:bg-primary/90">
|
|
105
|
+
Primary Action
|
|
106
|
+
</Button>
|
|
107
|
+
|
|
108
|
+
<Button variant="secondary" className="bg-secondary text-secondary-foreground">
|
|
109
|
+
Secondary
|
|
110
|
+
</Button>
|
|
111
|
+
|
|
112
|
+
<Button variant="destructive" className="bg-destructive text-destructive-foreground">
|
|
113
|
+
Delete
|
|
114
|
+
</Button>
|
|
115
|
+
|
|
116
|
+
<Button variant="outline" className="border-border bg-background hover:bg-accent">
|
|
117
|
+
Outline
|
|
118
|
+
</Button>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 2. Card Component
|
|
122
|
+
```tsx
|
|
123
|
+
<Card className="bg-card text-card-foreground border-border">
|
|
124
|
+
<CardHeader>
|
|
125
|
+
<CardTitle className="text-foreground">Title</CardTitle>
|
|
126
|
+
<CardDescription className="text-muted-foreground">Description</CardDescription>
|
|
127
|
+
</CardHeader>
|
|
128
|
+
<CardContent>
|
|
129
|
+
Content with <span className="text-primary">accent</span> color
|
|
130
|
+
</CardContent>
|
|
131
|
+
</Card>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 3. Form Component
|
|
135
|
+
```tsx
|
|
136
|
+
<form className="space-y-4">
|
|
137
|
+
<div>
|
|
138
|
+
<Label className="text-foreground">Email</Label>
|
|
139
|
+
<Input
|
|
140
|
+
className="border-input bg-background focus:ring-ring"
|
|
141
|
+
placeholder="Enter email"
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
<Button className="bg-primary text-primary-foreground">
|
|
145
|
+
Submit
|
|
146
|
+
</Button>
|
|
147
|
+
</form>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 4. Navigation Component
|
|
151
|
+
```tsx
|
|
152
|
+
<nav className="bg-background border-b border-border">
|
|
153
|
+
<div className="flex items-center gap-4">
|
|
154
|
+
<a className="text-foreground hover:text-primary">Home</a>
|
|
155
|
+
<a className="text-muted-foreground hover:text-foreground">About</a>
|
|
156
|
+
<a className="text-muted-foreground hover:text-foreground">Contact</a>
|
|
157
|
+
</div>
|
|
158
|
+
</nav>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 5. Alert/Notification
|
|
162
|
+
```tsx
|
|
163
|
+
// Success - use primary or custom success color
|
|
164
|
+
<Alert className="bg-primary/10 text-primary border-primary">
|
|
165
|
+
<CheckIcon className="text-primary" />
|
|
166
|
+
<AlertDescription>Success message</AlertDescription>
|
|
167
|
+
</Alert>
|
|
168
|
+
|
|
169
|
+
// Error - use destructive
|
|
170
|
+
<Alert className="bg-destructive/10 text-destructive border-destructive">
|
|
171
|
+
<XIcon className="text-destructive" />
|
|
172
|
+
<AlertDescription>Error message</AlertDescription>
|
|
173
|
+
</Alert>
|
|
174
|
+
|
|
175
|
+
// Info - use muted
|
|
176
|
+
<Alert className="bg-muted text-muted-foreground border-border">
|
|
177
|
+
<InfoIcon />
|
|
178
|
+
<AlertDescription>Info message</AlertDescription>
|
|
179
|
+
</Alert>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Dark Mode Handling
|
|
183
|
+
|
|
184
|
+
Theme CSS includes `.dark` class overrides. Just ensure:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
// This automatically works - colors swap in dark mode
|
|
188
|
+
<div className="bg-background text-foreground">
|
|
189
|
+
Content adapts to light/dark automatically
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
// For dark mode toggle
|
|
193
|
+
<button onClick={() => document.documentElement.classList.toggle('dark')}>
|
|
194
|
+
Toggle Dark Mode
|
|
195
|
+
</button>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Border Radius Consistency
|
|
199
|
+
|
|
200
|
+
Use theme's radius value via CSS variable:
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
// These use --radius from theme
|
|
204
|
+
<div className="rounded-lg"> // var(--radius)
|
|
205
|
+
<div className="rounded-md"> // calc(var(--radius) - 2px)
|
|
206
|
+
<div className="rounded-sm"> // calc(var(--radius) - 4px)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Pre-Task Checklist
|
|
210
|
+
|
|
211
|
+
Before generating ANY UI code, mentally check:
|
|
212
|
+
|
|
213
|
+
- [ ] Read `.omgkit/design/theme.json` if exists
|
|
214
|
+
- [ ] All colors use CSS variables (bg-primary, text-foreground, etc.)
|
|
215
|
+
- [ ] No hardcoded hex values
|
|
216
|
+
- [ ] No Tailwind default colors (gray-500, blue-600, etc.)
|
|
217
|
+
- [ ] Border radius uses theme's radius
|
|
218
|
+
- [ ] Dark mode compatible (no light-only or dark-only colors)
|
|
219
|
+
|
|
220
|
+
## Error Prevention
|
|
221
|
+
|
|
222
|
+
If you catch yourself writing:
|
|
223
|
+
- `bg-blue-500` → Change to `bg-primary`
|
|
224
|
+
- `text-gray-600` → Change to `text-muted-foreground`
|
|
225
|
+
- `border-gray-200` → Change to `border-border`
|
|
226
|
+
- `#E11D48` → Change to CSS variable reference
|
|
227
|
+
|
|
228
|
+
## Integration with shadcn/ui
|
|
229
|
+
|
|
230
|
+
shadcn/ui components automatically use CSS variables:
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
// These already use theme colors
|
|
234
|
+
import { Button } from "@/components/ui/button"
|
|
235
|
+
import { Card } from "@/components/ui/card"
|
|
236
|
+
import { Input } from "@/components/ui/input"
|
|
237
|
+
|
|
238
|
+
// Just use them - they read from theme.css
|
|
239
|
+
<Button>Uses --primary automatically</Button>
|
|
240
|
+
<Card>Uses --card automatically</Card>
|
|
241
|
+
<Input /> // Uses --input, --border, --ring automatically
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Summary
|
|
245
|
+
|
|
246
|
+
**The Golden Rule**: If you're writing a color class, it MUST be one of:
|
|
247
|
+
- `bg-{background|foreground|card|popover|primary|secondary|muted|accent|destructive|border|input|ring}`
|
|
248
|
+
- `text-{foreground|card-foreground|popover-foreground|primary-foreground|secondary-foreground|muted-foreground|accent-foreground|destructive-foreground}`
|
|
249
|
+
- `border-{border|input|ring}`
|
|
250
|
+
- Opacity variants like `bg-primary/90`, `text-muted-foreground/80`
|
|
251
|
+
|
|
252
|
+
**NO EXCEPTIONS**.
|