@rayburst/cc 3.2.6 → 3.4.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/.claude-plugin/plugin.json +1 -1
- package/hooks/sessionstart.mjs +3 -2
- package/package.json +1 -1
- package/server.bundle.mjs +17 -17
- package/skills/design-tokens/SKILL.md +131 -0
- package/skills/designs/SKILL.md +138 -0
- package/skills/review/SKILL.md +20 -2
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rb:extract-tokens
|
|
3
|
+
description: |
|
|
4
|
+
Analyze all designs across the organization's feature atlas, discover repeating CSS values,
|
|
5
|
+
and propose centralized design tokens. Creates approved tokens and auto-links them to designs.
|
|
6
|
+
Triggers: "extract tokens", "rb extract tokens", "discover tokens", "find design tokens", "tokenize designs".
|
|
7
|
+
user-invocable: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# rb:extract-tokens — Extract Design Tokens from Existing Designs
|
|
11
|
+
|
|
12
|
+
Scans all feature designs in the organization, identifies repeating CSS values (colors, spacing,
|
|
13
|
+
typography, etc.), and proposes them as centralized design tokens. Approved tokens are created
|
|
14
|
+
and linked to the designs that use them.
|
|
15
|
+
|
|
16
|
+
## MCP Tool Prefix
|
|
17
|
+
|
|
18
|
+
All MCP tools use: `mcp__plugin_rayburst_rayburst__`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## CRITICAL RULES
|
|
23
|
+
|
|
24
|
+
1. **Never create tokens without user approval** — always present the full list of suggestions and wait for the user to confirm which ones to create.
|
|
25
|
+
2. **Minimum threshold: 2+ usages** — only propose values that appear in at least 2 different designs.
|
|
26
|
+
3. **Don't duplicate existing tokens** — always check `rb_list_design_tokens` first and skip values that already have a centralized token.
|
|
27
|
+
4. **Auto-categorize accurately** — use the regex rules in Step 3 to assign the correct category.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Workflow
|
|
32
|
+
|
|
33
|
+
### Step 1: Gather all designs
|
|
34
|
+
|
|
35
|
+
1. Call `rb_list_features` with a broad search (empty string) to get all features.
|
|
36
|
+
2. For each feature, call `rb_list_designs` to get design metadata.
|
|
37
|
+
3. For each design that has `toonContent`, call `rb_get_design` to fetch the full design data.
|
|
38
|
+
4. Also call `rb_list_design_tokens` to get existing centralized tokens.
|
|
39
|
+
|
|
40
|
+
**Rate limit note**: Batch API calls in groups of 4-5 to stay within the 60 req/min limit.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Step 2: Collect all CSS values
|
|
45
|
+
|
|
46
|
+
For each fetched design, collect values from:
|
|
47
|
+
- `designTokens` — all values from the key-value pairs
|
|
48
|
+
- `cssProperties` — all values from the CSS rule declarations (decode TOON if needed)
|
|
49
|
+
|
|
50
|
+
Build a frequency map: `Map<normalizedValue, { count: number, designs: Set<designId>, properties: Set<cssPropertyName> }>`.
|
|
51
|
+
|
|
52
|
+
Normalize values by:
|
|
53
|
+
- Trimming whitespace
|
|
54
|
+
- Lowercasing hex colors (e.g. `#3B82F6` → `#3b82f6`)
|
|
55
|
+
- Normalizing rgb/rgba spacing (e.g. `rgb( 255, 255, 255 )` → `rgb(255, 255, 255)`)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### Step 3: Auto-categorize and name suggestions
|
|
60
|
+
|
|
61
|
+
For each value appearing 2+ times, auto-categorize:
|
|
62
|
+
|
|
63
|
+
| Pattern | Category | Name suggestion |
|
|
64
|
+
|---------|----------|----------------|
|
|
65
|
+
| `#hex`, `rgb(...)`, `rgba(...)`, `hsl(...)`, `oklch(...)` | `color` | `color.<semantic-hint>` |
|
|
66
|
+
| `Npx`, `Nrem`, `Nem`, `N%` (for padding, margin, gap) | `spacing` | `spacing.<size>` |
|
|
67
|
+
| Font family strings, `Npx`/`Nrem` font-size, font-weight numbers | `typography` | `typography.<role>` |
|
|
68
|
+
| `Npx` border-width, border-radius values | `border` | `border.<property>` |
|
|
69
|
+
| `box-shadow` values | `shadow` | `shadow.<level>` |
|
|
70
|
+
| `0.N` opacity values | `opacity` | `opacity.<level>` |
|
|
71
|
+
| Everything else | `other` | `other.<name>` |
|
|
72
|
+
|
|
73
|
+
For name suggestions, try to infer semantic meaning:
|
|
74
|
+
- If the CSS property name gives a clue (e.g. `background-color` → `color.bg`, `font-size` → `typography.size`)
|
|
75
|
+
- Use size labels: `xs`, `sm`, `md`, `lg`, `xl` based on relative values
|
|
76
|
+
- For colors, try to identify role: `primary`, `secondary`, `surface`, `text`, `border`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Step 4: Filter and present suggestions
|
|
81
|
+
|
|
82
|
+
1. Remove values that already match an existing centralized token (by exact value match).
|
|
83
|
+
2. Sort suggestions by usage count (highest first).
|
|
84
|
+
3. Present to the user in a clear table:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Found N repeating values across M designs:
|
|
88
|
+
|
|
89
|
+
# | Name (suggested) | Category | Value | Used in
|
|
90
|
+
---|-----------------------|------------|--------------|--------
|
|
91
|
+
1 | color.primary | color | #3b82f6 | 5 designs
|
|
92
|
+
2 | spacing.md | spacing | 16px | 4 designs
|
|
93
|
+
3 | typography.body.size | typography | 14px | 3 designs
|
|
94
|
+
...
|
|
95
|
+
|
|
96
|
+
Which tokens would you like to create? (e.g. "1,2,3" or "all" or "none")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### Step 5: Create approved tokens and link designs
|
|
102
|
+
|
|
103
|
+
For each approved suggestion:
|
|
104
|
+
|
|
105
|
+
1. Call `rb_create_design_token` with the name, category, value, and a description like "Auto-extracted from N designs".
|
|
106
|
+
2. For each design that uses this value, call `rb_link_design_token` with the design ID, token ID, and the CSS property name.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### Step 6: Report
|
|
111
|
+
|
|
112
|
+
Output a summary:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
✅ Created N design tokens, linked to M designs.
|
|
116
|
+
|
|
117
|
+
Created tokens:
|
|
118
|
+
- color.primary (#3b82f6) — linked to 5 designs
|
|
119
|
+
- spacing.md (16px) — linked to 4 designs
|
|
120
|
+
- ...
|
|
121
|
+
|
|
122
|
+
View your design system at: /features/design-system
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Constraints
|
|
128
|
+
|
|
129
|
+
- Stay within the 60 req/min MCP rate limit — batch calls in groups of 4-5.
|
|
130
|
+
- For large organizations with many features/designs, process in batches and show progress.
|
|
131
|
+
- If no repeating values are found, say so: "No repeating CSS values found across designs. Create tokens manually via /features/design-system or rb_create_design_token."
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rb:capture-design
|
|
3
|
+
description: |
|
|
4
|
+
Capture the visual design of a feature's UI component from source code and save it
|
|
5
|
+
as a TOON-encoded design in the Rayburst feature atlas.
|
|
6
|
+
Triggers: "capture design", "rb capture design", "save design", "snapshot design", "add design to feature".
|
|
7
|
+
user-invocable: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# rb:capture-design — Capture Component Design from Code
|
|
11
|
+
|
|
12
|
+
Reads a UI component's source code, builds a structured design representation in TOON format,
|
|
13
|
+
and saves it to the feature's Designs tab via `create_design`.
|
|
14
|
+
|
|
15
|
+
## MCP Tool Prefix
|
|
16
|
+
|
|
17
|
+
All MCP tools use: `mcp__plugin_rayburst_rayburst__`
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## CRITICAL RULES
|
|
22
|
+
|
|
23
|
+
1. **Never invent visual data** — only encode what is explicitly present in the source code (CSS classes, inline styles, Tailwind classes, CSS variables). If a value is computed at runtime, note it as `"dynamic"`.
|
|
24
|
+
2. **Always confirm the feature** before creating the design — ask the user if unsure which feature this component belongs to.
|
|
25
|
+
3. **Source is "code-analysis"** — always set `source: "code-analysis"` when calling `rb_create_design`.
|
|
26
|
+
4. **TOON encoding** — encode the design data object using `@toon-format/toon`'s `encode()` function before saving as `toonContent`.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Workflow
|
|
31
|
+
|
|
32
|
+
### Step 1: Identify the feature and component
|
|
33
|
+
|
|
34
|
+
If the user specified a component file path and/or feature, use those directly.
|
|
35
|
+
Otherwise:
|
|
36
|
+
1. Ask the user: "Which component or UI area do you want to capture?"
|
|
37
|
+
2. Call `rb_list_features` to find the matching feature.
|
|
38
|
+
3. Confirm with the user: "I'll capture the design for feature **[title]** from `[file path]`. Proceed?"
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Step 2: Read the component source
|
|
43
|
+
|
|
44
|
+
Read the component file(s). Extract:
|
|
45
|
+
- **Element structure**: HTML/JSX element types, nesting, key classNames
|
|
46
|
+
- **CSS properties**: All Tailwind classes, inline styles, CSS variables resolved to their values where possible
|
|
47
|
+
- **Layout**: flex/grid direction, gap, padding, margin, width, height
|
|
48
|
+
- **Typography**: font-size, font-weight, font-family, line-height, color
|
|
49
|
+
- **Visual**: background, border, border-radius, box-shadow, opacity
|
|
50
|
+
- **States**: hover, focus, active, disabled variants (from Tailwind or CSS)
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Step 3: Build the design data object
|
|
55
|
+
|
|
56
|
+
Construct a JavaScript object with this shape:
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
const designData = {
|
|
60
|
+
name: "<ComponentName> — <FeatureTitle>", // e.g. "Tab Bar — Page Tab Bar"
|
|
61
|
+
componentTree: {
|
|
62
|
+
type: "div", // root element type — MUST be a real HTML tag (div, span, button, etc.)
|
|
63
|
+
// or a PascalCase React component name. Never use Figma types.
|
|
64
|
+
className: "<classes>",
|
|
65
|
+
children: [
|
|
66
|
+
{ type: "button", className: "<classes>", variant: "active", children: [] },
|
|
67
|
+
{ type: "button", className: "<classes>", variant: "inactive", children: [] },
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
cssProperties: {
|
|
71
|
+
// Styles grouped by selector or variant
|
|
72
|
+
".tab-active": { background: "rgba(255,255,255,0.15)", color: "#fff", borderRadius: "9999px", padding: "8px 36px" },
|
|
73
|
+
".tab-inactive": { color: "rgba(255,255,255,0.6)", padding: "8px 36px" },
|
|
74
|
+
},
|
|
75
|
+
designTokens: {
|
|
76
|
+
// CSS variables or design tokens resolved to values
|
|
77
|
+
// e.g. "--color-primary": "#3b82f6"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Then encode as TOON using the `ctx_execute` MCP tool (context-mode) or equivalent:
|
|
83
|
+
```javascript
|
|
84
|
+
import { encode } from '@toon-format/toon'
|
|
85
|
+
const toonContent = encode(designData)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Step 4: Save the design
|
|
91
|
+
|
|
92
|
+
Call `rb_create_design` with:
|
|
93
|
+
```
|
|
94
|
+
featureId: <feature UUID>
|
|
95
|
+
name: "<ComponentName> — <FeatureTitle>"
|
|
96
|
+
source: "code-analysis"
|
|
97
|
+
componentTree: <componentTree object>
|
|
98
|
+
cssProperties: <cssProperties object>
|
|
99
|
+
designTokens: <designTokens object>
|
|
100
|
+
toonContent: <encoded TOON string>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Step 4.5: Link centralized design tokens
|
|
106
|
+
|
|
107
|
+
After saving the design, automatically link any matching centralized tokens:
|
|
108
|
+
|
|
109
|
+
1. Call `rb_list_design_tokens` to fetch all org-level design tokens.
|
|
110
|
+
2. For each centralized token, check if its `value` appears anywhere in the design's `cssProperties` or `designTokens`.
|
|
111
|
+
3. For each match, call `rb_link_design_token` with the `designId`, `tokenId`, and the matching `cssProperty` name.
|
|
112
|
+
4. Track counts: how many existing tokens were linked, and how many repeated CSS values could become new tokens (values appearing in the design that aren't yet centralized).
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### Step 5: Confirm
|
|
117
|
+
|
|
118
|
+
After successful creation, output:
|
|
119
|
+
```
|
|
120
|
+
✅ Design captured: "<name>"
|
|
121
|
+
Feature: <feature title> (<featureId>)
|
|
122
|
+
Design ID: <designId>
|
|
123
|
+
|
|
124
|
+
Linked N centralized tokens.
|
|
125
|
+
M CSS values could become new design tokens — run /rb:extract-tokens to review.
|
|
126
|
+
|
|
127
|
+
The design is now visible in the Designs tab of the feature.
|
|
128
|
+
To update it later, run /rb:capture-design again or use rb_update_design.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Constraints
|
|
134
|
+
|
|
135
|
+
- Only extract styles statically present in source — do not hallucinate values.
|
|
136
|
+
- If the component uses Tailwind, resolve class names to actual CSS values where known (e.g. `bg-blue-500` → `#3b82f6`).
|
|
137
|
+
- If multiple variants exist (e.g. active/inactive tabs), capture all variants in `componentTree` and `cssProperties`.
|
|
138
|
+
- `componentTree.type` MUST be a real HTML tag (`div`, `span`, `button`, `img`, `input`, etc.) or a PascalCase React component name — never Figma node types (`frame`, `text`, `group`, `rectangle`).
|
package/skills/review/SKILL.md
CHANGED
|
@@ -24,7 +24,7 @@ All MCP tools use: `mcp__plugin_rayburst_rayburst__`
|
|
|
24
24
|
1. **One change per AskUserQuestion prompt** — never batch multiple proposals together.
|
|
25
25
|
2. **Never apply a change without user approval** — every write, update, or delete requires an explicit "Apply" answer.
|
|
26
26
|
3. **Never delete a feature or criterion** that the user skips — move immediately to the next proposal.
|
|
27
|
-
4. **Present proposals in this order**: deletions first (highest impact), then updates, then additions.
|
|
27
|
+
4. **Present proposals in this order**: deletions first (highest impact), then updates, then additions, then visual migrations (🎨 MIGRATE) last.
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
@@ -35,6 +35,7 @@ All MCP tools use: `mcp__plugin_rayburst_rayburst__`
|
|
|
35
35
|
| 🗑️ | DELETE (red) | Removing a feature or criterion |
|
|
36
36
|
| ✏️ | UPDATE (yellow) | Changing description, title, or status |
|
|
37
37
|
| ➕ | ADD (green) | Adding a new criterion to an existing feature|
|
|
38
|
+
| 🎨 | MIGRATE (purple) | Visual criterion that belongs in Designs |
|
|
38
39
|
| ℹ️ | INFO (blue) | Context shown to the user, no action needed |
|
|
39
40
|
|
|
40
41
|
Always prefix the AskUserQuestion `question` text with the relevant icon and a short action label in CAPS, e.g.:
|
|
@@ -140,6 +141,22 @@ NEW CRITERION:
|
|
|
140
141
|
Reason: <one-line explanation of the behavior being captured>
|
|
141
142
|
```
|
|
142
143
|
|
|
144
|
+
**🎨 MIGRATE — Visual criterion (belongs in Designs)**
|
|
145
|
+
A criterion that describes appearance rather than behavior — e.g. it mentions colors, spacing,
|
|
146
|
+
font sizes, border radii, shadows, animation durations, or layout measurements.
|
|
147
|
+
These belong in feature Designs (TOON-encoded snapshots), not acceptance criteria.
|
|
148
|
+
Propose deleting the criterion and remind the user to run /rb:capture-design to capture the
|
|
149
|
+
appearance instead.
|
|
150
|
+
|
|
151
|
+
*Preview format:*
|
|
152
|
+
```
|
|
153
|
+
Feature: "<title>"
|
|
154
|
+
Criterion (visual — should be a Design):
|
|
155
|
+
"<criterion description>"
|
|
156
|
+
|
|
157
|
+
Reason: Describes appearance, not behavior. Run /rb:capture-design to capture the visual design.
|
|
158
|
+
```
|
|
159
|
+
|
|
143
160
|
---
|
|
144
161
|
|
|
145
162
|
### Step 3: Present Changes One at a Time
|
|
@@ -162,7 +179,8 @@ For each item in the change queue, call **AskUserQuestion** with:
|
|
|
162
179
|
|
|
163
180
|
- If **Apply** → execute the appropriate MCP call (`rb_update_feature`, `rb_update_criterion`,
|
|
164
181
|
`rb_add_criterion`, `rb_delete_criterion`, `rb_delete_feature`) and confirm success with a
|
|
165
|
-
one-line acknowledgement before presenting the next change.
|
|
182
|
+
one-line acknowledgement before presenting the next change. For 🎨 MIGRATE proposals, use
|
|
183
|
+
`rb_delete_criterion` and remind the user to run /rb:capture-design.
|
|
166
184
|
- If **Skip** → acknowledge with a one-line "Skipped." and immediately present the next change.
|
|
167
185
|
|
|
168
186
|
---
|